Ejemplo n.º 1
0
        //protected void AddCheckInGuard(object sender, EventArgs e)
        //{
        //    AddNewCheckInRequest objAddCheckinRequest = new AddNewCheckInRequest();
        //    checkin objchickin = new checkin();

        //    objchickin.checkin_id = "1645";
        //    objchickin.UserID = txtID1.Text;
        //    objchickin.user_name = txtName1.Text;
        //    objchickin.telephone = txtTeleNo1.Text;
        //    objchickin.user_address = txtAddress1.Text;
        //    objchickin.company_from = txtCompanyFrom1.Text;
        //    objchickin.Vehicle_No = txtVehicleNo1.Text;
        //    objchickin.key_no =Convert.ToInt32(txtKeyNo1.Text);
        //    objchickin.user_image = "hdgfhsd";
        //    objchickin.remarks = txtRemarks1.Text;
        //    objchickin.Pass_No = "36757";
        //    objchickin.pass_type = txtPassNo1.Text;

        //    AdminBLL ws = new AdminBLL();
        //    ws.AddCheckinGaurd(objchickin);
        //    HttpContext.Current.Items.Add("COMPLETE", "INSERT");
        //    Server.Transfer("..//SMSADMIN//AddNewUserComplete.aspx");

        //}
        protected void AddCheckInVisitor(object sender, EventArgs e)
        {
            AddNewCheckInRequest objAddCheckinRequest = new AddNewCheckInRequest();
            checkin objchickin = new checkin();

            objchickin.checkin_id   = "23462";
            objchickin.UserID       = txtNricID2.Text;
            objchickin.user_name    = txtName2.Text;
            objchickin.telephone    = txtTeleNo2.Text;
            objchickin.user_address = txtAddress2.Text;
            objchickin.company_from = txtCompanyFrom2.Text;
            objchickin.Vehicle_No   = txtVehicleNo2.Text;
            objchickin.key_no       = Convert.ToInt32(txtKeyNo2.Text);
            objchickin.user_image   = "hdgfhsd";
            objchickin.remarks      = txtRemarks2.Text;
            objchickin.Pass_No      = "36757";
            objchickin.pass_type    = txtPassNo2.Text;
            //objchickin.to_visit = txtToVisit1.Text;
            objchickin.purpose = txtVisitorPurpose2.Text;


            AdminBLL ws = new AdminBLL();

            ws.AddCheckinVisitor(objchickin);
            HttpContext.Current.Items.Add("COMPLETE", "INSERT");
            Server.Transfer("..//SMSADMIN//AddNewUserComplete.aspx");
        }
Ejemplo n.º 2
0
        protected void AddCheckInVisitor(object sender, EventArgs e)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                SpaMaster            MyMasterPage         = (SpaMaster)Page.Master;
                AddNewCheckInRequest objAddCheckinRequest = new AddNewCheckInRequest();
                checkin objchickin = new checkin();


                SqlParameter[] para = new SqlParameter[1];
                para[0]       = new SqlParameter("@NRICno", SqlDbType.VarChar, 100);
                para[0].Value = txtNricID2.Text.Trim();
                DataTable dt1 = dal.executeprocedure("SP_getCheckinIDbyNRICNo", 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, 50);
                    para2[0].Value = CHECKIN_ID;
                    DataTable dt3 = dal.executeprocedure("SP_GetCheckoutIDbyCheckInID", para2, false);
                    if (dt3.Rows.Count == 0)
                    {
                        MyMasterPage.ShowErrorMessage("NRIC/FIN No. Already Checked In ..!");
                        //lblerror.Visible = true;
                        //lblerror.Text = "NRIC/FIN No. Already Checked In ..!";
                        //lblerr1.Visible = true;
                        return;
                    }
                }



                if (Session["CaptureImagePath"] != null)
                {
                    objchickin.ImagePath = Session["CaptureImagePath"].ToString();
                }
                else if (Session["CaptureImage"] != null)
                {
                    objchickin.ImagePath = Session["CaptureImage"].ToString();
                    //Session["CaptureImage"] = null;
                    // return;
                }

                if (txtKeyNo2.SelectedValue.Trim() != "")
                {
                    objchickin.Key_no = txtKeyNo2.Text;
                    UpdateKeyStatus();
                }

                if (txtTeleNo2.Text.Trim() != "")
                {
                    objchickin.telephone = txtTeleNo2.Text.Trim();
                    //UpdatePassStatus();
                }

                if (txtToVisit2.Text.Trim() != "")
                {
                    objchickin.to_visit = txtToVisit2.Text.Trim();
                    ////UpdatePassStatus();
                }

                if (txtPassNo2.SelectedValue.Trim() != "")
                {
                    objchickin.Pass_No = txtPassNo2.Text.Trim();
                    UpdatePassStatus();
                }


                if (txtNricID2.Text.Trim() != "")
                {
                    objchickin.NRICno = txtNricID2.Text.Trim();
                    // UpdatePassStatus();
                }
                else
                {
                    objchickin.NRICno = "";
                    MyMasterPage.ShowErrorMessage("please Fill NRICno. first !!");
                    return;
                    //lblerr1.Visible = true;
                    //lblerror.Visible = true;
                    //lblerror.Text = "please Fill NRICno. first !!";
                }

                if (txtNricID2.Text.Trim() != "")
                {
                    objchickin.to_visit     = txtToVisit2.Text.Trim();
                    objchickin.Vehicle_No   = txtVehicleNo2.Text.Trim();
                    objchickin.telephone    = txtTeleNo2.Text.Trim();
                    objchickin.NRICno       = txtNricID2.Text.Trim();
                    objchickin.user_name    = txtName2.Text.Trim();
                    objchickin.user_address = txtAddress2.Text.Trim();
                    objchickin.company_from = txtCompanyFrom2.Text.Trim();
                    objchickin.remarks      = txtRemarks2.Text.Trim();
                    objchickin.pass_type    = cmbvisitorPass.Text.Trim();
                    objchickin.purpose      = txtVisitorPurpose2.Text.Trim();
                    objchickin.Item_Declear = txtItemDeclear2.Text.Trim();

                    objchickin.Checkin_DateTime = DateTime.Now;
                    //objchickin.Checkin_DateTime = DateTime.Now;
                    objchickin.Role = txtrole.Text;

                    if (Location != null)
                    {
                        objchickin.LocationID = int.Parse(Location);
                    }
                    else
                    {
                        MyMasterPage.ShowErrorMessage("Please select Location first!!!");
                        return;
                        //lblerror.Visible = true;
                        //lblerror.Text = "Please select Location first!!!";
                    }

                    AdminBLL ws = new AdminBLL();
                    ws.AddCheckinVisitor(objchickin);
                    checktime1();
                    UpdatePre_visitors(txtName2.Text, Convert.ToDateTime(DateTime.Now.ToShortDateString()), DateTime.Now.ToShortTimeString().ToString());
                    HttpContext.Current.Items.Add("COMPLETE", "INSERT");
                    MyMasterPage.ShowErrorMessage("Check In Successfully");
                }
                else
                {
                    MyMasterPage.ShowErrorMessage("Please Fill all the fields!!!");
                    //lblerror.Visible = true;
                    //lblerror.Text = "Please Fill all the fields!!!";
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }