Beispiel #1
0
        public void EditDSTru(int id, string field, string oldvalue, string newvalue, object BangCTMB)
        {
            daChiTieu dCT = new daChiTieu();

            dCT.CTTim.Ma   = newvalue;
            dCT.CTTim.Nhom = Nhom;

            daChiTieuDanSuat dDS = new daChiTieuDanSuat();

            dDS.PT.IDMauBieu = ucChiTieuMB1.IDmauBieu;
            dDS.PT.IDChiTieu = ucChiTieuMB1.IDChiTieu;

            if (newvalue == "")
            {
                dDS.PT.MaChiTieuDanSuat = oldvalue;
                dDS.XoaDanSuatTru();
                ucChiTieuMB1.DSruOK(id, true);
                return;
            }

            if (dCT.Tim() == null)
            {
                ucChiTieuMB1.DSruOK(id, false);
                X.Msg.Alert("", "Không tìm thấy chỉ tiêu dẫn suất có mã là: " + newvalue).Show();
            }
            else
            {
                dDS.PT.IDChiTieuDanSuat = dCT.CTTim.ID;
                dDS.PT.MaChiTieuDanSuat = newvalue.ToUpper();
                dDS.PT.HeSo             = 1;

                dDS.ThemDanSuatTru();
                ucChiTieuMB1.DSruOK(id, true);
            }
        }
        public void DanhSachDanSuatTru()
        {
            daChiTieuDanSuat dCTDS = new daChiTieuDanSuat();

            dCTDS.PT.IDMauBieu = IDmauBieu;
            dCTDS.PT.IDChiTieu = IDChiTieu;

            stoDSTru.DataSource = dCTDS.DanhSachDanSuatTru();
            stoDSTru.DataBind();
        }
Beispiel #3
0
        public void EditDSNhan(int id, string field, string oldvalue, string newvalue, object BangCTMB)
        {
            if (field != "MaChiTieuDanSuat")
            {
                return;
            }
            daChiTieu dCT = new daChiTieu();

            dCT.CTTim.Ma   = newvalue;
            dCT.CTTim.Nhom = Nhom;

            daChiTieuDanSuat dDS = new daChiTieuDanSuat();

            dDS.PT.IDMauBieu = ucChiTieuMB1.IDmauBieu;
            dDS.PT.IDChiTieu = ucChiTieuMB1.IDChiTieu;

            if (newvalue == "")
            {
                dDS.PT.MaChiTieuDanSuat = oldvalue;
                dDS.XoaDanSuatNhan();
                ucChiTieuMB1.DSNhanOK(id, true);
                return;
            }

            if (dCT.Tim() == null)
            {
                ucChiTieuMB1.DSNhanOK(id, false);
                X.Msg.Alert("", "Không tìm thấy chỉ tiêu dẫn suất có mã là: " + newvalue).Show();
            }
            else
            {
                dDS.PT.IDChiTieuDanSuat = dCT.CTTim.ID;
                dDS.PT.MaChiTieuDanSuat = newvalue.ToUpper();

                Newtonsoft.Json.Linq.JObject node = JSON.Deserialize <Newtonsoft.Json.Linq.JObject>(BangCTMB.ToString());
                try
                {
                    dDS.PT.HeSo = Decimal.Parse(node.Property("HeSo").Value.ToString());
                }
                catch
                {
                    dDS.PT.HeSo = 1;
                }


                dDS.ThemDanSuatNhan();
                ucChiTieuMB1.DSNhanOK(id, true);
            }
        }