Exemplo n.º 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BrokenDatasource broken = new BrokenDatasource();
     if (broken.Insert(txtBrokenCode.Text.Trim(), txtBrokenName.Text.Trim(), UserHelper.Username)) Back();
     else
     {
         lblError.Text = Message.AddBroken_BrokenCodeExist;
         lblError.Visible = true;
     }
 }
Exemplo n.º 2
0
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     e.NewValues["Editby"] = (UserHelper.Fullname == "") ? strUnKnown : UserHelper.Fullname;
     // check for new broken code already exist
     if (e.OldValues["Brokencode"].ToString().ToLower() == e.NewValues["Brokencode"].ToString().ToLower()) return;
     BrokenDatasource ds = new BrokenDatasource();
     string bcode = e.NewValues["Brokencode"].ToString().Trim();
     IList<Broken> lst = ds.Select(10, 0, bcode, bcode);
     if (lst.Count > 0)
     {
         e.Cancel = true;
         wrongUpdateBrokenCode = true;
         AddError(BrokenErrorCode.BrokenCodeExist);
     }
 }