Example #1
0
        protected void AddCheckOutVisitor(object sender, EventArgs e)
        {
            AddNewCheckOutRequest objAddCheckOutRequest = new AddNewCheckOutRequest();
            checkout objchickout = new checkout();

            objchickout.checkin_id   = "12345";
            objchickout.checkout_id  = "345";
            objchickout.user_id      = txtNricID2.Text;
            objchickout.user_name    = txtName2.Text;
            objchickout.telephone    = txtTeleNo2.Text;
            objchickout.user_address = txtAddress2.Text;
            objchickout.company_from = txtCompanyFrom2.Text;
            objchickout.vehicle_no   = txtVehicleNo2.Text;
            objchickout.key_no       = txtKeyNo2.Text;
            objchickout.user_image   = "hdgsd";
            objchickout.remarks      = txtRemarks2.Text;
            objchickout.pass_no      = txtPassNo2.Text;
            objchickout.to_visit     = txtToVisit2.Text;
            objchickout.purpose      = txtVisitorPurpose2.Text;



            AdminBLL ws = new AdminBLL();

            ws.AddCheckOutVisiter(objchickout);
            HttpContext.Current.Items.Add("COMPLETE", "INSERT");
            Server.Transfer("..//SMSADMIN//AddNewUserComplete.aspx");
        }
Example #2
0
        protected void AddCheckOutVisitor(object sender, EventArgs e)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                SpaMaster MyMasterPage = (SpaMaster)Page.Master;
                Boolean   ok           = false;
                String    ZipRegex     = "^[a-z A-Z 0-9]+$";

                if (Regex.IsMatch(txtNricID2.Text, ZipRegex) && (txtNricID2.Text.Trim() != ""))
                {
                    SqlParameter[] para = new SqlParameter[2];
                    para[0]       = new SqlParameter("@NRICno", SqlDbType.VarChar, 100);
                    para[0].Value = txtNricID2.Text.Trim();
                    para[1]       = new SqlParameter("@Role", SqlDbType.VarChar, 100);
                    para[1].Value = txtrole.Text.Trim();
                    DataTable dt1 = dal.executeprocedure("SP_GetCheckInDetailByNRICrole", para, false);
                    if (dt1.Rows.Count > 0)
                    {
                        objchickout.NRICno       = dt1.Rows[0]["NRICno"].ToString();
                        objchickout.user_name    = dt1.Rows[0]["user_name"].ToString();
                        objchickout.user_address = dt1.Rows[0]["user_address"].ToString();

                        objchickout.company_from = dt1.Rows[0]["company_from"].ToString();
                        objchickout.telephone    = dt1.Rows[0]["telephone"].ToString();
                        objchickout.remarks      = dt1.Rows[0]["remarks"].ToString();
                        objchickout.vehicle_no   = dt1.Rows[0]["Vehicle_No"].ToString();

                        objchickout.key_no       = dt1.Rows[0]["Key_no"].ToString();
                        objchickout.pass_no      = dt1.Rows[0]["Pass_No"].ToString();
                        objchickout.PassType     = dt1.Rows[0]["pass_type"].ToString();
                        objchickout.to_visit     = dt1.Rows[0]["to_visit"].ToString();
                        objchickout.purpose      = dt1.Rows[0]["purpose"].ToString();
                        objchickout.Item_Declear = dt1.Rows[0]["Item_Declear"].ToString();

                        objchickout.Checkin_DateTime = Convert.ToDateTime(dt1.Rows[0]["Checkin_DateTime"].ToString());
                        objchickout.user_image       = dt1.Rows[0]["ImagePath"].ToString();
                        objchickout.Role             = dt1.Rows[0]["Role"].ToString();
                        objchickout.checkin_id       = dt1.Rows[0]["checkin_id"].ToString();
                        //objchickout.Location_id = Session["LCID"].ToString();

                        /*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;
                        ok = true;
                        if (ok == true)
                        {
                            removedata();
                            UpdateKeyStatus();
                            UpdatePassStatus();
                        }
                        AdminBLL ws = new AdminBLL();
                        ws.AddCheckOutVisiter(objchickout);
                        MyMasterPage.ShowErrorMessage("Check Out Successfully");
                        //HttpContext.Current.Items.Add("COMPLETE", "INSERT");
                        //Server.Transfer("..//SMSADMIN//AlertUpdateComplete.aspx");
                    }
                    else
                    {
                        MyMasterPage.ShowErrorMessage("NRIC/FIN No. Already Checked Out ..!");
                    }
                }
                else
                {
                    MyMasterPage.ShowErrorMessage("Invalid NRIC/FIN No. ..!");
                    //lblerror.Visible = true;
                    //lblerror.Text = "Invalid NRIC/FIN No. ..!";
                    //lblerr1.Visible = true;
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
            //txtPassNo2.Text = "hello";
        }