Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------WP_ShohinTypeItiran----------------------------
- Event Start
- Do 'LoadGridItem'
- Endevent
- Event Grid1.Load
- &ActionDelete.FromImage(ActionDelete)
- EndEvent
- Event 'SaveGrid'
- &Message.SetEmpty()
- Do 'ValidateGrid'
- If not &Message.IsEmpty()
- Msg(&Message)
- Else
- //更新処理
- Prc_ShohinTypeItiranUpdate(&SDT_ShohinType, &Delete_SDT_ShohinType)
- Msg(!"データが更新されました。")
- Do 'LoadGridItem'
- EndIf
- Endevent
- Event 'AddRow'
- &SDT_ShohinTypeItem = New()
- &SDT_ShohinType.Add(&SDT_ShohinTypeItem)
- Endevent
- Event 'ActionDelete'
- If not &SDT_ShohinType.CurrentItem.EditBeforeShohinTypeId.IsEmpty()
- //既存のデータの削除
- For each Shohin
- Where ShohinTypeId = &SDT_ShohinType.CurrentItem.ShohinTypeId
- Msg(!"商品区分" + &SDT_ShohinType.CurrentItem.ShohinTypeId.ToString().Trim() + !"は商品マスタで使用中です。")
- When none
- &SDT_ShohinTypeItem = &SDT_ShohinType.CurrentItem
- &Delete_SDT_ShohinType.Add(&SDT_ShohinTypeItem)
- &SDT_ShohinType.Remove(&SDT_ShohinType.IndexOf(&SDT_ShohinTypeItem))
- Endfor
- Else
- //新規データの削除
- &SDT_ShohinTypeItem = &SDT_ShohinType.CurrentItem
- &SDT_ShohinType.Remove(&SDT_ShohinType.IndexOf(&SDT_ShohinTypeItem))
- Endif
- EndEvent
- Sub 'ValidateGrid'
- //キーが未入植の項目が存在しないか
- For &SDT_ShohinTypeItem in &SDT_ShohinType
- if &SDT_ShohinTypeItem.ShohinTypeId.IsEmpty()
- &Message = !"商品区分番号が未入力のデータが存在します。"
- //Return
- Endif
- Endfor
- //名称が未入植の項目が存在しないか
- For &SDT_ShohinTypeItem in &SDT_ShohinType
- if &SDT_ShohinTypeItem.ShohinTypeName.IsEmpty()
- &Message = !"商品区分名称が未入力のデータが存在します。"
- //Return
- Endif
- Endfor
- //キー項目が変更されていないか
- For &SDT_ShohinTypeItem in &SDT_ShohinType
- if not &SDT_ShohinTypeItem.EditBeforeShohinTypeId.IsEmpty()
- if not &SDT_ShohinTypeItem.EditBeforeShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
- &Message = !"商品区分番号" + &SDT_ShohinTypeItem.ShohinTypeId.ToString().Trim() + !"(変更前:" + &SDT_ShohinTypeItem.EditBeforeShohinTypeId.ToString().Trim() + !")" + !"の商品区分番号は変更できません。"
- //Return
- Endif
- Endif
- Endfor
- //キーが重複していないか
- &Tmp_SDT_ShohinType.Clear()
- For &SDT_ShohinTypeItem in &SDT_ShohinType
- For &Tmp_SDT_ShohinTypeItem in &Tmp_SDT_ShohinType
- If &Tmp_SDT_ShohinTypeItem.ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
- &Message = !"商品区分番号" + &SDT_ShohinTypeItem.ShohinTypeId.ToString().Trim() + !"が複数入力されています。"
- //Return
- Endif
- Endfor
- &Tmp_SDT_ShohinType.Add(&SDT_ShohinTypeItem)
- Endfor
- //削除するデータが使用されているか
- For &SDT_ShohinTypeItem in &Delete_SDT_ShohinType
- For each Shohin
- Where ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
- &Message = !"商品区分番号" + &SDT_ShohinTypeItem.ShohinTypeId.ToString().Trim() + !"は商品マスタで使用中です。"
- //Return
- Endfor
- Endfor
- EndSub
- Sub 'LoadGridItem'
- &Delete_SDT_ShohinType = New()
- &SDT_ShohinType = New()
- For each
- &SDT_ShohinTypeItem = New()
- &SDT_ShohinTypeItem.EditBeforeShohinTypeId = ShohinTypeId
- &SDT_ShohinTypeItem.ShohinTypeId = ShohinTypeId
- &SDT_ShohinTypeItem.ShohinTypeName = ShohinTypeName
- &SDT_ShohinType.Add(&SDT_ShohinTypeItem)
- Endfor
- EndSub
- ----------------------------Prc_ShohinTypeItiranUpdate----------------------------
- For &SDT_ShohinTypeItem in &Delete_SDT_ShohinType
- For each Shohin
- Where ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
- When none
- For each ShohinType
- Where ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
- Delete
- Endfor
- Endfor
- Endfor
- for &SDT_ShohinTypeItem in &pSDT_ShohinType
- For each
- Where ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
- ShohinTypeName = &SDT_ShohinTypeItem.ShohinTypeName
- when none
- New
- ShohinTypeId = &SDT_ShohinTypeItem.ShohinTypeId
- ShohinTypeName = &SDT_ShohinTypeItem.ShohinTypeName
- Endnew
- Endfor
- Endfor
- Commit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement