Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LoginDAL          objLogin             = new LoginDAL();
            EmployeeMasterDAL objEmployeeMasterDAL = new EmployeeMasterDAL();

            lblCompName.Text = objLogin.SelectCompanyName();


            lblDatabaseName.Text = "DB: " + Convert.ToString(Session["DBName"]);
            var objEmpMaster = objEmployeeMasterDAL.SelectById(Convert.ToInt64(Session["UserIdno"]));

            imgEmp.ImageUrl = string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Photo"))) ? "~/img/placeholder.png" : "~" + Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Photo")).Trim();

            objEmpMaster = null;

            if (Session["LastLoginDate"] != "" && Session["LastLoginDate"] != null)
            {
                lblLastLoginDate.Visible = true;
                lblLastLoginDate.Text    = "Last Login : "******"LastLoginDate"].ToString()).ToString();
            }
            else
            {
                lblLastLoginDate.Visible = true;
                lblLastLoginDate.Text    = "First time Login";
            }

            if (string.IsNullOrEmpty(lblDatabaseName.Text))
            {
                Response.Redirect("Login.aspx", false);
            }
            lblusername.Text = Convert.ToString(Session["UserName"]);

            if (string.IsNullOrEmpty(lblusername.Text))
            {
                Response.Redirect("Login.aspx", false);
            }
        }
        private void Populate(Int64 intEmpIdno)
        {
            PopulateMultpleFromCity(Convert.ToInt32(intEmpIdno));
            EmployeeMasterDAL objEmployeeMasterDAL = new EmployeeMasterDAL();
            var objEmpMaster = objEmployeeMasterDAL.SelectById(intEmpIdno);
            var lst1         = objEmployeeMasterDAL.SelectFromCityMultiple(intEmpIdno);

            objEmployeeMasterDAL = null;
            if (objEmpMaster != null)
            {
                string gender = "";
                gender = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Gender"));
                if (gender == "F")
                {
                    RdoBtnFemale.Checked = true;
                }
                else
                {
                    RdoBtnMale.Checked = true;
                }
                hidEmpIdno.Value       = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "EmpIdno"));
                txtEmpName.Text        = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "EmpName"));
                txtFatherName.Text     = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "FName"));
                txtDOB.Text            = string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "DOB"))) ? "" : Convert.ToDateTime(DataBinder.Eval(objEmpMaster[0], "DOB")).ToString("dd-MM-yyyy");
                txtDOJ.Text            = string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "DOJ"))) ? "" : Convert.ToDateTime(DataBinder.Eval(objEmpMaster[0], "DOJ")).ToString("dd-MM-yyyy");
                txtDOR.Text            = string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "DOR"))) ? "" : Convert.ToDateTime(DataBinder.Eval(objEmpMaster[0], "DOR")).ToString("dd-MM-yyyy");
                txtPhone.Text          = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Phone"));
                txtMobile.Text         = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Mobile"));
                txtEmail.Text          = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "EMAIL"));
                txtAddress.Text        = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Address"));
                ddlState.SelectedValue = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "State"));
                ddlState_SelectedIndexChanged(null, null);
                ddlCity.SelectedValue        = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "City"));
                ddlDesignation.SelectedValue = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Desig"));
                txtPinCode.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "PinCode"));
                txtRemarks.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Remark"));
                bool bStatus = Convert.ToBoolean(DataBinder.Eval(objEmpMaster[0], "Status"));
                if (Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Computer_User")) == "False")
                {
                    ddlcomputerstatus.SelectedValue = "1";
                }
                else
                {
                    ddlcomputerstatus.SelectedValue = "0";
                }
                chkIsActive.Checked = bStatus;
                txtUName.Text       = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "UserName"));
                string pwd1 = WebTransport.Classes.EncryptDecryptPass.decryptPassword(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Password")));
                txtPassword.Attributes.Add("value", pwd1);
                imgEmp.ImageUrl = "~" + Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Photo")).Trim();

                if (lst1.Count > 0)
                {
                    for (int i = 0; i < chklistFromcity.Items.Count; i++)
                    {
                        for (int j = 0; j < lst1.Count; j++)
                        {
                            if (Convert.ToInt64(chklistFromcity.Items[i].Value) == lst1[j].FrmCity_Idno)
                            {
                                chklistFromcity.Items[i].Selected = true;
                            }
                        }
                    }
                }
            }
        }