Exemple #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);
            }
        }
Exemple #2
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);
            }
        }