Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (SessionWrapper.UserName == string.Empty || SessionWrapper.UserType != "A")
            {
                //Response.Redirect("Default.aspx");
            }
            else
            {
                lblUserName.Text = "Welcome : " + SessionWrapper.UserName;
            }
            EntityLogin entLogin = (EntityLogin)Session["user"];

            if (entLogin != null)
            {
                EntityEmployee entEmp = new EntityEmployee();
                entEmp.EmpFirstName   = new EmployeeBLL().GetEmpName(entLogin.UserName);
                lblUserName.Text      = "Welcome : " + entLogin.UserType;
                Session["UserType12"] = entLogin.UserType;
                Session["AdminName"]  = entEmp.EmpFirstName;
                if (!entLogin.UserType.Equals("admin", StringComparison.CurrentCultureIgnoreCase))
                {
                    AddForms(entEmp.EmpFirstName);
                    //Userauthenticate(entLogin);
                }
                else
                {
                    List <EntityFormMaster> entLstForms = new UserAuthenticationBLL().GetAllForms();
                    Session["AccessibleForm"] = entLstForms;
                }
            }
        }
Exemple #2
0
        public int InsertEmployee(EntityEmployee entEmployee)
        {
            int cnt = 0;

            try
            {
                List <SqlParameter> lstParam = new List <SqlParameter>();
                Commons.ADDParameter(ref lstParam, "@EmpCode", DbType.String, entEmployee.EmpCode);
                Commons.ADDParameter(ref lstParam, "@EmpFirstName", DbType.String, entEmployee.EmpFirstName);
                Commons.ADDParameter(ref lstParam, "@EmpMiddleName", DbType.String, entEmployee.EmpMiddleName);
                Commons.ADDParameter(ref lstParam, "@EmpLastName", DbType.String, entEmployee.EmpLastName);
                Commons.ADDParameter(ref lstParam, "@EmpAddress", DbType.String, entEmployee.EmpAddress);
                Commons.ADDParameter(ref lstParam, "@EmpDOB", DbType.DateTime, entEmployee.EmpDOB);
                Commons.ADDParameter(ref lstParam, "@EmpDOJ", DbType.DateTime, entEmployee.EmpDOJ);
                Commons.ADDParameter(ref lstParam, "@DeptId", DbType.String, entEmployee.DeptId);
                Commons.ADDParameter(ref lstParam, "@EntryBy", DbType.String, entEmployee.EntryBy);
                Commons.ADDParameter(ref lstParam, "@DesigId", DbType.Int32, entEmployee.DesignationId);
                Commons.ADDParameter(ref lstParam, "@UserType", DbType.String, entEmployee.UserType);
                Commons.ADDParameter(ref lstParam, "@BankName", DbType.String, entEmployee.BankName);
                Commons.ADDParameter(ref lstParam, "@BankACNo", DbType.String, entEmployee.BankACNo);
                Commons.ADDParameter(ref lstParam, "@PFNo", DbType.String, entEmployee.PFNo);
                Commons.ADDParameter(ref lstParam, "@PanNo", DbType.String, entEmployee.PanNo);
                Commons.ADDParameter(ref lstParam, "@BasicSalary", DbType.Decimal, entEmployee.BasicSal);
                cnt = mobjDataAcces.ExecuteQuery("sp_InsertEmployee", lstParam);
            }
            catch (Exception ex)
            {
                Commons.FileLog("EmployeeBLL - InsertEmployee(EntityEmployee entEmployee) ", ex);
            }
            return(cnt);
        }
        protected void BtnEdit_Click(object sender, EventArgs e)
        {
            int cnt = 0;
            List <EntityEmployee> lstentEmployee = new List <EntityEmployee>();

            try
            {
                EntityEmployee entEmployee = new EntityEmployee();
                entEmployee.EmpCode        = txtEmpCode.Text;
                entEmployee.EmpFirstName   = FirstCharToUpper(txtFirstName.Text);
                entEmployee.EmpMiddleName  = FirstCharToUpper(txtMidleName.Text);
                entEmployee.EmpLastName    = FirstCharToUpper(txtLastName.Text);
                entEmployee.Education      = txtEducation.Text.Trim();
                entEmployee.RegistrationNo = txtRegistrationNo.Text.Trim();
                if (txtDOBDate.Text == string.Empty)
                {
                    entEmployee.EmpDOB = System.DateTime.Today.Date;
                }
                else
                {
                    entEmployee.EmpDOB = Convert.ToDateTime(txtDOBDate.Text.Trim()).Date;
                }

                if (txtJoinDate.Text == string.Empty)
                {
                    entEmployee.EmpDOJ = System.DateTime.Today.Date;
                }
                else
                {
                    entEmployee.EmpDOJ = Convert.ToDateTime(txtJoinDate.Text.Trim()).Date;
                }

                entEmployee.EmpAddress    = FirstCharToUpper(txtAddress.Text);
                entEmployee.BankName      = FirstCharToUpper(txtBank.Text);
                entEmployee.BankACNo      = txtBankAc.Text.Trim();
                entEmployee.PFNo          = txtPF.Text;
                entEmployee.PanNo         = txtPan.Text;
                entEmployee.BasicSal      = Convert.ToDecimal(txtBaseSal.Text);
                entEmployee.DeptId        = Convert.ToInt32(ddlDepartment.SelectedValue);
                entEmployee.DesignationId = Convert.ToInt32(ddlDesignation.SelectedValue);
                entEmployee.ChangeBy      = SessionWrapper.UserName;
                cnt = mobjEmpBLL.UpdateEmployee(entEmployee);

                if (cnt > 0)
                {
                    GetEmployee();
                    lblMessage.Text = "Record Updated Successfully.";
                }
                else
                {
                    lblMessage.Text = "Record Not Updated.";
                }
                MultiView1.SetActiveView(View1);
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Exemple #4
0
        private List <SqlParameter> CreateParameterDeleteEmp(EntityEmployee entEmployee)
        {
            List <SqlParameter> lstParam = new List <SqlParameter>();

            Commons.ADDParameter(ref lstParam, "@EmpCode", DbType.String, entEmployee.EmpCode);
            Commons.ADDParameter(ref lstParam, "@Discontinued", DbType.Boolean, entEmployee.DisContinued);
            Commons.ADDParameter(ref lstParam, "@DiscontRemark", DbType.String, entEmployee.DisContRemark);
            return(lstParam);
        }
Exemple #5
0
 internal static Employee Map(EntityEmployee entity)
 {
     return(new Employee
     {
         EmployeeId = entity.EmployeeId,
         EmployeeGuid = entity.EmployeeGuid,
         Description = entity.Description,
         Name = entity.Name
     });
 }
Exemple #6
0
        public string GetEmpName(string UserCode)
        {
            EntityEmployee entEmpp = new EntityEmployee();

            entEmpp = (from tbl in objData.tblEmployees
                       where tbl.EmpCode.Equals(UserCode) &&
                       tbl.IsDelete == false
                       select new EntityEmployee {
                EmpFirstName = tbl.EmpFirstName + ' ' + tbl.EmpMiddleName + ' ' + tbl.EmpLastName
            }).FirstOrDefault();

            return(entEmpp.EmpFirstName);
        }
Exemple #7
0
        private List <SqlParameter> CreateParameterInsertEmp(EntityEmployee entEmployee)
        {
            List <SqlParameter> lstParam = new List <SqlParameter>();

            Commons.ADDParameter(ref lstParam, "@EmpCode", DbType.String, entEmployee.EmpCode);
            Commons.ADDParameter(ref lstParam, "@EmpFirstName", DbType.String, entEmployee.EmpFirstName);
            Commons.ADDParameter(ref lstParam, "@EmpMiddleName", DbType.String, entEmployee.EmpMiddleName);
            Commons.ADDParameter(ref lstParam, "@EmpLastName", DbType.String, entEmployee.EmpLastName);
            Commons.ADDParameter(ref lstParam, "@EmpAddress", DbType.String, entEmployee.EmpAddress);
            Commons.ADDParameter(ref lstParam, "@EmpDOB", DbType.DateTime, entEmployee.EmpDOB);
            Commons.ADDParameter(ref lstParam, "@EmpDOJ", DbType.DateTime, entEmployee.EmpDOJ);
            Commons.ADDParameter(ref lstParam, "@DeptId", DbType.String, entEmployee.DeptId);
            return(lstParam);
        }
        public ActionResult UpdateRecord(EntityEmployee model)
        {
            var newEmployee = empList.FirstOrDefault(emp => emp.EmpID == model.EmpID);

            if (newEmployee == null)
            {
                empList.Add(newEmployee);
            }
            else
            {
                int    id     = model.EmpID;
                string fName  = model.FirstName;
                string lName  = model.LastName;
                bool   status = UpdateEmployeeList(id, fName, lName);
            }

            return(PartialView("DemoPartial", empList));
        }
        public ActionResult AddEmployee(int id)
        {
            if (id == 0)
            {
                EntityEmployee employee = new EntityEmployee()
                {
                    EmpID     = empList.Count + 1,
                    FirstName = "",
                    LastName  = ""
                };

                return(View("Index", employee));
            }
            else
            {
                var employeeList = empList.FirstOrDefault(e => e.EmpID == id);
                return(PartialView("DemoPartial", employeeList));
            }
        }
        public ActionResult Details(int id)
        {
            if (id == 0)
            {
                EntityEmployee emp = new EntityEmployee()
                {
                    EmpID     = empList.Count + 1,
                    FirstName = "",
                    LastName  = ""
                };
                return(View("Index", emp));
            }
            else
            {
                EntityEmployee employee = new EntityEmployee();
                employee = empList.FirstOrDefault(emp => emp.EmpID == id);
                return(View("Index", employee));
            }

            //return PartialView("Detail", employee);
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            int cnt = 0;

            try
            {
                EntityEmployee entEmployee = new EntityEmployee();
                entEmployee.EmpCode        = txtEmpCode.Text;
                entEmployee.EmpFirstName   = FirstCharToUpper(txtFirstName.Text);
                entEmployee.EmpMiddleName  = FirstCharToUpper(txtMidleName.Text);
                entEmployee.EmpLastName    = FirstCharToUpper(txtLastName.Text);
                entEmployee.Education      = txtEducation.Text.Trim();
                entEmployee.RegistrationNo = txtRegistrationNo.Text.Trim();
                entEmployee.DesignationId  = Convert.ToInt32(ddlDesignation.SelectedValue);
                if (txtDOBDate.Text == string.Empty)
                {
                    entEmployee.EmpDOB = System.DateTime.Today.Date;
                }
                else
                {
                    entEmployee.EmpDOB = Commons.ConvertToDate(txtDOBDate.Text);
                }
                if (txtJoinDate.Text == string.Empty)
                {
                    entEmployee.EmpDOJ = System.DateTime.Today.Date;
                }
                else
                {
                    entEmployee.EmpDOJ = Commons.ConvertToDate(txtJoinDate.Text);
                }
                if (entEmployee.EmpDOB >= entEmployee.EmpDOJ)
                {
                    lblMsg.Text = "Birth Date should be older than Joining Date...";
                    return;
                }

                if (entEmployee.EmpDOJ.Year - entEmployee.EmpDOB.Year < 18)
                {
                    lblMsg.Text = "Employee Cannot Be Less Then 18 Age";
                }
                else
                {
                    entEmployee.EmpAddress = FirstCharToUpper(txtAddress.Text);
                    entEmployee.BankName   = FirstCharToUpper(txtBank.Text);
                    entEmployee.BankACNo   = txtBankAc.Text.Trim();
                    entEmployee.PFNo       = txtPF.Text;
                    entEmployee.PanNo      = txtPan.Text;
                    entEmployee.BasicSal   = Convert.ToDecimal(txtBaseSal.Text);
                    entEmployee.UserType   = Convert.ToString(ddlDepartment.SelectedItem.Text);
                    entEmployee.DeptId     = Convert.ToInt32(ddlDepartment.SelectedValue);
                    entEmployee.EntryBy    = SessionWrapper.UserName;

                    cnt = mobjEmpBLL.InsertEmployee(entEmployee);
                    if (cnt > 0)
                    {
                        lblMessage.Text = "Record saved successfully.";
                        GetEmployee();
                        MultiView1.SetActiveView(View1);
                    }
                    else
                    {
                        lblMessage.Text = "Record Not Inserted";
                    }
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.Message;
            }
        }
Exemple #12
0
        public EntityEmployee Update(EntityEmployee model)
        {
            var data = new RepositoryEmployee().Update(model);

            return(data);
        }
Exemple #13
0
        public EntityEmployee Insert(EntityEmployee model)
        {
            var data = new RepositoryEmployee().Insert(model);

            return(data);
        }