ModelArgs ์์ฑ
SP ํน์ TEXT๋ก ์์ฑ๋ Query๋ฌธ์ ์กฐ๊ฑด Parameter๋ฅผ ์ ์ํ๋ Class ์ด๋ค.
BPack.Model.App ํ๋ก์ ํธ - ์
๋ฌด๋ชจ๋ํด๋ โ ํ๋ก๊ทธ๋จ์ฝ๋ํด๋๋ด ์์ฑ
: BPack.Model.App.์
๋ฌด๋ชจ๋.ํ๋ก๊ทธ๋จ์ฝ๋.XxxModelArgs.cs
ex) BPack.Model.App.MM.PurInbound.PurInboundModelArgs.cs
namespace BPack.Model.App.MM.PurInbound
{
public class PurInboundModelArgs : ModelArgsBase
{
public string Select_Comp_Cd { get; set; }
public string Select_Extra_Plant_Cd { get; set; }
public string Select_Main_Bp_Cd { get; set; }
public string Select_Main_Pih_No { get; set; }
public string Select_Pih_No { get; set; }
public string Select_Pid_No { get; set; }
}
}
Parent Class : ModelArgsBase Ex) public class PurInboundModelArgs : ModelArgsBase
SP์์ ์ฌ์ฉํ๋ Parameter์ ๋์นญ๋๋ ํ์
์ ์ฌ์ฉํ๋ค.
- char, varchar, nvarchar โฆ -> string
- date, datetime -> DateTime
- int -> int
- numeric -> decimal
์ฌ์ฉํ๋ SP์ ๊ตฌ๋ถ์ ๋ง๊ฒ ์ ๋์ด๋ฅผ ์ฌ์ฉํ ๊ฒ : Select SP์ผ๋ Select
Ex) public string Select_Comp_Cd { get; set; } public string Select_Main_Bp_Cd { get; set; }
(Main ์กฐํ์กฐ๊ฑด์์ ๊ฐ์ ธ์จ ํ๋ผ๋ฉํฐ๊ฐ)
Model ์์ฑ
Data์ Type์ ์ ์ํ๋ Class๋ก ๋๋ถ๋ถ Column ๋ช
์นญ๊ณผ ์ผ์นํ๋ค.
BPack.Model.App ํ๋ก์ ํธ - ์
๋ฌด๋ชจ๋ํด๋ โ ํ๋ก๊ทธ๋จ์ฝ๋ํด๋๋ด ์์ฑ
: BPack.Model.App.์
๋ฌด๋ชจ๋.ํ๋ก๊ทธ๋จ์ฝ๋.XxxModel.cs
ex) BPack.Model.App.MM.PurInbound.InHeaderModel.cs
namespace BPack.Model.App.MM.PurInbound
{
public class InHeaderModel : ModelBase_CommonColumns
{
[ReadOnly(true)]
[Key]
[StrapVisible(false, false, false)]
public string PIH_NO_KEY { get; set; }
[Display(Name = "๊ตฌ๋งค์
๊ณ ๋ฒํธ")]
[StrapDenyEdit]
public string PIH_NO { get; set; }
[Display(Name = "ํ์ฌ์ฝ๋")]
[ReadOnly(true)]
[StrapDenyEdit]
public string COMP_CD { get; set; }
[Display(Name = "๊ฑฐ๋์ฒ")]
public string BP_CD { get; set; }
[Display(Name = "์
๊ณ ๊ณต์ฅ")]
public string IN_PLANT_CD { get; set; }
[Display(Name = "์
๊ณ ์์ ๋ฒํธ")]
[StrapVisible(false, false, false)]
public string DO_NO { get; set; }
[Display(Name = "์ฒ๋ฆฌ์ผ์")]
public DateTime? CLOSE_DTTM { get; set; }
[Display(Name = "์
๊ณ ์ฒ๋ฆฌ์ํ")]
public string PIH_STATUS { get; set; }
[Display(Name = "์ญ์ FLAG")]
[StrapVisible(false, false, false)]
public string DEL_FG { get; set; } = "N";
}
}
Parent Class : ModelBase, ModelBase_CommonColumns(๊ณตํต์ปฌ๋ผํฌํจ)
Ex) public class InHeaderModel : ModelBase
public class InHeaderModel : ModelBase_CommonColumns
์ปฌ๋ผ๋ช
์ ํด๋นํ๋ ์์ฑ์ ์ปฌ๋ผ๋ช
๊ณผ ๋์ผํด์ผํจ
Attribute (Annotation)
Attribute(Annotation)
: Display, Readonly๋ฑ System.ComponentModel.DataAnnotations์ Attribute๊ณผ
StrapVisible, StrapDenyEdit, StrapDisableParam๋ฑ StrapAnnotation์ฌ์ฉ
StrapDenyEditAttribute
์์ ์ด ๋ถ๊ฐ๋ฅํ๋๋ก ์ค์ ํ๋ค. (Column.AllowEdit = false)
[Display(Name = "์ธ์ด์ฝ๋")]
[StrapDenyEdit]
public string LANGUAGE_CODE { get; set; }
StrapDisableParamAttribute
Query ์คํ์ ํ๋ผ๋ฏธํฐ์์ ์ ์ธํ๋ค.
[Display(Name = "์ ํ")]
[StrapDisableParam]
public bool IsCheck { get; set; } = false;
StrapEnableAttribute
EditForm์ DataLayout์์ Enable ์ค์ ํ๋ ์ฉ๋์ด๋ ์ฌ์ฉํ์ง ์์.
StrapHiddenAttribute
์ปฌ๋ผ Hidden ์ฉ๋์ด๋ ์ฌ์ฉํ์ง ์์. (StrapVisibleAttribute ์ฌ์ฉ)
StrapMaxWidthAttribute
์ปฌ๋ผ์ MaxWidth ์ค์
StrapMinWidthAtrribute
์ปฌ๋ผ์ MinWidth ์ค์
StrapVisibleAttribute
์ปฌ๋ผ, DataLayout์ Visible ์์ฑ ์ค์
public StrapVisibleAttribute(bool whenRead = false, bool whenCreate = false, bool whenEdit = false)
{
this.WhenRead = whenRead;
this.WhenCreate = whenCreate;
this.WhenEdit = whenEdit;
}
public bool WhenRead { get; set; }
public bool WhenCreate { get; set; }
public bool WhenEdit { get; set; }
[StrapVisible(false, false, false)]
public RowState RowState { get; set; } = RowState.UnChanged;
StrapWidthAttribute
์ปฌ๋ผ์ Width ์ค์