Ejemplo n.º 1
0
        protected void btnThumbCheckIn_Click(object sender, EventArgs e)
        {
            log4net.ILog logger  = log4net.LogManager.GetLogger("File");
            bool         success = false;
            //try
            //{
            Template   template1  = new Template();
            FeatureSet featureSet = new FeatureSet();

            SqlParameter[] para = new SqlParameter[1];

            if (ddllocation.Text.Trim() != "")
            {
                //para[0] = new SqlParameter("@Role", Session["user_role"].ToString());
                para[0] = new SqlParameter("Staff_ID", Session["StaffID"].ToString());
                DataTable dt = dal.executeprocedure("usp_GetRoleThumbPrints", para, false);

                foreach (DataRow dr in dt.Rows)
                {
                    template1 = new DPFP.Template();
                    template1.DeSerialize((byte[])dr["ThumbImage"]);

                    featureSet = new DPFP.FeatureSet();
                    featureSet.DeSerialize(HexsToArray(hdnFP.Value));
                    if (VerifyFingerprints(template1, featureSet))
                    {
                        string ipaddress = Request.ServerVariables["REMOTE_ADDR"].ToString();
                        string staffid   = dt.Rows[0]["Staff_ID"].ToString();
                        getLocationIDByName(ddllocation.Text.Trim());
                        int locid = Convert.ToInt32(SearchLocID.Text);


                        SqlParameter[] para1 = new SqlParameter[5];
                        para1[0] = new SqlParameter("@UserID", staffid);
                        para1[1] = new SqlParameter("@IPAddress", ipaddress);
                        para1[2] = new SqlParameter("@Location_ID", locid);
                        para1[3] = new SqlParameter("@Logintime", DateTime.Now);
                        para1[4] = new SqlParameter("@Fromdate", DateTime.Now);
                        dal.executeprocedure("SP_AddThumbStoreInfo", para1);

                        Response.Redirect("~/ADMIN/ThumbAfter.aspx");
                    }
                    success = true;
                }
            }
            else
            {
                lblerror.Visible = true;
                lblerror.Text    = "Please Select The Location";
            }
            if (!success)
            {
                if (!(lblerror.Text.ToLower().Contains("already")))
                {
                    lblerror.Text    = "Invalid Thumbprint. Please Put Correct Finger.";
                    lblerror.Visible = true;
                }
            }
        }
Ejemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataView   DataView        = null;
            string     savedPassword   = null;
            string     enteredPassword = null;
            Template   template1       = new Template();
            FeatureSet featureSet      = new FeatureSet();

            // Attempt to select information from the database using name as a parameter (via asp.net).
            DataView = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

            // Check if a record exists.

            if (DataView != null && !DataView.Table.Rows.Count.Equals(0))
            {
                // Get data from the form and the returned recordset.
                savedPassword   = (object.ReferenceEquals(DataView.Table.Rows[0]["Password"].GetType(), typeof(DBNull)) ? string.Empty : DataView.Table.Rows[0]["Password"].ToString().Trim());
                enteredPassword = TextBox2.Text;

                template1 = new DPFP.Template();
                template1.DeSerialize((byte[])DataView.Table.Rows[0]["Template1"]);

                featureSet = new DPFP.FeatureSet();
                featureSet.DeSerialize(HexsToArray(hdnFP.Value));

                // Verify data and return a message.
                if (VerifyFingerprints(template1, featureSet))
                {
                    if (VerifyPassword(savedPassword, enteredPassword) || enteredPassword.Equals(string.Empty))
                    {
                        // Handle a successful login.
                        Response.Redirect("./Success.aspx");

                        return;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected void btnThumbCheckIn_Click(object sender, EventArgs e)
        {
            SpaMaster SM = (SpaMaster)Page.Master;

            log4net.ILog logger  = log4net.LogManager.GetLogger("File");
            bool         success = false;

            try
            {
                Template   template1  = new Template();
                FeatureSet featureSet = new FeatureSet();

                SqlParameter[] para = new SqlParameter[1];
                //para[0] = new SqlParameter("@Role", txtrole.Text);
                para[0] = new SqlParameter("Staff_ID", Session["StaffID"].ToString());
                DataTable dt = dal.executeprocedure("usp_GetRoleThumbPrints", para, false);

                foreach (DataRow dr in dt.Rows)
                {
                    template1 = new DPFP.Template();
                    template1.DeSerialize((byte[])dr["ThumbImage"]);

                    featureSet = new DPFP.FeatureSet();
                    featureSet.DeSerialize(HexsToArray(hdnFP.Value));
                    if (VerifyFingerprints(template1, featureSet))
                    {
                        txtID1.Text     = dr["NRICno"].ToString();
                        txtName1.Text   = dr["FirstName"].ToString();
                        txtTeleNo1.Text = dr["Phone"].ToString();
                        //SqlDataReader rd;
                        DataTable dtcheckin = dal.getdata("select Checkin_DateTime from checkin_manager where checkin_id = (select max(checkin_id)as checkin_id from checkin_manager where Userid='" + dr["Staff_ID"].ToString() + "')");
                        if (dtcheckin.Rows.Count > 0)
                        {
                            txtcheckinTime.Text = dtcheckin.Rows[0][0].ToString();
                            lblcheckinTime.Text = dtcheckin.Rows[0][0].ToString();
                            AddCheckOutGuard(sender, e);
                            tblThumbInfo.Style.Add(HtmlTextWriterStyle.Display, "");
                            lblFin.Text   = dr["NRICno"].ToString();
                            lblName.Text  = dr["FirstName"].ToString();
                            lblPhone.Text = dr["Phone"].ToString();
                            if (dr["ImagePathName"] != null && dr["ImagePathName"].ToString() != "")
                            {
                                UserImage.ImageUrl = dr["ImagePathName"].ToString();
                                UserImage.Visible  = true;
                            }
                            else
                            {
                                UserImage.Visible = false;
                            }
                            success = true;
                            // dal.executesql("Insert into checkout_manager(Checkout_time) values('" + DateTime.Now + "')");

                            tblThumbInfo.Style.Add(HtmlTextWriterStyle.Display, "block");
                        }
                        else
                        {
                            //lblerror.Text = "You Have Already Checked-Out";
                            //lblerror.Visible = true;
                            SM.ShowErrorMessage("You Have Already Checked-Out");
                        }
                        break;
                    }
                }
                if (!success)
                {
                    if (!(lblerror.Text.ToLower().Contains("checked")))
                    {
                        //lblerror.Text = "Invalid Thumbprint. Please Put Correct Finger.";
                        //lblerror.Visible = true;
                        SM.ShowErrorMessage("Invalid Thumbprint. Please Put Correct Finger.");
                    }
                }
                else
                {
                    //lblerror.Text = "You Have Successfully Checked Out.";
                    //lblerror.Visible = true;
                    SM.ShowErrorMessage("You Have Successfully Checked Out.");
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
                if (!(lblerror.Text.ToLower().Contains("already")))
                {
                    //lblerror.Text = "Error Has Occured. Please Thumbprint Again.";
                    SM.ShowErrorMessage("Error Has Occured. Please Thumbprint Again.");
                }
                // lblerror.Visible = true;
            }
        }
Ejemplo n.º 4
0
        protected void btnThumbCheckIn_Click(object sender, EventArgs e)
        {
            log4net.ILog logger  = log4net.LogManager.GetLogger("File");
            bool         success = false;

            try
            {
                Template   template1  = new Template();
                FeatureSet featureSet = new FeatureSet();

                SqlParameter[] para = new SqlParameter[1];

                // para[0] = new SqlParameter("@Role", txtrole.Text);
                DataTable dt = dal.executeprocedure("usp_GetRoleThumbPrints", para, false);

                foreach (DataRow dr in dt.Rows)
                {
                    template1 = new DPFP.Template();
                    template1.DeSerialize((byte[])dr["ThumbImage"]);

                    featureSet = new DPFP.FeatureSet();
                    featureSet.DeSerialize(HexsToArray(hdnFP.Value));
                    if (VerifyFingerprints(template1, featureSet))
                    {
                        DataTable dtcheckin = dal.getdata("select checkin_id from checkin_manager where UserID = '" + dr["Staff_ID"].ToString() + "' ");
                        if (dtcheckin.Rows.Count > 0)
                        {
                            DataTable dtcheckout = dal.getdata("select checkout_id from checkout_manager where checkin_id = '" + dtcheckin.Rows[0][0].ToString() + "' ");
                            if (dtcheckout.Rows.Count == 0)
                            {
                                lblerror.Visible = true;
                                lblerror.Text    = "Security Officer is Already Checked in.Please Contact Your SuperVisor..!";
                                // lblerr1.Visible = true;
                                throw new Exception();
                            }
                        }
                        AddNewCheckInRequest objAddCheckinRequest = new AddNewCheckInRequest();
                        checkin objchickin = new checkin();
                        objchickin.telephone = dr["Phone"].ToString();
                        objchickin.UserID    = dr["Staff_ID"].ToString();
                        // objchickin.Role = txtrole.Text;
                        objchickin.user_name        = dr["FirstName"].ToString();
                        objchickin.Checkin_DateTime = DateTime.Now;
                        objchickin.NRICno           = dr["NRICno"].ToString();
                        if (Session["LCID"] != null && Session["LCID"].ToString() != "0")
                        {
                            objchickin.LocationID = int.Parse(Session["LCID"].ToString());
                        }
                        AdminBLL ws = new AdminBLL();
                        ws.AddCheckinGaurd(objchickin);
                        tblThumbInfo.Style.Add(HtmlTextWriterStyle.Display, "");
                        lblFin.Text   = dr["NRICno"].ToString();
                        lblName.Text  = dr["FirstName"].ToString();
                        lblPhone.Text = dr["Phone"].ToString();
                        if (dr["ImagePathName"] != null && dr["ImagePathName"].ToString() != "")
                        {
                            UserImage.ImageUrl = dr["ImagePathName"].ToString();
                            UserImage.Visible  = true;
                        }
                        else
                        {
                            UserImage.Visible = false;
                        }
                        success = true;
                        tblThumbInfo.Style.Add(HtmlTextWriterStyle.Display, "block");
                        break;
                        HttpContext.Current.Items.Add("COMPLETE", "INSERT");
                    }
                }
                if (!success)
                {
                    if (!(lblerror.Text.ToLower().Contains("already")))
                    {
                        lblerror.Text    = "Invalid Thumbprint. Please Put Correct Finger.";
                        lblerror.Visible = true;
                    }
                }
                else
                {
                    lblerror.Text    = "You Have Successfully Checked In";
                    lblerror.Visible = true;
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
                if (!(lblerror.Text.ToLower().Contains("already")))
                {
                    lblerror.Text = "Error Has Occured. Please Thumbprint Again.";
                }
                lblerror.Visible = true;
            }
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataView   DataView        = null;
            string     savedPassword   = null;
            string     enteredPassword = null;
            Template   template1       = new Template();
            Template   template2       = new Template();
            FeatureSet featureSet      = new FeatureSet();

            try
            {
                RequiredFieldValidator1.ErrorMessage = "Name is required.";

                // Handle only when fingerprints have been passed in on a postback and the page is valid.

                if (Page.IsPostBack && TextBox1.Text != string.Empty && HiddenField1.Value != string.Empty)
                {
                    // Registration handler.

                    if (Request.Url.AbsolutePath.Contains("Register.aspx"))
                    {
                        // Attempt to insert the information into the database.
                        SqlDataSource1.Insert();

                        // Handle a successful registration.
                        Response.Redirect("Success.aspx");

                        // Login handler.
                    }
                    else if (Request.Url.AbsolutePath.Contains("Login.aspx"))
                    {
                        // Attempt to select information from the database using name as a parameter (via asp.net).
                        DataView = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

                        // Check if a record exists.

                        if (DataView != null && !DataView.Table.Rows.Count.Equals(0))
                        {
                            // Get data from the form and the returned recordset.
                            savedPassword   = (object.ReferenceEquals(DataView.Table.Rows[0]["Password"].GetType(), typeof(DBNull)) ? string.Empty : DataView.Table.Rows[0]["Password"].ToString().Trim());
                            enteredPassword = TextBox2.Text;

                            template1 = new DPFP.Template();
                            template1.DeSerialize((byte[])DataView.Table.Rows[0]["Template1"]);

                            template2 = new DPFP.Template();
                            template2.DeSerialize((byte[])DataView.Table.Rows[0]["Template2"]);

                            featureSet = new DPFP.FeatureSet();
                            featureSet.DeSerialize(HexsToArray(this.HiddenField1.Value));

                            // Verify data and return a message.
                            if (VerifyFingerprints(template1, template2, featureSet))
                            {
                                if (VerifyPassword(savedPassword, enteredPassword) || enteredPassword.Equals(string.Empty))
                                {
                                    // Handle a successful login.
                                    Response.Redirect("./Success.aspx");

                                    return;
                                }
                            }
                        }

                        this.Label3.Text = "Login Failed.  Either your password is invalid, or your fingerprints to not match.  Please try again.";

                        RequiredFieldValidator1.ErrorMessage = string.Empty;
                    }
                }
                else
                {
                    this.Label3.Text = string.Empty;
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Violation of PRIMARY KEY constraint"))
                {
                    this.Label3.Text = "Name is already registered.  Please choose another name.";
                }
                else
                {
                    this.Label3.Text = "Handled System Error :::: " + ex.Message + " :::: " + ex.StackTrace;
                }
            }
            finally
            {
                // Clear the form.
                Clear();
            }
        }
Ejemplo n.º 6
0
        protected void btnThumbCheckIn_Click(object sender, EventArgs e)
        {
            SpaMaster SM = (SpaMaster)Page.Master;

            log4net.ILog logger  = log4net.LogManager.GetLogger("File");
            bool         success = false;

            try
            {
                Template       template1  = new Template();
                FeatureSet     featureSet = new FeatureSet();
                SqlParameter[] para       = new SqlParameter[1];

                // para[0] = new SqlParameter("Staff_ID", "4D1614C3A02F");
                para[0] = new SqlParameter("Staff_ID", Session["StaffID1"].ToString());
                DataTable dt = dal.executeprocedure("usp_GetRoleThumbPrints", para, false);
                foreach (DataRow dr in dt.Rows)
                {
                    featureSet = new DPFP.FeatureSet();
                    featureSet.DeSerialize(HexsToArray(hdnFP.Value));
                    template1 = new DPFP.Template();
                    template1.DeSerialize((byte[])dr["ThumbImage"]);
                    if (VerifyFingerprints(template1, featureSet))
                    {
                        DataTable dtcheckin = dal.getdata("select checkin_id from checkin_manager where UserID = '" + dr["Staff_ID"].ToString() + "' ");
                        if (dtcheckin.Rows.Count > 0)
                        {
                            DataTable dtcheckout = dal.getdata("select checkout_id from checkout_manager where checkin_id = '" + dtcheckin.Rows[0][0].ToString() + "' ");
                            if (dtcheckout.Rows.Count == 0)
                            {
                                //lblerror.Visible = true;
                                //lblerror.Text = "Security Officer is Already Checked in.Please Contact Your SuperVisor..!";
                                //lblerr1.Visible = true;
                                SM.ShowErrorMessage("Security Officer is Already Checked in.Please Contact Your SuperVisor..!");
                                return;
                                // throw new Exception();
                            }
                        }

                        AddNewCheckInRequest objAddCheckinRequest = new AddNewCheckInRequest();
                        checkin objchickin = new checkin();
                        objchickin.telephone        = dr["Phone"].ToString();
                        objchickin.UserID           = dr["Staff_ID"].ToString();
                        objchickin.Role             = txtrole.Text;
                        objchickin.user_name        = dr["FirstName"].ToString();
                        objchickin.Checkin_DateTime = DateTime.Now;
                        objchickin.NRICno           = dr["NRICno"].ToString();
                        if (Session["LCID"] != null && Session["LCID"].ToString() != "0")
                        {
                            objchickin.LocationID = int.Parse(Session["LCID"].ToString());
                        }
                        //=========================================//
                        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 dr1            = cmd.ExecuteReader();
                        string        AssignmentCode = string.Empty;
                        if (dr1.Read())
                        {
                            AssignmentCode = dr1.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 = dr["NRICno"].ToString();
                        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;
                        //==========================================//
                        AdminBLL ws = new AdminBLL();
                        ws.AddCheckinGaurd(objchickin);
                        tblThumbInfo.Style.Add(HtmlTextWriterStyle.Display, "");
                        lblFin.Text   = dr["NRICno"].ToString();
                        lblName.Text  = dr["FirstName"].ToString();
                        lblPhone.Text = dr["Phone"].ToString();
                        if (dr["ImagePathName"] != null && dr["ImagePathName"].ToString() != "")
                        {
                            UserImage.ImageUrl = dr["ImagePathName"].ToString();
                            UserImage.Visible  = true;
                        }
                        else
                        {
                            UserImage.Visible = false;
                        }
                        success = true;
                        tblThumbInfo.Style.Add(HtmlTextWriterStyle.Display, "block");
                        break;
                        HttpContext.Current.Items.Add("COMPLETE", "INSERT");
                    }
                }
                if (!success)
                {
                    if (!(lblerror.Text.ToLower().Contains("already")))
                    {
                        //lblerror.Text = "Invalid Thumbprint. Please Put Correct Finger.";
                        //lblerror.Visible = true;
                        SM.ShowErrorMessage("Invalid Thumbprint. Please Put Correct Finger.");
                    }
                }
                else
                {
                    //lblerror.Text = "You Have Successfully Checked In";
                    //lblerror.Visible = true;
                    SM.ShowErrorMessage("You Have Successfully Checked In");
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
                if (!(lblerror.Text.ToLower().Contains("already")))
                {
                    //lblerror.Text = "Error Has Occured. Please Thumbprint Again.";
                    SM.ShowErrorMessage("Error Has Occured. Please Thumbprint Again.");
                }
                // lblerror.Visible = true;
            }
        }