Пример #1
0
        public ActionResult CHOT_CAPPHAT(List <int> lstIDDonthuoc, DateTime Ngay_Chot)
        {
            int          v_intResult;
            ActionResult actResult;

            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var dbscope = new SharedDbConnectionScope())
                    {
                        TLichsuChotthuoc _newItem = new TLichsuChotthuoc();
                        _newItem.NgayChot  = Ngay_Chot;
                        _newItem.NguoiChot = globalVariables.UserName;
                        _newItem.IsNew     = true;
                        _newItem.Save();
                        object obj = TLichsuChotthuoc.CreateQuery().GetMax("ID_CHOT");
                        TPhieuXuatthuocBenhnhanCollection vCollection = new TPhieuXuatthuocBenhnhanCollection();
                        v_intResult = new Update(TPhieuXuatthuocBenhnhan.Schema.TableName).Set(TPhieuXuatthuocBenhnhan.NgayChotColumn).EqualTo(Ngay_Chot)
                                      .Set(TPhieuXuatthuocBenhnhan.IdChotColumn).EqualTo(Utility.Int32Dbnull(obj, -1))
                                      .Where(TPhieuXuatthuocBenhnhan.NgayChotColumn).IsNull()
                                      .And(TPhieuXuatthuocBenhnhan.IdDonthuocColumn).In(lstIDDonthuoc)
                                      .Execute();
                    }
                    scope.Complete();
                    return(ActionResult.Success);
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Lỗi:\n" + ex.ToString());
                return(ActionResult.Error);
            }
        }
Пример #2
0
 public ActionResult CHOT_CAPPHAT(List<int> lstIDDonthuoc, DateTime Ngay_Chot)
 {
     int v_intResult;
     ActionResult actResult;
     try
     {
         using (var scope = new TransactionScope())
         {
             using (var dbscope = new SharedDbConnectionScope())
             {
                 TLichsuChotthuoc _newItem = new TLichsuChotthuoc();
                 _newItem.NgayChot = Ngay_Chot;
                 _newItem.NguoiChot = globalVariables.UserName;
                 _newItem.IsNew = true;
                 _newItem.Save();
                 object obj = TLichsuChotthuoc.CreateQuery().GetMax("ID_CHOT");
                 TPhieuXuatthuocBenhnhanCollection vCollection = new TPhieuXuatthuocBenhnhanCollection();
                 v_intResult = new Update(TPhieuXuatthuocBenhnhan.Schema.TableName).Set(TPhieuXuatthuocBenhnhan.NgayChotColumn).EqualTo(Ngay_Chot)
                         .Set(TPhieuXuatthuocBenhnhan.IdChotColumn).EqualTo(Utility.Int32Dbnull(obj, -1))
                         .Where(TPhieuXuatthuocBenhnhan.NgayChotColumn).IsNull()
                         .And(TPhieuXuatthuocBenhnhan.IdDonthuocColumn).In(lstIDDonthuoc)
                         .Execute();
             }
             scope.Complete();
             return ActionResult.Success;
         }
     }
     catch (Exception ex)
     {
         Utility.ShowMsg("Lỗi:\n" + ex.ToString());
         return ActionResult.Error;
     }
 }
Пример #3
0
        public ActionResult CHOT_CAPPHAT_NOITRU(int IdCapphat, DateTime Ngay_Chot)
        {
            int          v_intResult;
            ActionResult actResult;

            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var dbscope = new SharedDbConnectionScope())
                    {
                        TLichsuChotthuoc _newItem = new TLichsuChotthuoc();
                        _newItem.NgayChot  = Ngay_Chot;
                        _newItem.NguoiChot = globalVariables.UserName;
                        _newItem.Noitru    = 1;
                        _newItem.IsNew     = true;
                        _newItem.Save();
                        object obj = TLichsuChotthuoc.CreateQuery().GetMax("ID_CHOT");
                        v_intResult = new Update(TPhieuCapphatNoitru.Schema.TableName)
                                      .Set(TPhieuCapphatNoitru.NgayChotColumn).EqualTo(Ngay_Chot)
                                      .Set(TPhieuCapphatNoitru.NguoiChotColumn).EqualTo(globalVariables.UserName)
                                      .Set(TPhieuCapphatNoitru.IdChotColumn).EqualTo(Utility.Int32Dbnull(obj, -1))
                                      .Set(TPhieuCapphatNoitru.NgayHuychotColumn).EqualTo(null)
                                      .Set(TPhieuCapphatNoitru.NguoiHuychotColumn).EqualTo(string.Empty)
                                      .Set(TPhieuCapphatNoitru.LydoHuychotColumn).EqualTo(string.Empty)
                                      .Where(TPhieuCapphatNoitru.NgayChotColumn).IsNull()
                                      .And(TPhieuCapphatNoitru.Columns.IdCapphat).IsEqualTo(IdCapphat)
                                      .Execute();
                    }
                    scope.Complete();
                    return(ActionResult.Success);
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Lỗi:\n" + ex.ToString());
                return(ActionResult.Error);
            }
        }
Пример #4
0
        public void Insert(DateTime NgayChot,string NguoiChot)
        {
            TLichsuChotthuoc item = new TLichsuChotthuoc();

            item.NgayChot = NgayChot;

            item.NguoiChot = NguoiChot;

            item.Save(UserName);
        }
Пример #5
0
        public void Update(int IdChot,DateTime NgayChot,string NguoiChot)
        {
            TLichsuChotthuoc item = new TLichsuChotthuoc();
            item.MarkOld();
            item.IsLoaded = true;

            item.IdChot = IdChot;

            item.NgayChot = NgayChot;

            item.NguoiChot = NguoiChot;

            item.Save(UserName);
        }
Пример #6
0
 public ActionResult CHOT_CAPPHAT_NOITRU(int IdCapphat, DateTime Ngay_Chot)
 {
     int v_intResult;
     ActionResult actResult;
     try
     {
         using (var scope = new TransactionScope())
         {
             using (var dbscope = new SharedDbConnectionScope())
             {
                 TLichsuChotthuoc _newItem = new TLichsuChotthuoc();
                 _newItem.NgayChot = Ngay_Chot;
                 _newItem.NguoiChot = globalVariables.UserName;
                 _newItem.Noitru = 1;
                 _newItem.IsNew = true;
                 _newItem.Save();
                 object obj = TLichsuChotthuoc.CreateQuery().GetMax("ID_CHOT");
                 v_intResult = new Update(TPhieuCapphatNoitru.Schema.TableName)
                        .Set(TPhieuCapphatNoitru.NgayChotColumn).EqualTo(Ngay_Chot)
                        .Set(TPhieuCapphatNoitru.NguoiChotColumn).EqualTo(globalVariables.UserName)
                         .Set(TPhieuCapphatNoitru.IdChotColumn).EqualTo(Utility.Int32Dbnull(obj, -1))
                         .Set(TPhieuCapphatNoitru.NgayHuychotColumn).EqualTo(null)
                          .Set(TPhieuCapphatNoitru.NguoiHuychotColumn).EqualTo(string.Empty)
                          .Set(TPhieuCapphatNoitru.LydoHuychotColumn).EqualTo(string.Empty)
                         .Where(TPhieuCapphatNoitru.NgayChotColumn).IsNull()
                         .And(TPhieuCapphatNoitru.Columns.IdCapphat).IsEqualTo(IdCapphat)
                         .Execute();
             }
             scope.Complete();
             return ActionResult.Success;
         }
     }
     catch (Exception ex)
     {
         Utility.ShowMsg("Lỗi:\n" + ex.ToString());
         return ActionResult.Error;
     }
 }