๐Ÿ“–
BPackCore CodingConventions
  • ๊ณตํ†ต
  • Desktop Application
    • UI ๋””์ž์ธ ๋ฐ ์‹คํ–‰๊ตฌ์กฐ
    • ๋””๋ ‰ํ† ๋ฆฌ ๊ตฌ์กฐ
    • ๋ช…๋ช…๊ทœ์น™ ๋ฐ ๊ตฌํ˜„
      • Model
      • IPocket
      • Pocket
      • Zipper
      • Carrying
        • Args (FormArgs)
        • MainForm
        • SubForm
        • EditForm
        • StrapControl
        • FileUp/Download
      • Tips
    • ๋‹ค๊ตญ์–ด์ฒ˜๋ฆฌ
  • Web Application - Mobile
    • UI ๋””์ž์ธ
    • ๋””๋ ‰ํ† ๋ฆฌ ๊ตฌ์กฐ
    • ๋ช…๋ช…๊ทœ์น™ ๋ฐ ๊ตฌํ˜„
      • Model
      • Controller
      • View
      • Tips
    • ๋‹ค๊ตญ์–ด์ฒ˜๋ฆฌ
  • Database
    • ๋ช…๋ช…๊ทœ์น™
      • ์šฉ์–ด์‚ฌ์ „
    • SP ๊ตฌํ˜„
      • Template
      • ์ผ๋ จ๋ฒˆํ˜ธ๋ฐœํ–‰
    • ERD ์ž‘์„ฑ๊ทœ์น™ ๋ฐ ์ƒ˜ํ”Œ
  • ์†Œ์Šคํ˜•์ƒ๊ด€๋ฆฌ(Git/Gitlab)
  • WebAPI
Powered by GitBook
On this page
  • ModelArgs ์ƒ์„ฑ
  • Model ์ƒ์„ฑ
  • Attribute (Annotation)
  • StrapDenyEditAttribute
  • StrapDisableParamAttribute
  • StrapEnableAttribute
  • StrapHiddenAttribute
  • StrapMaxWidthAttribute
  • StrapMinWidthAtrribute
  • StrapVisibleAttribute
  • StrapWidthAttribute
  1. Desktop Application
  2. ๋ช…๋ช…๊ทœ์น™ ๋ฐ ๊ตฌํ˜„

Model

Previous๋ช…๋ช…๊ทœ์น™ ๋ฐ ๊ตฌํ˜„NextIPocket

Last updated 5 years ago

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 ์„ค์ •