Beispiel #1
0
        public void SignInInsert()
        {
            search();
            DataSet Ds = new DataSet();

            LP = PasswordTextBox.Text.ToString().Trim();

            Session["UserName"] = EM.ToString().TrimStart().TrimEnd();
            Session["Email"]    = mailid.ToString();
            try
            {
                try
                {
                    //search();
                    if (P == LP)
                    {
                        RL.HEmployeeID   = EmployeeIDTextBox.Text.ToString().TrimStart().TrimEnd();
                        RL.HEmployeeName = EM.ToString();
                        RL.DateTiming    = DateTime.Now.ToString();
                        RL.OutTime       = "IN";
                        RL.Remark1       = "I";
                        RL.Remark2       = "I";



                        DataTO       Da = new DataTO();
                        SqlParameter OP = new SqlParameter("@empid", RL.HEmployeeID);
                        Da.parameters.Add(OP);

                        UsID = Da.ExecuteScalar("EmployeeDesig").ToString();

                        if (firstlogin == "null" || firstlogin == "")
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "pop", "openModal();", true);

                            //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModalChangePassword').modal();", true);
                            //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none","<script>$('#myModalChangePassword').modal('show');</script>", false);
                            //ScriptManager.RegisterStartupScript(this, this.GetType(), "ModalView", "<script>$(function() { $('#myModalChangePassword').modal('show'); });</script>", false);
                        }
                        else
                        {
                            if (Rmk != "D")
                            {
                                if (chk == "staff" && mailid == "*****@*****.**")
                                {
                                    RL.LogInsert(RL);
                                    Response.Redirect("AdminDashboard.aspx", false);
                                }
                                else if (chk == "staff" || chk == "com" && mailid != "*****@*****.**")
                                {
                                    if (chk == "staff" && mailid != "*****@*****.**" && EM == "Rajesh")
                                    {
                                        RL.LogInsert(RL);
                                        Response.Redirect("FinanceDashboard.aspx?value=" + RL.HEmployeeID, false);
                                    }

                                    else
                                    {
                                        //   RL.LogInsert(RL);
                                        Response.Redirect("Deptdashboardlink.aspx?value=" + RL.HEmployeeID, false);
                                    }
                                }

                                else
                                {
                                    string i = "1";
                                    Response.Redirect("default.aspx?value=" + RL.HEmployeeID, false);
                                }
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "swal('UnAuthorized User','','error')", true);
                            }
                        }
                    }
                    //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('New Employee Record Is Added')", true);


                    else
                    {
                        Label1.Visible = false;
                        Label1.Text    = "Incorrect Password";
                        //  ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Incorrect Employee Id or Password')", true);
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "swal('Incorrect Employee Id or Password','','warning')", true);
                    }
                }
                catch (Exception ex)
                {
                    Label1.Visible = false;
                    Label1.Text    = "Employee Id or Password Incorrect";
                    //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Employee Id or Password Incorrect')", true);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "swal('Employee Id or Password Incorrect','','warning')", true);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error Initializing Data Class." + Environment.NewLine + ex.Message);
            }
        }