Esempio n. 1
0
        public override bool SaveData()
        {
            DateTime time = DateTime.Now.ServerNow();

            lstEdited.ToList().ForEach(x =>
            {
                eDonViTinh dvt = (eDonViTinh)rlokDVT.GetDataSourceRowByKeyValue(x.IDDonViTinh) ?? new eDonViTinh();
                x.MaDonViTinh  = dvt.Ma;
                x.TenDonViTinh = dvt.Ten;

                x.MauSac = rpclr.ColorText.ToString();
                // x.ColorHex = x.Color.ToArgb();

                if (x.KeyID > 0)
                {
                    x.NguoiCapNhat    = clsGeneral.curPersonnel.KeyID;
                    x.MaNguoiCapNhat  = clsGeneral.curPersonnel.Ma;
                    x.TenNguoiCapNhat = clsGeneral.curPersonnel.Ten;
                    x.NgayCapNhat     = time;
                }
                else
                {
                    x.NguoiTao    = clsGeneral.curPersonnel.KeyID;
                    x.MaNguoiTao  = clsGeneral.curPersonnel.Ma;
                    x.TenNguoiTao = clsGeneral.curPersonnel.Ten;
                    x.NgayTao     = time;
                }
            });

            Tuple <bool, List <eSanPham> > Res = clsFunction.Post("sanpham", lstEdited.ToList());

            return(Res.Item1);
        }
        public async override Task <bool> SaveData()
        {
            lstEdited.ToList().ForEach(x =>
            {
                eDonViTinh dvt = (eDonViTinh)rlokDVT.GetDataSourceRowByKeyValue(x.IDDonViTinh) ?? new eDonViTinh();
                x.MaDonViTinh  = dvt.Ma;
                x.TenDonViTinh = dvt.Ten;

                x.MauSac = rpclr.ColorText.ToString();
                //x.ColorHex = x.Color.ToArgb();
            });


            bool chk = false;

            chk = await clsFunction <eSanPham> .Instance.AddOrUpdate(lstEdited.ToList());

            return(chk);
        }