Esempio n. 1
0
        protected void AddCheckInContractor(object sender, EventArgs e)
        {
            AddNewCheckInRequest objAddCheckinRequest = new AddNewCheckInRequest();
            checkin objchickin = new checkin();

            objchickin.checkin_id   = "4545";
            objchickin.UserID       = txtNricID3.Text;
            objchickin.user_name    = txtName3.Text;
            objchickin.telephone    = txtTeleNo3.Text;
            objchickin.user_address = txtAddress3.Text;
            objchickin.company_from = txtCompanyfrom3.Text;
            objchickin.Vehicle_No   = txtVehicleNo3.Text;
            objchickin.key_no       = Convert.ToInt32(txtKeyNo3.Text);
            objchickin.user_image   = "hdgfhsd";
            objchickin.remarks      = txtRemarks3.Text;
            objchickin.Pass_No      = "36757";
            objchickin.pass_type    = txtPassType3.Text;
            objchickin.to_visit     = txtServingAt1.Text;

            AdminBLL ws = new AdminBLL();

            ws.AddCheckinContractor(objchickin);
            HttpContext.Current.Items.Add("COMPLETE", "INSERT");
            Server.Transfer("..//SMSADMIN//AddNewUserComplete.aspx");
        }
Esempio n. 2
0
        protected void AddCheckInContractor(object sender, EventArgs e)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                SpaMaster            SM = (SpaMaster)Page.Master;
                AddNewCheckInRequest objAddCheckinRequest = new AddNewCheckInRequest();
                checkin objchickin = new checkin();
                String  ZipRegex   = "^[a-z A-Z 0-9]+$";
                if (txtNricID3.Text.Trim() != "")
                {
                    SqlParameter[] para = new SqlParameter[1];
                    para[0]       = new SqlParameter("@NRICno", SqlDbType.VarChar, 100);
                    para[0].Value = txtNricID3.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, 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
                {
                    objchickin.NRICno = "";
                    // lblerr2.Visible = true;
                    // lblerror.Visible = true;
                    //  lblerror.Text = "Please Fill NRIC no.!!";
                    SM.ShowErrorMessage("Please Fill NRIC no.!!");
                    return;
                }
                if (Session["CaptureImagePath"] != null)
                {
                    objchickin.ImagePath = Session["CaptureImagePath"].ToString();
                }
                else if (Session["CaptureImage"] != null)
                {
                    objchickin.ImagePath = Session["CaptureImage"].ToString();
                    //Session["CaptureImage"] = null;
                }

                if (Session["LCID"] != null)
                {
                    objchickin.LocationID = int.Parse(Session["LCID"].ToString());
                    // Session["LCID"] = null;
                }

                if (txtKeyNo3.Text.Trim() != "")
                {
                    objchickin.Key_no = txtKeyNo3.Text;
                    UpdateKeyStatus();
                }
                else
                {
                    objchickin.Key_no = "";
                }
                if (txtPassNo3.Text.Trim() != "")
                {
                    objchickin.Pass_No = txtPassNo3.Text.Trim();
                    UpdatePassStatus();
                }

                if (txtTeleNo3.Text.Trim() != "")
                {
                    objchickin.telephone = txtTeleNo3.Text.Trim();
                    //UpdatePassStatus();
                }
                else
                {
                    objchickin.telephone = "";
                }
                if (txtName3.Text.Trim() != "")
                {
                    objchickin.user_name = txtName3.Text.Trim();
                    //UpdatePassStatus();
                }

                if (txtServingAt1.Text.Trim() != "")
                {
                    objchickin.to_visit = txtServingAt1.Text.Trim();
                    //UpdatePassStatus();
                }
                else
                {
                    objchickin.to_visit = "";
                }
                if (txtNricID3.Text.Trim() != "")
                {
                    //objchickin.Pass_No = txtPassNo3.Text;//PassOccupied();
                    objchickin.to_visit   = txtServingAt1.Text; // tovisit();
                    objchickin.Vehicle_No = txtVehicleNo3.Text; //addVehicle();
                    objchickin.telephone  = txtTeleNo3.Text;    //AddTelephone();

                    objchickin.NRICno       = txtNricID3.Text;
                    objchickin.user_name    = txtName3.Text;
                    objchickin.user_address = txtAddress3.Text;
                    objchickin.company_from = txtCompanyfrom3.Text;
                    objchickin.remarks      = txtRemarks3.Text;
                    objchickin.pass_type    = cmbContractorPass.Text;
                    objchickin.purpose      = txtpurpose.Text;
                    objchickin.Item_Declear = txtItemDeclear3.Text;

                    /*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;
                    objchickin.Role             = txtrole.Text;

                    AdminBLL ws = new AdminBLL();
                    // ws.AddCheckinVisitor(objchickin);
                    ws.AddCheckinContractor(objchickin);

                    HttpContext.Current.Items.Add("COMPLETE", "INSERT");
                    SM.ShowErrorMessage("Contractor Check In successfully");
                    return;
                    // Server.Transfer("..//SMSADMIN//AlertUpdateComplete.aspx");
                }
                else
                {
                    // lblerr3.Visible = true;
                    //lblerror.Visible = true;
                    //lblname.Visible = true;
                    //lblerror.Text = "Please Fill All the (*) fields!!";
                    SM.ShowErrorMessage("Please Fill All the (*) fields!!");
                    return;
                }
            }


            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }