public void Add_NewKey(AdminAddNewKey objAddNewKey) { try { AdminDAL objAdminDAL = new AdminDAL(); objAdminDAL.Add_NewKey(objAddNewKey); } catch (Exception cmsEx) { throw cmsEx; } }
public void UpdateKeyData(AdminAddNewKey objKeyData) { try { AdminDAL objAdminDAL = new AdminDAL(); objAdminDAL.UpdateKeyData(objKeyData); } catch (Exception ex) { throw ex; } }
protected void btnSave_Click(object sender, EventArgs e) { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { AdminAddNewKey objKey_Data = new AdminAddNewKey(); AdminBLL ws = new AdminBLL(); objKey_Data.key_no = txtKeyNo.Text; objKey_Data.Description = txtKeyDesc.Text; objKey_Data.name = txtKeyName.Text; objKey_Data.position = txtKeyPosition.Text; objKey_Data.count = txtKeyConnt.Text; objKey_Data.nricno = txtKeyNRIC.Text; ws.UpdateKeyData(objKey_Data); HttpContext.Current.Items.Add(ContextKeys.CTX_COMPLETE, "UPDATE"); Server.Transfer("AlertUpdateComplete.aspx"); } catch (Exception ex) { logger.Info(ex.Message); } }
protected void btnSearchKeyAdd_Click(object sender, EventArgs e) { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { String ZipRegex = "^[0-9]+$"; AddNewKeyRequest objAddNewKeyRequest = new AddNewKeyRequest(); AdminAddNewKey objaddkey = new AdminAddNewKey(); getLocationIDByName(ddllocation.SelectedValue.ToString()); String q = txtbunchNo.Text; DataSet ds = dal.getdataset("select BunchNo from addnewkey where Location_ID='" + SearchLocID.Text + "' and BunchNo='" + txtbunchNo.Text + "'"); int count = ds.Tables[0].Rows.Count; if (count > 0) { for (i = 0; i < count; i++) { String z = ds.Tables[0].Rows[i].ItemArray[0].ToString(); if (string.Equals(q, z, StringComparison.CurrentCultureIgnoreCase)) { lblerror.Visible = true; lblerror.Text = "Bunch No. already exist ..!"; lblerr1.Visible = true; throw new Exception(); } } } else { String q1 = txtStaffiD.Text; DataSet ds1 = dal.getdataset("select NRICno from UserInformation"); for (i = 0; i < ds1.Tables[0].Rows.Count; i++) { String z = ds1.Tables[0].Rows[i].ItemArray[0].ToString(); if (string.Equals(q1, z, StringComparison.CurrentCultureIgnoreCase)) { getLocationIDByName(ddllocation.Text.Trim()); objaddkey.BunchNo = txtbunchNo.Text; objaddkey.Description = txtKeyDesc.Text; objaddkey.status = txtKeyStatus.Text; objaddkey.name = txtKeyName.Text; objaddkey.position = txtKeyPosition.Text; objaddkey.NoOfKey = txtKeyNo.Text; objaddkey.Staff_ID = txtStaffiD.Text; // objaddkey.Location_ID = Convert.ToInt32(SearchLocID.Text); objaddkey.Location_ID = SearchLocID.Text; objaddkey.Date_From = Convert.ToDateTime(DateTime.Now); AdminBLL ws = new AdminBLL(); ws.Add_NewKey(objaddkey); lblerror.Visible = true; lblerror.Text = "Insert Succesfully ..!"; HttpContext.Current.Items.Add("COMPLETE", "INSERT"); Server.Transfer("AlertUpdateComplete.aspx"); } } lblerror.Visible = true; lblerror.Text = "Invalid NRICno ID ....!"; lblerr2.Visible = true; } } catch (Exception ex) { logger.Info(ex.Message); } }