// GET: Admin public ActionResult AdminListe() { var AdminDb = new AdminBLL(); List<Admin> hentAdmins = AdminDb.HentAlleAdmins(); if (Session["Innlogget"] == null) { Session["Innlogget"] = false; ViewBag.Innlogget = false; } else { ViewBag.Innlogget = (bool)Session["Innlogget"]; bool ok = (bool)Session["Innlogget"]; if (ok) return View(hentAdmins); } return RedirectToAction("Home"); }
public ActionResult EndreAdmin(int id) { var AdminDb = new AdminBLL(); Admin enAdmin = AdminDb.hentEnAdmin(id); if (Session["Innlogget"] == null) { Session["Innlogget"] = false; ViewBag.Innlogget = false; } else { ViewBag.Innlogget = (bool)Session["Innlogget"]; bool ok = (bool)Session["Innlogget"]; if (ok) return View(enAdmin); } return RedirectToAction("Home"); }
public ActionResult EndreAdmin(int id, Admin endreAdmin) { if (ModelState.IsValid) { var Admin = new AdminBLL(); bool endringOk = Admin.endreAdmin(id, endreAdmin); if (endringOk) { return RedirectToAction("AdminListe"); } } return View(); }
public ActionResult LoggInn(Admin innBruker) { var db = new AdminBLL(); if (db.adminsjekk(innBruker)) { Session["Innlogget"] = true; ViewBag.Innlogget = true; return RedirectToAction("AdminPage"); } else { Session["Innlogget"] = false; ViewBag.Innlogget = false; return View(); } }
public ActionResult SlettAdmin(int id, Admin slettId) { if (ModelState.IsValid) { var Admin = new AdminBLL(); bool slettOk = Admin.slettAdmin(id); if (slettOk) { return RedirectToAction("AdminListe"); } } return View(); }
protected void btncheckin_Click(object sender, EventArgs e) { SpaMaster SM = (SpaMaster)Page.Master; log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { if (Session["user_role"].ToString() == "Supervisor" || Session["user_role"].ToString() == "Security Officer" || Session["user_role"].ToString() == "Operations Manager") { AddNewCheckInRequest objAddCheckinRequest = new AddNewCheckInRequest(); checkin objchickin = new checkin(); string NRICNO = txtNricID3.Text.Trim(); //string ROLE = txtrole.Text.Trim(); string STAFFID = string.Empty; if (Session["user_role"].ToString() == "Operations Manager") { txtrole.Text = "Security Officer"; } SqlParameter[] para1 = new SqlParameter[2]; para1[0] = new SqlParameter("@NRICNO", SqlDbType.VarChar, 100); para1[0].Value = NRICNO; para1[1] = new SqlParameter("@ROLE", SqlDbType.VarChar, 100); para1[1].Value = txtrole.Text; DataTable dt = new DataTable(); dt = dal.executeprocedure("SP_GetStaffidbyNRICRole", para1, false); objchickin.Role = txtrole.Text; if (dt.Rows.Count > 0) { STAFFID = dt.Rows[0]["Staff_ID"].ToString(); SqlParameter[] para = new SqlParameter[1]; para[0] = new SqlParameter("@UserID", SqlDbType.VarChar, 100); para[0].Value = STAFFID; DataTable dt1 = dal.executeprocedure("SP_GetCheckInIDbyUserid", para, false); if (dt1.Rows.Count > 0) { long CHECKIN_ID = Convert.ToInt64(dt1.Rows[0]["checkin_id"].ToString()); SqlParameter[] para2 = new SqlParameter[1]; para2[0] = new SqlParameter("@checkin_id", SqlDbType.BigInt, 100); para2[0].Value = CHECKIN_ID; DataTable dt3 = dal.executeprocedure("SP_GetCheckoutIDbyCheckInID", para2, false); if (dt3.Rows.Count == 0) { //lblerror.Visible = true; //lblerror.Text = "NRIC/FIN No. Already Checked In ..!"; //lblerr1.Visible = true; SM.ShowErrorMessage("NRIC/FIN No. Already Checked In ..!"); return; // throw new Exception(); } } } else { //lblerror.Visible = true; //lblerror.Text = "No security officer with this NRIC/FIN No. exists in database !"; //lblerr1.Visible = true; SM.ShowErrorMessage("No security officer with this NRIC/FIN No. exists in database !"); return; } //=========================================// DBConnectionHandler1 db = new DBConnectionHandler1(); SqlConnection cn = db.getconnection(); cn.Open(); if (cn.State == ConnectionState.Open) { } else { cn.Open(); } SqlCommand cmd = new SqlCommand("select code from location where Location_id=@location", cn); cmd.Parameters.AddWithValue("@location", int.Parse(Session["LCID"].ToString())); SqlDataReader dr = cmd.ExecuteReader(); string AssignmentCode = string.Empty; if (dr.Read()) { AssignmentCode = dr.GetString(0); } string CurrDate = DateTime.Now.ToShortDateString(); string[] Splitter = CurrDate.Split('/'); int Date = Convert.ToInt32(Splitter[1].ToString()); SqlParameter[] para3 = new SqlParameter[5]; para3[0] = new SqlParameter("@Nric", SqlDbType.VarChar, 100); para3[0].Value = NRICNO; para3[1] = new SqlParameter("@AssignmentCode", SqlDbType.VarChar, 200); para3[1].Value = AssignmentCode; para3[2] = new SqlParameter("@Day", SqlDbType.Int, 100); para3[2].Value = Date; para3[3] = new SqlParameter("@Month", SqlDbType.Int, 100); para3[3].Value = DateTime.Now.Month; para3[4] = new SqlParameter("@WorkMonth", SqlDbType.VarChar, 100); para3[4].Value = Month[DateTime.Now.Month - 1] + " " + DateTime.Now.Year; DataTable dt2 = new DataTable(); dt2 = dal.executeprocedure("SP_AddSalaryInterface", para3, false); objchickin.Role = txtrole.Text; //==========================================// objchickin.telephone = txtTeleNo3.Text; objchickin.UserID = STAFFID; //objchickin.Role =TextsecOff.Text; objchickin.user_name = txtName3.Text.Trim(); objchickin.NRICno = NRICNO; /*string time = string.Empty; * time = ConfigurationManager.AppSettings.Get("SPATime"); * double newtime = Convert.ToDouble(time); * objchickin.Checkin_DateTime = DateTime.Now.AddHours(newtime);*/ objchickin.Checkin_DateTime = DateTime.Now; if (Session["LCID"] != null && Session["LCID"].ToString() != "0") { objchickin.LocationID = int.Parse(Session["LCID"].ToString()); } else { //lblerror.Visible = true; //lblerror.Text = "You must login as either supervisor or security officer or Operation Manager..!"; //lblerr1.Visible = true; SM.ShowErrorMessage("You must login as either supervisor or security officer or Operation Manager..!"); return; //throw new Exception(); } AdminBLL ws = new AdminBLL(); ws.AddCheckinGaurd(objchickin); HttpContext.Current.Items.Add("COMPLETE", "INSERT"); SM.ShowErrorMessage("Check In Successfully..!"); return; // Server.Transfer("..//SMSADMIN//AlertUpdateComplete.aspx"); } else { //lblerror.Visible = true; //lblerror.Text = "You must login as either supervisor or security officer or Operation Manager..!"; //lblerr1.Visible = true; SM.ShowErrorMessage("You must login as either supervisor or security officer or Operation Manager..!"); } } catch (Exception ex) { logger.Info(ex.Message); } }
public ActionResult LeggTilAdmin(Admin innAdmin) { if (ModelState.IsValid) { var Admin = new AdminBLL(); bool insertOk = Admin.leggTilAdmin(innAdmin); if (insertOk) { return RedirectToAction("AdminListe"); } } if (Session["Innlogget"] == null) { Session["Innlogget"] = false; ViewBag.Innlogget = false; } else { ViewBag.Innlogget = (bool)Session["Innlogget"]; bool ok = (bool)Session["Innlogget"]; if (ok) return View(); } return RedirectToAction("Home"); }
protected void cmdbuttonadd_Click(object sender, EventArgs e) { SpaMaster MyMasterPage = (SpaMaster)Page.Master; log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { AddNewEventmanRequest objAddEventmanRequest = new AddNewEventmanRequest(); eventAdmin objeventman = new eventAdmin(); DateTime datetime; if (txtNricNo.Text.Trim() != "" && txtname.Text.Trim() != "") { // objeventman.Date_From = DateTime.TryParse(txtFromDate.Text, out datetime) ? (DateTime?)datetime : null; // objeventman.Date_to = DateTime.TryParse(txttoDate.Text, out datetime) ? (DateTime?)datetime : null; if (txtFromDate.Text.Length == 0) { objeventman.Date_From = null; } else { DateTimeFormatInfo dtfi = new DateTimeFormatInfo(); dtfi.ShortDatePattern = "MM/dd/yyyy"; dtfi.DateSeparator = "/"; DateTime objDate = Convert.ToDateTime(txtFromDate.Text, dtfi); objeventman.Date_From = objDate; } if (txttoDate.Text.Length == 0) { objeventman.Date_to = null; } else { DateTimeFormatInfo dtfi = new DateTimeFormatInfo(); dtfi.ShortDatePattern = "MM/dd/yyyy"; dtfi.DateSeparator = "/"; DateTime objDate = Convert.ToDateTime(txttoDate.Text, dtfi); objeventman.Date_to = objDate; } objeventman.Event_Type = drlEventType.Text.Trim(); objeventman.Start_time = TimeSelector1.Date.TimeOfDay.ToString(); objeventman.End_time = TimeSelector2.Date.TimeOfDay.ToString(); objeventman.Special_Requirment = txtspecialreq.Text; objeventman.Guard_Requirment = txtgaurdreq.Text; objeventman.Special_Duty = txtdutygaurd.Text; objeventman.Incharg_Name = txtname.Text.Trim(); objeventman.Incharg_NricNo = txtNricNo.Text.Trim(); objeventman.Incharg_position = txtPosition.Text; objeventman.Incharg_ContactNo = txtContact.Text; objeventman.Superior_Name = txtSupireorName.Text; string location_id = getLocationIDByName1(drlLocationAdd.SelectedItem.Text.ToString()); objeventman.Location_id = location_id; AdminBLL ws = new AdminBLL(); ws.AddEvent(objeventman); BindGridWithFilter(); // this.ModalPopupAdd.Hide(); ClearAdd(); //dal.executesql("Update PreRegisteredVisits set FromDate='" + txtFromDate.Text.Trim() + "',ToDate='" + txtToDate.Text.Trim() + "',ExpectedTime='" + newtime + "',Name='" + txtName.Text.Trim() + "',Company='" + txtCompany.Text.Trim() + "',Position='" + txtPosition.Text.Trim() + "',Invited_By='" + txtInvitedBy.Text.Trim() + "',LocationID='" + Searchid.Text + "',VechicleNo='" + txtVechicle.Text + "',Purpose='" + txtpurpose.Text + "',Telephoe='"+txttelephone.Text+"' where PRVID ='" + hdnCSID.Value + "' "); // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "AlertMessage", " alert('Record Insert SuccessFully');", true); MyMasterPage.ShowErrorMessage("Record Inserted SuccessFully..!"); // HttpContext.Current.Items.Add("COMPLETE", "INSERT"); //Server.Transfer("..//SMSADMIN//AlertUpdateComplete.aspx"); } else { SM.ShowErrorMessage("Please Fill NRICno. & Name.....!"); // lblerror.Visible = true; // lblerror.Text = "Please Fill NRICno. & Name.....!"; } } catch (Exception ex) { logger.Info(ex.Message); } }
protected void btnUpdate_Click(object sender, EventArgs e) { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { if (ViewState["Event_ID"] != null) { eventAdmin objevent = new eventAdmin(); AdminBLL ws = new AdminBLL(); DateTime datetime; objevent.Event_ID = txtEventID.Text; // objevent.Date_From = DateTime.TryParse(txtFromDateUpdate.Text, out datetime) ? (DateTime?)datetime : null; ; // objevent.Date_to = DateTime.TryParse(ToDateUpdate.Text, out datetime) ? (DateTime?)datetime : null; ; if (txtFromDateUpdate.Text.Length == 0) { objevent.Date_From = null; } else { DateTimeFormatInfo dtfi = new DateTimeFormatInfo(); dtfi.ShortDatePattern = "MM/dd/yyyy"; dtfi.DateSeparator = "/"; DateTime objDate = Convert.ToDateTime(txtFromDateUpdate.Text, dtfi); objevent.Date_From = objDate; } if (ToDateUpdate.Text.Length == 0) { objevent.Date_to = null; } else { DateTimeFormatInfo dtfi = new DateTimeFormatInfo(); dtfi.ShortDatePattern = "MM/dd/yyyy"; dtfi.DateSeparator = "/"; DateTime objDate = Convert.ToDateTime(ToDateUpdate.Text, dtfi); objevent.Date_to = objDate; } objevent.Location_id = Convert.ToString(GetLocationIDbyName(drlLocationUpdate.Text)); objevent.Event_Type = ddlEventTypeUpdate.Text; string time = TimeSelector3.Date.TimeOfDay.ToString(); objevent.Start_time = time; string time1 = TimeSelector4.Date.TimeOfDay.ToString(); objevent.End_time = time1; objevent.Special_Requirment = txtspecialreqUpdate.Text; objevent.Guard_Requirment = txtgaurdreqUpdate.Text; objevent.Special_Duty = txtdutygaurdUpdate.Text; objevent.Incharg_Name = txtNameUpdate.Text; objevent.Incharg_NricNo = txtNricNoUpdate.Text; objevent.Incharg_position = txtPositionUpdate.Text; objevent.Incharg_ContactNo = txtContactUpdate.Text; objevent.Superior_Name = txtSupireorNameUpdate.Text; ws.Updatevent(objevent); // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "AlertMessage", " alert('Record Update SuccessFully');", true); SpaMaster MyMasterPage = (SpaMaster)Page.Master; MyMasterPage.ShowErrorMessage("Record Updated SuccessFully..!"); this.ModalPopupUpdate.Hide(); ClearUpdate(); BindGridWithFilter(); //dal.executesql("Update PreRegisteredVisits set FromDate='" + txtFromDate.Text.Trim() + "',ToDate='" + txtToDate.Text.Trim() + "',ExpectedTime='" + newtime + "',Name='" + txtName.Text.Trim() + "',Company='" + txtCompany.Text.Trim() + "',Position='" + txtPosition.Text.Trim() + "',Invited_By='" + txtInvitedBy.Text.Trim() + "',LocationID='" + Searchid.Text + "',VechicleNo='" + txtVechicle.Text + "',Purpose='" + txtpurpose.Text + "',Telephoe='"+txttelephone.Text+"' where PRVID ='" + hdnCSID.Value + "' "); // HttpContext.Current.Items.Add(ContextKeys.CTX_COMPLETE, "UPDATE"); // Server.Transfer("AlertUpdateComplete.aspx"); } } catch (Exception ex) { logger.Info(ex.Message); } }
public frmAdminRegister() { InitializeComponent(); _adminBLL = new AdminBLL(); }
protected void Add_ShiftUpdate(object sender, EventArgs e) { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { Shift objShift_Data = new Shift(); AdminBLL ws = new AdminBLL(); AdminDAL aa = new AdminDAL(); SqlConnection conn = new SqlConnection(); conn = aa.getconnection(); DateTime datetime; objShift_Data.Shift_ID = txtaddshiftID.Text; objShift_Data.shiftdep = txtaddshiftName.Text; objShift_Data.ShiftDateFrom = DateTime.TryParse(txtaddDateFrom.Text, out datetime) ? (DateTime?)datetime : null;; objShift_Data.ShiftDateTo = DateTime.TryParse(txtaddDateTo.Text, out datetime) ? (DateTime?)datetime : null;; objShift_Data.ShiftTimeFrom = TimeSelector1.Date.TimeOfDay.ToString(); objShift_Data.ShiftTimeTo = TimeSelector2.Date.TimeOfDay.ToString(); objShift_Data.Location = txtaddLocationName.Text; AddNewStaffShiftRequest objstaffshift = new AddNewStaffShiftRequest(); Staff_Shift objStaff = new Staff_Shift(); User_Info objuser = new User_Info(); foreach (TextBox tb in dynamicTextBoxes) { string ss = Convert.ToString(objuser.Staff_ID); SqlCommand cmd = new SqlCommand("select Staff_ID from userinformation", conn); SqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { ss = rd.GetValue(0).ToString(); if (ss == tb.Text) { objStaff.Shift_ID = objShift_Data.Shift_ID; objStaff.Staff_ID = tb.Text; ws.AddStaffShift(objStaff); } } rd.Close(); //================// rd.Dispose(); //====================// } ws.UpdateShiftData(objShift_Data); HttpContext.Current.Items.Add(ContextKeys.CTX_COMPLETE, "UPDATE"); Server.Transfer("AlertUpdateComplete.aspx"); } catch (System.Threading.ThreadAbortException) { } catch (Exception ex) { logger.Info(ex.Message); } }
protected void AddCheckInVisitor(object sender, EventArgs e) { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { Visitor objvisitor = new Visitor(); AdminBLL ws = new AdminBLL(); DateTime datetime; objvisitor.checkout_id = out_no.Text; objvisitor.user_id = txtNricID2.Text; objvisitor.purpose = txtVisitorPurpose2.Text; objvisitor.user_name = txtName2.Text; objvisitor.user_address = txtAddress2.Text; objvisitor.company_from = txtCompanyFrom2.Text; objvisitor.telephone = txtTeleNo2.Text; objvisitor.remarks = txtRemarks2.Text; objvisitor.vehicle_no = txtVehicleNo2.Text; objvisitor.key_no = txtKeyNo2.Text; objvisitor.pass_no = txtPassNo2.Text; objvisitor.PassType = cmbvisitorPass.Text; objvisitor.to_visit = txtToVisit2.Text; // objvisitor.Role = txtrole.Text; objvisitor.checkin_time = DateTime.TryParse(calDateOfIncident.Text, out datetime) ? (DateTime?)datetime : null;;;; objvisitor.checkout_time = DateTime.TryParse(calDateOfIncident1.Text, out datetime) ? (DateTime?)datetime : null;;;; Boolean ok = false; if (FileUpload1.FileName != null) { if (FileUpload1.HasFile) { string ext = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower(); string[] ar = { ".jpg", ".gif", ".jpeg", ".png" }; for (int i = 0; i < ar.Length; i++) { if (ext == ar[i]) { ok = true; break; } } } if (ok) { try { string path = Server.MapPath("~/ImageUpload/"); FileUpload1.PostedFile.SaveAs(path + FileUpload1.FileName); HttpContext.Current.Session["ImagePath"] = Convert.ToString(path + FileUpload1.FileName); } catch (Exception ex) { logger.Info(ex.Message); } } objvisitor.user_image = HttpContext.Current.Session["ImagePath"].ToString(); ws.Updatvisotor(objvisitor); HttpContext.Current.Items.Add(ContextKeys.CTX_COMPLETE, "UPDATE"); Server.Transfer("AlertUpdateComplete.aspx"); } } catch (Exception ex) { logger.Info(ex.Message); } }
public OrdersController() { db = new AdminBLL(); ent = new MilkCRMv0_12Entities(); }
protected void AddCheckOutGuard(object sender, EventArgs e) { SpaMaster SM = (SpaMaster)Page.Master; log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { Boolean ok = false; checkout objchickout = new checkout(); String ZipRegex = "^[a-z A-Z 0-9]+$"; if (Regex.IsMatch(txtID1.Text, ZipRegex)) { if (Session["user_role"].ToString() == "Supervisor" || Session["user_role"].ToString() == "Security Officer" || Session["user_role"].ToString() == "Operations Manager") { if (Session["user_role"].ToString() == "Operations Manager") { txtrole.Text = "Security Officer"; } DataTable dt = dal.getdata("Select Staff_ID from UserInformation where NRICno='" + txtID1.Text.Trim() + "' and Role = '" + txtrole.Text.Trim() + "'"); DataSet rd = new DataSet(); if (dt.Rows.Count > 0) { rd = dal.getdataset("select * from checkin_manager where UserID='" + dt.Rows[0][0].ToString() + "' and Role='" + txtrole.Text + "' order by Checkin_DateTime desc "); if (rd.Tables[0].Rows.Count > 0) { objchickout.user_id = rd.Tables[0].Rows[0]["UserID"].ToString(); objchickout.user_name = rd.Tables[0].Rows[0]["user_name"].ToString(); objchickout.telephone = rd.Tables[0].Rows[0]["telephone"].ToString(); objchickout.key_no = rd.Tables[0].Rows[0]["Key_no"].ToString(); objchickout.pass_no = rd.Tables[0].Rows[0]["Pass_No"].ToString(); objchickout.Role = rd.Tables[0].Rows[0]["Role"].ToString(); objchickout.Checkin_DateTime = Convert.ToDateTime(rd.Tables[0].Rows[0]["Checkin_DateTime"].ToString()); objchickout.checkin_id = rd.Tables[0].Rows[0]["checkin_id"].ToString(); objchickout.NRICno = rd.Tables[0].Rows[0]["NRICno"].ToString(); objchickout.Location_id = rd.Tables[0].Rows[0]["LocationID"].ToString(); } else { SM.ShowErrorMessage("No security officer with this NRIC/FIN No. checked In ..!"); return; } } else { //lblerror.Visible = true; //lblerror.Text = "No Security Officer with this NRIC/FIN No. exists in database !"; //lblerr1.Visible = true; //throw new Exception(); SM.ShowErrorMessage("No Security Officer with this NRIC/FIN No. exists in database !"); return; } /*string time = string.Empty; * time = ConfigurationManager.AppSettings.Get("SPATime"); * double newtime = Convert.ToDouble(time); * objchickout.Checkout_DateTime = DateTime.Now.AddHours(newtime);*/ objchickout.Checkout_DateTime = DateTime.Now; AdminBLL ws = new AdminBLL(); ws.AddCheckOutGaurd(objchickout); ok = true; if (ok == true) { removedata(); } HttpContext.Current.Items.Add("COMPLETE", "INSERT"); SM.ShowErrorMessage("Check Out Successfully..!"); //Server.Transfer("..//SMSADMIN//AlertUpdateComplete.aspx"); } else { //lblerror.Visible = true; //lblerror.Text = "No security officer with this NRIC/FIN No. checked In ..!"; //lblerr1.Visible = true; //throw new Exception(); SM.ShowErrorMessage("No security officer with this NRIC/FIN No. checked In ..!"); } } else { //lblerror.Visible = true; //lblerror.Text = "Invalid NRIC/FIN No. ..!"; //lblerr1.Visible = true; SM.ShowErrorMessage("Invalid NRIC/FIN No. ..!"); } } catch (Exception ex) { logger.Info(ex.Message); } }
protected void Add_Location(object sender, EventArgs e) { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { AddNewLocationRequest objAddLocationRequest = new AddNewLocationRequest(); LocationData objlocation = new LocationData(); String zipreg = "^[a-z A-Z]+$"; String ZipRegex = "^[0-9]+$"; String ZipRegexboth = "^[a-z A-Z 0-9]+$"; // if (Regex.IsMatch(txtAddLocationName.Text, ZipRegexboth)) // { if (Regex.IsMatch(txtAddLocationName1.Text, zipreg)) { column = "locid"; table = "location"; where = "where locid='" + txtAddLocationName.Text + "'"; if (b.isexistBLL(column, table, where)) { lblerror.Visible = true; lblerror.Text = "Location Code Already Exist ..!"; lblerr.Visible = true; throw new Exception(); } column = "loc"; table = "location"; where = "where loc='" + txtAddLocationName1.Text + "'"; if (b.isexistBLL(column, table, where)) { lblerror.Visible = true; lblerror.Text = "Location Name Already Exist ..!"; lblerr2.Visible = true; throw new Exception(); } objlocation.locid = txtAddLocationName.Text; objlocation.loc = txtAddLocationName1.Text; objlocation.Date_From = Convert.ToDateTime(DateTime.Now); AdminBLL ws = new AdminBLL(); ws.AddLocation(objlocation); UpdateAutogenCode(); HttpContext.Current.Items.Add("COMPLETE", "INSERT"); Server.Transfer("..//SMSADMIN//AlertUpdateComplete.aspx"); } else { lblerror.Visible = true; lblerror.Text = "Invalid Location Name ..!"; lblerr2.Visible = true; } //} //else //{ // lblerror.Visible = true; // lblerror.Text = "Invalid Location Code ..!"; // lblerr.Visible = true; //} } 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(); String q = txtbunchNo.Text; DataSet ds = dal.getdataset("select BunchNo from addnewkey"); int count = ds.Tables[0].Rows.Count; 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(); } } 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.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); } }