Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BusinessLayer.Common.Employee ObjEmployee = new BusinessLayer.Common.Employee();
            ObjEmployee.ChangePassword(int.Parse(HttpContext.Current.User.Identity.Name), txtPassword.Text.Trim());

            Message.IsSuccess = true;
            Message.Text      = "Your Password is Changed Successfully";
            Message.Show      = true;
            txtPassword.Text  = "";
        }
        protected void LoadUser()
        {
            BusinessLayer.Common.Employee objEmployee = new BusinessLayer.Common.Employee();
            DataView dv = new DataView(objEmployee.GetAll("", ""));

            dv.RowFilter = "CompanyId=" + Session["CompanyID"].ToString();
            dv.Sort      = "FullName";

            if (dv != null)
            {
                ddlEmployee.DataSource = dv;
                ddlEmployee.DataBind();
            }
            ddlEmployee.Items.Insert(0, li);
        }
        private string GetEmployeeName()
        {
            int EmployeeId = Convert.ToInt32(Session["UserId"].ToString());

            BusinessLayer.Common.Employee ObjEmployee = new BusinessLayer.Common.Employee();
            Entity.Common.Employee        Employee    = new Entity.Common.Employee();
            Employee = ObjEmployee.GetAllById(EmployeeId);
            if (Employee != null)
            {
                return(Employee.FirstName + " " + Employee.MiddleName + " " + Employee.LastName);
            }
            else
            {
                return("");
            }
        }
        protected void LoadSignature()
        {
            BusinessLayer.Common.Employee ObjEmployee = new BusinessLayer.Common.Employee();
            Entity.Common.Employee        Employee    = new Entity.Common.Employee();
            Employee = ObjEmployee.GetAllById(Convert.ToInt32(Session["CreatedByCTV"]));

            StringBuilder sb = new StringBuilder();

            sb.Append(@"<table width='100%' align='center'>");
            sb.Append(@"<tr><td width='35%' align='center' style='border-top: dotted 1px #000'>");
            sb.Append(@"Prepared By  " + Employee.FirstName + " " + Employee.MiddleName + " " + Employee.LastName);

            sb.Append(@"</td><td width='5%'></td><td width='20%'align='center' style='border-top: dotted 1px #000'>Approved By</td>");
            sb.Append(@"<td width='5%'></td><td width='35%' align='center' style='border-top: dotted 1px #000'>Received By</td></tr>");
            sb.Append(@"</table>");
            ltrSignature.Text = sb.ToString();
        }
Ejemplo n.º 5
0
        protected void LoadDropdown()
        {
            strValues = "" + chr.ToString() + "Main Group";
            genObj.BindAjaxDropDownColumnsBySP(ddlGroup, "spSelect_MstAccountsGroup", strValues);
            ddlGroup.Items.Insert(0, li);

            //Bank Name population
            strValues = "Bank Name";
            genObj.BindDropDownColumnsBySP(ddlBankName, "spSelect_MstGeneralItem", strValues);
            ddlBankName.Items.Insert(0, li);

            //Employee population
            BusinessLayer.Common.Employee ObjEmployee = new BusinessLayer.Common.Employee();
            DataView dv = new DataView(ObjEmployee.GetAll("", ""));

            dv.RowFilter = "CompanyId = " + Session["CompanyID"].ToString() + " and CompanyId is not null";

            ddlOperatedBy.DataSource = dv;
            ddlOperatedBy.DataBind();
            ddlOperatedBy.Items.Insert(0, li);
        }
        protected void AdminLogin()
        {
            string u = txtUserName.Text.Trim();
            string p = txtPassword.Text.Trim();

            BusinessLayer.Common.Employee ObjEmployee = new BusinessLayer.Common.Employee();
            DataTable dt = new DataTable();

            try
            {
                dt = ObjEmployee.AuthenticateUser(u, "Admin");

                if (dt != null && dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["Password"].ToString() == p)
                    {
                        int UserId    = int.Parse(dt.Rows[0]["EmployeeId"].ToString());
                        int CompanyId = int.Parse(dt.Rows[0]["CompanyId"].ToString());
                        FormsAuthenticationTicket Authticket = new FormsAuthenticationTicket(
                            1,
                            UserId.ToString(),
                            DateTime.Now,
                            DateTime.Now.AddMinutes(300),
                            false,
                            dt.Rows[0]["roles"].ToString(),
                            FormsAuthentication.FormsCookiePath);
                        string     hash       = FormsAuthentication.Encrypt(Authticket);
                        HttpCookie Authcookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);
                        if (Authticket.IsPersistent)
                        {
                            Authcookie.Expires = Authticket.Expiration;
                        }
                        Response.Cookies.Add(Authcookie);
                        Session["UserId"]    = UserId;
                        Session["UserType"]  = "Admin";
                        Session["UserName"]  = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["MiddleName"].ToString() + " " + dt.Rows[0]["LastName"].ToString();
                        Session["CompanyId"] = CompanyId;
                        //Session["BranchID"] = GetBranchId(UserId);
                        Session["BranchID"] = 1;
                        Session["DataFlow"] = 1;
                        Session["FinYrID"]  = GetCurrentFinYrID();
                        Session["EmpRole"]  = dt.Rows[0]["roles"].ToString();
                        Session["UserMode"] = "Admin";
                        Session.Timeout     = 300;

                        string  strValues = Session["FinYrID"].ToString();
                        DataSet ds        = genObj.ExecuteSelectSP("spSelect_MstFinancialYearForSelection", strValues);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            Session["SesFromDate"] = Convert.ToDateTime("01 Apr " + ds.Tables[0].Rows[0]["StartYear"].ToString()).ToString("dd MMM yyyy");
                            Session["SesToDate"]   = Convert.ToDateTime("31 Mar " + ds.Tables[0].Rows[0]["EndYear"].ToString()).ToString("dd MMM yyyy");
                        }
                        if (txtUserName.Text == "001")
                        {
                            Session["Module"] = "S";
                            Response.Redirect("default.aspx");
                        }

                        //////  Checking for Development Fee Generate - added by _BASIR BAIDYA/////////
                        int[]    a        = { 1, 2, 3, 4, 5 };
                        DateTime dateTime = DateTime.Now.AddHours(12).AddMinutes(30);
                        int      Month    = dateTime.Month;
                        if (a.Contains(dateTime.Day))
                        {
                            //GoDevelopmentFeeGenerate();
                        }

                        ShowModulePopup(dt.Rows[0]["AccessModule"].ToString());
                    }
                }
                txtUserName.Text = "";
                txtPassword.Text = "";
                txtUserName.Focus();
            }
            catch (Exception ex)
            { }
        }
        private void AgentLogin()
        {
            string u = txtUserName.Text.Trim();
            string p = txtPassword.Text.Trim();

            BusinessLayer.Common.Employee ObjEmployee = new BusinessLayer.Common.Employee();
            DataTable dt = new DataTable();

            try
            {
                dt = ObjEmployee.AuthenticateUser(u, "Agent");

                if (dt != null && dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["Password"].ToString() == p)
                    {
                        int UserId    = int.Parse(dt.Rows[0]["AgentId"].ToString());
                        int CompanyId = int.Parse(dt.Rows[0]["CompanyId"].ToString());
                        FormsAuthenticationTicket Authticket = new FormsAuthenticationTicket(
                            1,
                            UserId.ToString(),
                            DateTime.Now,
                            DateTime.Now.AddMinutes(180),
                            false,
                            dt.Rows[0]["roles"].ToString(),
                            FormsAuthentication.FormsCookiePath);
                        string     hash       = FormsAuthentication.Encrypt(Authticket);
                        HttpCookie Authcookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);
                        if (Authticket.IsPersistent)
                        {
                            Authcookie.Expires = Authticket.Expiration;
                        }
                        Response.Cookies.Add(Authcookie);
                        Session["UserId"]    = UserId;
                        Session["UserType"]  = "Agent";
                        Session["UserName"]  = dt.Rows[0]["AgentName"].ToString();
                        Session["CompanyId"] = CompanyId;
                        //Session["BranchID"] = GetBranchId(UserId);
                        Session["BranchID"]      = 1;
                        Session["DataFlow"]      = 1;
                        Session["FinYrID"]       = GetCurrentFinYrID();
                        Session["EmpRole"]       = dt.Rows[0]["roles"].ToString();
                        Session["UserMode"]      = "Agent";
                        Session["StateId"]       = dt.Rows[0]["StateId"].ToString();
                        Session["DistrictId"]    = dt.Rows[0]["DistrictId"].ToString();
                        Session["BlockId"]       = dt.Rows[0]["BlockId"].ToString();
                        Session["AgentLedgerId"] = dt.Rows[0]["LedgerId"].ToString();

                        Session.Timeout = 180;

                        string  strValues = Session["FinYrID"].ToString();
                        DataSet ds        = genObj.ExecuteSelectSP("spSelect_MstFinancialYearForSelection", strValues);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            Session["SesFromDate"] = Convert.ToDateTime("01 Apr " + ds.Tables[0].Rows[0]["StartYear"].ToString()).ToString("dd MMM yyyy");
                            Session["SesToDate"]   = Convert.ToDateTime("31 Mar " + ds.Tables[0].Rows[0]["EndYear"].ToString()).ToString("dd MMM yyyy");
                        }
                        Response.Redirect("AgentDefault.aspx");
                    }
                }
                txtUserName.Text = "";
                txtPassword.Text = "";
                txtUserName.Focus();
            }
            catch
            {
            }
        }