Exemple #1
0
        protected void btnManager_Click(object sender, EventArgs e)
        {
            entities.EMPID        = txtUserIdM.Text;
            entities.LocationName = txtLocationM.Text;
            entities.UserID       = Convert.ToInt32(hdnManageUserID.Value.Trim());
            string timezone = "";

            if (Convert.ToInt32(Session["TimeZoneID"]) == 2)
            {
                timezone = "Eastern Standard Time";
            }
            else
            {
                timezone = "India Standard Time";
            }
            DateTime ISTTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timezone));

            Session["TodayBannerDate"] = ISTTime.ToString("MM/dd/yyyy");
            entities.passcode          = txtPasswordM.Text;
            DataSet dsman = business.AuthinticateManager(entities);

            if (dsman.Tables.Count > 0)
            {
                if (dsman.Tables[0].Rows.Count > 0)
                {
                    Session["Location"]      = entities.LocationName;
                    Session["UserID"]        = dsman.Tables[0].Rows[0]["userid"].ToString();
                    Session["IsManage"]      = dsman.Tables[0].Rows[0]["ismanage"].ToString();
                    Session["IsAdmin"]       = dsman.Tables[0].Rows[0]["IsAdmin"].ToString();
                    Session["Photo"]         = "~/Photos/" + dsman.Tables[0].Rows[0]["photolink"].ToString().Trim();
                    Session["EmpName"]       = dsman.Tables[0].Rows[0]["firstname"].ToString().Trim() + " " + dsman.Tables[0].Rows[0]["lastname"].ToString().Trim();
                    Session["ScheduleInOut"] = dsman.Tables[0].Rows[0]["StartTime"].ToString().Trim() + "-" + dsman.Tables[0].Rows[0]["EndTime"].ToString().Trim();

                    if (Session["IsAdmin"].ToString() == "True")
                    {
                        Response.Redirect("AdminReports.aspx");
                    }
                    else
                    {
                        Response.Redirect("Reports.aspx");
                    }
                }
                else
                {
                    lblErrorM.Text  = "Invalid emp id or password or location code";
                    txtUserIdM.Text = "";
                    txtUserIdM.Focus();
                }
            }
            else
            {
                lblErrorM.Text  = "Invalid emp id or password or location code";
                txtUserIdM.Text = "";
                txtUserIdM.Focus();
            }
        }