protected void AddCheckOutGuard(object sender, EventArgs e) { AddNewCheckOutRequest objAddCheckOutRequest = new AddNewCheckOutRequest(); checkout objchickout = new checkout(); objchickout.checkin_id = "12345"; objchickout.checkout_id = "345"; objchickout.user_id = txtID1.Text; objchickout.user_name = txtName1.Text; objchickout.telephone = txtTeleNo1.Text; objchickout.user_address = txtAddress1.Text; objchickout.company_from = txtCompanyFrom1.Text; objchickout.vehicle_no = txtVehicle1.Text; objchickout.key_no = txtKeyNo1.Text; objchickout.user_image = "hdgsd"; objchickout.remarks = txtRemarks1.Text; objchickout.pass_no = txtPassNo1.Text; AdminBLL ws = new AdminBLL(); ws.AddCheckOutGaurd(objchickout); HttpContext.Current.Items.Add("COMPLETE", "INSERT"); Server.Transfer("..//SMSADMIN//AddNewUserComplete.aspx"); }
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)) { DataTable dt = dal.getdata("Select Staff_ID from UserInformation where NRICno='" + txtID1.Text.Trim() + "' and Role = '" + txtrole.Text.Trim() + "' and Staff_ID='" + Session["StaffID1"].ToString() + "'"); 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 { //lblerror.Visible = true; //lblerror.Text = "No Operation Manager with this NRIC/FIN No. checked In ..!"; //lblerr1.Visible = true; SM.ShowErrorMessage("You Have Already Checkout.."); return; //throw new Exception(); } } else { //lblerror.Visible = true; //lblerror.Text = "No Operation Manager with this NRIC/FIN No. exists in database !"; //lblerr1.Visible = true; //throw new Exception(); SM.ShowErrorMessage("No Operation Manager 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 = "Invalid NRIC/FIN No. ..!"; //lblerr1.Visible = true; SM.ShowErrorMessage("Invalid NRIC/FIN No. ..!"); } } catch (Exception ex) { logger.Info(ex.Message); } }