public override void SaveModel()
 {
     if (this.Validation())
     {
         DIC_HUYEN     huyen = (DIC_HUYEN)this.GetModel();
         SqlResultType flag;
         if (this.actions == Common.Common.Class.Actions.AddNew)
         {
             flag = new DistrictProvider().Insert(huyen);
         }
         else
         {
             flag = new DistrictProvider().Update(huyen);
         }
         SaveCompleteEventArgs args = new SaveCompleteEventArgs();
         args.Result  = flag == SqlResultType.OK;
         args.Model   = huyen;
         args.Message = "Không lưu được thông tin huyện";
         this.SaveCompleteSuccess(huyen, args);
     }
     else
     {
         XtraMessageBox.Show("Thông tin chưa hợp lệ kiểm tra lại thông tin.");
     }
 }
        public override object GetModel()
        {
            DIC_HUYEN huyen = new DIC_HUYEN();

            huyen.MaHuyen  = txtID.EditValue as string;
            huyen.TenHuyen = txtName.Text;
            huyen.MaTinh   = cmbProvince.EditValue as string;
            huyen.Status   = ckbStatus.Checked ? 1 : 0;
            return(huyen);
        }
        private void BindingModel()
        {
            this.dxErrorProviderModel.ClearErrors();
            this.isUpdated = false;
            this.isEdited  = false;
            DIC_HUYEN huyen = (DIC_HUYEN)this.Model;

            txtID.Text            = huyen.MaHuyen.ToString();
            txtName.Text          = huyen.TenHuyen;
            cmbProvince.EditValue = huyen.MaTinh;
            ckbStatus.Checked     = huyen.Status == 1;
            txtID.ReadOnly        = true;
            this.isUpdated        = true;
        }
Exemple #4
0
 // GET: QuanHuyen
 public ActionResult Index(string text, string matinh, string cap, bool status = true, int page = 1, int pagesize = 20)
 {
     this.SetPageInfo(page, pagesize);
     ViewBag.text   = text;
     ViewBag.cap    = cap;
     ViewBag.status = status;
     ViewBag.matinh = matinh;
     using (DIC_HUYEN dic_huyen = new DIC_HUYEN())
     {
         string _cap       = dic_huyen.GetCapById(cap);
         var    dic_huyens = dic_huyen.GetFilter(text, CheckString(_cap) ? null : _cap, status ? "1" : "0", matinh == null ? null : matinh.Equals("0") ? null : matinh).ToPagedList(page, pagesize);
         return(View(dic_huyens));
     }
 }
Exemple #5
0
 public SqlResultType Delete(DIC_HUYEN huyen)
 {
     try
     {
         this.sqlHelper.CommandType = CommandType.StoredProcedure;
         object result = this.sqlHelper.ExecuteScalar("DeleteHuyen", new string[] { "@MaHuyen" }, new object[] { huyen.MaHuyen });
         int    kq     = Convert.ToInt32(result);
         return(this.GetResult(kq));
     }
     catch (Exception ex)
     {
         log.Error("Delete DANH MUC HUYEN/THI XA", ex);
         return(SqlResultType.Exception);
     }
 }
 public override bool DeleteModel()
 {
     if (this.Model != null)
     {
         if (XtraMessageBox.Show("Bạn có muốn xóa bản ghi này không?", "Xóa bản ghi", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
         {
             DIC_HUYEN     tinhthanh  = (DIC_HUYEN)this.Model;
             SqlResultType resultType = new DistrictProvider().Delete(tinhthanh);
             if (resultType == SqlResultType.OK)
             {
                 this.ClearModel();
                 this.DisabledLayout(true);
             }
             return(resultType == SqlResultType.OK);
         }
     }
     return(false);
 }
Exemple #7
0
 public SqlResultType Insert(DIC_HUYEN huyen)
 {
     try
     {
         this.sqlHelper.CommandType = CommandType.StoredProcedure;
         object result = this.sqlHelper.ExecuteScalar("InsertHuyen",
                                                      new string[] { "@MaHuyen", "@MaTinh", "@TenHuyen", "@Status" },
                                                      new object[] { huyen.MaHuyen, huyen.MaTinh, huyen.TenHuyen, huyen.Status }
                                                      );
         int kq = Convert.ToInt32(result);
         return(this.GetResult(kq));
     }
     catch (Exception ex)
     {
         log.Error("Insert DANH MUC HUYEN/THI XA", ex);
         return(SqlResultType.Exception);
     }
 }
Exemple #8
0
 protected List <DIC_HUYEN> DataReaderToList(SqlDataReader dataReader)
 {
     try
     {
         List <DIC_HUYEN> dsChuyenKhoa = new List <DIC_HUYEN>();
         while (dataReader.Read())
         {
             DIC_HUYEN huyen = new DIC_HUYEN();
             huyen.MaHuyen  = dataReader["MaHuyen"].ToString();
             huyen.TenHuyen = dataReader["TenHuyen"].ToString();
             huyen.MaTinh   = dataReader["MaTinh"].ToString();
             huyen.TenTinh  = dataReader["TenTinh"].ToString();
             huyen.Status   = DataConverter.StringToInt(dataReader["Status"].ToString());
             dsChuyenKhoa.Add(huyen);
         }
         return(dsChuyenKhoa);
     }
     catch (Exception ex)
     {
         log.Error("Generate DANH MUC HUYEN/THI XA", ex);
         return(null);
     }
 }