Ejemplo n.º 1
0
        private void XuLyNutOKTrenFormGiaIn_Click(GiaInForm frm)
        {
            GiaIn giaIn = null;

            switch (frm.FormState)
            {
            case (int)Ennums.FormState.New:
                //Add
                giaIn = new GiaIn(frm.IdBangGiaChon, frm.KieuIn, frm.IdHangKH,
                                  frm.SoTrangA4, frm.IdBaiIn, frm.TenBangGiaChon, frm.TienIn, frm.GiaTBTrangInfo); //Id tự tạo

                tinhGiaPres.ThemGiaIn(giaIn);


                break;

            case (int)Ennums.FormState.Edit:
                //Tạo
                giaIn = this.GiaInS.Find(x => x.ID == this.IdGiaInChon);
                giaIn.IdBangGiaChon = frm.IdBangGiaChon;
                giaIn.KieuIn        = frm.KieuIn;
                giaIn.LoaiBangGia   = frm.IdHangKH;
                giaIn.SoTrangA4     = frm.SoTrangA4;
                giaIn.TienIn        = frm.TienIn;
                giaIn.IdBaiIn       = frm.IdBaiIn;
                giaIn.GiaTBTrang    = frm.GiaTBTrangInfo;
                //Không cần cập nhật vì tự động khi Find
                //tinhGiaPres.CapNhatGiaIn(giaIn);

                break;
            }
        }
        private void XuLyNutOKTrenFormGiaIn_Click(GiaInForm frm)
        {
            switch (frm.FormState)
            {
            case (int)Ennums.FormState.New:
                //Add
                var giaIn = new GiaIn(frm.IdBangGiaChon, frm.KieuIn, frm.LoaiBangGia,
                                      frm.SoTrangA4, frm.IdBaiIn, frm.TenBangGiaChon, frm.TienIn); //Id tự tạo

                tinhGiaPres.ThemGiaIn(giaIn);


                break;

            case (int)Ennums.FormState.Edit:
                //Tạo
                var giaInE = new GiaIn();
                giaInE.ID            = frm.ID;//Tránh ID tự tạo
                giaInE.IdBangGiaChon = frm.IdBangGiaChon;
                giaInE.KieuIn        = frm.KieuIn;
                giaInE.LoaiBangGia   = frm.LoaiBangGia;
                giaInE.SoTrangA4     = frm.SoTrangA4;
                giaInE.TienIn        = frm.TienIn;
                giaInE.IdBaiIn       = frm.IdBaiIn;
                tinhGiaPres.CapNhatGiaIn(giaInE);
                break;
            }
        }
        public void ThemGiaIn(GiaIn giaIn)
        {
            var tmpCauHinh = View.GiaInS.Where(x => x.ID == giaIn.ID).SingleOrDefault();

            if (tmpCauHinh == null)
            {
                View.GiaInS.Add(giaIn);
            }
        }
        public void CapNhatGiaIn(GiaIn giaIn)
        {
            var item = View.GiaInS.Find(x => x.ID == giaIn.ID);

            if (item != null)
            {
                item.ID            = giaIn.ID;
                item.IdBangGiaChon = giaIn.IdBangGiaChon;
                item.KieuIn        = giaIn.KieuIn;
                item.LoaiBangGia   = giaIn.LoaiBangGia;
                item.SoTrangA4     = giaIn.SoTrangA4;
                item.TienIn        = giaIn.TienIn;
                item.IdBaiIn       = giaIn.IdBaiIn;
            }
        }
Ejemplo n.º 5
0
 public void SuaGiaIn(GiaIn giaIn)
 {
     baiIn.Sua_GiaIn(giaIn);
 }
Ejemplo n.º 6
0
 public void ThemGiaIn(GiaIn giaIn)
 {
     baiIn.Them_GiaIn(giaIn);
 }
 public void ThemGiaIn(GiaIn giaIn)
 {
     tinhGiaIn.DocBaiInTheoID(View.IdBaiInChon).Them_GiaIn(giaIn);
 }