Esempio n. 1
0
 /// <summary>
 /// Event button insert click
 /// </summary>
 /// <modified>
 /// Author          Date            Comment
 /// HungNM          14/06/2014      Add
 /// </modified>
 protected void btnInsert_Click(object sender, EventArgs e)
 {
     _city = new VO.CITY();
     // Validate
     _validate = new Common.Validate();
     GetInput();
     if (_validate.IsError)
     {
         ShowMessage(_validate.Message);
         return;
     }
     // Check exist
     BUS.CITY objBUS = new BUS.CITY();
     if (objBUS.CheckExist(_city.ID, _city.CITY_NAME.ToLower()) > 0)
     {
         ShowMessage("Tên thành phố đã tồn tại!");
         return;
     }
     // Insert
     if (objBUS.Insert(_city) > 0)
         RunJavascript("alert('Thêm mới thành công');window.location='/Admin/City/Default.aspx'");
     else
         RunJavascript("alert('Thêm mới thất bại');window.location='/Admin/City/Default.aspx'");
 }
Esempio n. 2
0
 /// <summary>
 /// Event button update click
 /// </summary>
 /// <modified>
 /// Author          Date            Comment
 /// HungNM          14/06/2014      Add
 /// </modified>
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     // Convert id
     short intId;
     if (!short.TryParse(Request["id"], out intId))
     {
         RunJavascript("alert('Id không hợp lệ!');window.location='/Admin/City/Default.aspx';");
         return;
     }
     BUS.CITY objBUS = new BUS.CITY();
     // Get object update
     _city = objBUS.GetById(intId);
     if (_city == null)
     {
         ShowMessage("Không tìm thấy thành phố này để cập nhật thông tin!");
         return;
     }
     // Validate
     _validate = new Common.Validate();
     GetInput();
     if (_validate.IsError)
     {
         ShowMessage(_validate.Message);
         return;
     }
     // Check exist
     if (objBUS.CheckExist(_city.ID, _city.CITY_NAME.ToLower()) > 0)
     {
         ShowMessage("Tên thành phố đã tồn tại!");
         return;
     }
     // Update
     if (objBUS.Update(_city) > 0)
         RunJavascript("alert('Cập nhật thành công!');window.location='/Admin/City/Default.aspx';");
     else
         ShowMessage("Cập nhật thất bại!");
 }