private AuthorizationModel IsAuthorized(int employeeId, string utilityCode)
        {
            AuthorizationModel model = new AuthorizationModel();

            Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
            DataTable dtEmployee = objEmployeeMaster.EmployeeMaster_ById(new Entity.HR.EmployeeMaster()
            {
                EmployeeMasterId = employeeId
            });

            if (dtEmployee.AsEnumerable().Any())
            {
                employeeMaster = objEmployeeMaster.AuthenticateUser(dtEmployee.Rows[0]["EmployeeCode"].ToString());
            }

            if (employeeMaster != null)
            {
                string[] roles = employeeMaster.Roles.Split(',');
                model.ReturnValue = roles.Contains(utilityCode);
            }
            else
            {
                model.ReturnValue = false;
            }
            return(model);
        }
 private void EmployeeMaster_ById(int Id)
 {
     try
     {
         Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
         Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
         employeeMaster.EmployeeMasterId = Id;
         DataTable dtEmployeeMaster = objEmployeeMaster.EmployeeMaster_ById(employeeMaster);
         EmployeeMasterId      = Convert.ToInt32(dtEmployeeMaster.Rows[0]["EmployeeMasterId"].ToString());
         lblName.Text          = dtEmployeeMaster.Rows[0]["EmployeeName"].ToString();
         lblDateOfBirth.Text   = (dtEmployeeMaster.Rows[0]["DOB"] == DBNull.Value) ? string.Empty : Convert.ToDateTime(dtEmployeeMaster.Rows[0]["DOB"].ToString()).ToString("dd MMM yyyy");
         lblMobile.Text        = dtEmployeeMaster.Rows[0]["PersonalMobileNo"].ToString();
         lblPersonalEmail.Text = dtEmployeeMaster.Rows[0]["PersonalEmailId"].ToString();
         lblOfficialEmail.Text = dtEmployeeMaster.Rows[0]["OfficeEmailId"].ToString();
         lblAddress.Text       = string.Concat(dtEmployeeMaster.Rows[0]["pAddress"].ToString(), ", ", dtEmployeeMaster.Rows[0]["PermanentCity"].ToString(), ", ", dtEmployeeMaster.Rows[0]["pPIN"].ToString());
         lblDesignation.Text   = dtEmployeeMaster.Rows[0]["DesignationName"].ToString();
         lblDateOfJoining.Text = (dtEmployeeMaster.Rows[0]["DOJ"] == DBNull.Value) ? string.Empty : Convert.ToDateTime(dtEmployeeMaster.Rows[0]["DOJ"].ToString()).ToString("dd MMM yyyy");
         lblReporting.Text     = dtEmployeeMaster.Rows[0]["ReportingPersion"].ToString();
         Image1.ImageUrl       = "EmployeeImage\\" + dtEmployeeMaster.Rows[0]["Image"].ToString();
     }
     catch (Exception ex)
     {
         ex.WriteException();
         MessageBox.IsSuccess = false;
         MessageBox.Text      = ex.Message;
         MessageBox.Show      = true;
     }
 }
Example #3
0
        protected void FetchAllEmployee()
        {
            Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
            employeeMaster.CompanyId_FK = 1;
            DataTable dt = objEmployeeMaster.Employee_GetAll_Active(employeeMaster);

            if (dt != null)
            {
                ddlServiceEngineer.DataSource     = dt;
                ddlServiceEngineer.DataValueField = "EmployeeMasterId";
                ddlServiceEngineer.DataTextField  = "EmployeeName";
                ddlServiceEngineer.DataBind();
            }
            ddlServiceEngineer.InsertSelect();

            if (dt != null && dt.Rows.Count > 0)
            {
                if (!HttpContext.Current.User.IsInRole(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL))
                {
                    ddlServiceEngineer.SelectedValue = HttpContext.Current.User.Identity.Name;
                    ddlServiceEngineer.Enabled       = false;
                }
            }
        }
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateImageUpload())
                {
                    Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
                    Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster()
                    {
                        EmployeeMasterId = this.EmployeeMasterId,
                        Image            = (FileUpload1.HasFile) ? string.Concat(EmployeeMasterId.ToString(), System.IO.Path.GetExtension(FileUpload1.FileName)) : string.Empty
                    };
                    int response = objEmployeeMaster.Employee_Update(employeeMaster);
                    if (response > 0)
                    {
                        if (FileUpload1.HasFile)
                        {
                            FileUpload1.PostedFile.SaveAs(Server.MapPath(" ") + "\\EmployeeImage\\" + employeeMaster.Image);
                        }

                        MessageBox.IsSuccess = true;
                        MessageBox.Text      = "Image update successfully. Please clear browser cache to see.";
                        MessageBox.Show      = true;
                        EmployeeMaster_ById(Convert.ToInt32(HttpContext.Current.User.Identity.Name));
                    }
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();
            }
        }
        protected void Show(int Id)
        {
            Business.HR.EmployeeMaster ObjBelEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   ObjElEmployeeMaster  = new Entity.HR.EmployeeMaster();
            ObjElEmployeeMaster.EmployeeMasterId = Id;
            SqlDataReader dr = ObjBelEmployeeMaster.ViewEmployeeById(ObjElEmployeeMaster);

            while (dr.Read())
            {
                lblEmployeeName.Text         = dr["EmployeeName"].ToString();
                Image1.ImageUrl              = dr["Image"].ToString();
                lblgender.Text               = dr["GenderId"].ToString();
                lbldob.Text                  = dr["DOB"].ToString();
                lblmaratorialStatus.Text     = dr["MaritalStatus"].ToString();
                lblreligion.Text             = dr["ReligionId_FK"].ToString();
                lblBloodGroup.Text           = dr["BloodGroup"].ToString();
                lblPersonalMobileNumber.Text = dr["PersonalMobileNo"].ToString();
                lblofficialNumber.Text       = dr["OfficeMobileNo"].ToString();
                lblpersonalEmailId.Text      = dr["PersonalEmailId"].ToString();
                lblOfficeEmailId.Text        = dr["OfficeEmailId"].ToString();
                lblReferenceEmployee.Text    = dr["ReferenceEmployeeId"].ToString();
                lblpAddress.Text             = dr["pAddress"].ToString();
                lblCityName.Text             = dr["CityName"].ToString();
                lblPpin.Text                 = dr["pPIN"].ToString();
                lblDesignationName.Text      = dr["DesignationName"].ToString();
                lblDOJ.Text                  = dr["DOJ"].ToString();
                lblPANNo.Text                = dr["PANNo"].ToString();
                lbltAddress.Text             = dr["tAddress"].ToString();
                lbltCityId_FK.Text           = dr["tCityId_FK"].ToString();
                lbltPINMasterId_FK.Text      = dr["tPINMasterId_FK"].ToString();
            }
        }
Example #6
0
        protected void btnValidate_Click(object sender, EventArgs e)
        {
            try
            {
                string validationLink = string.Empty;

                Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
                DataTable dtValidate = objEmployeeMaster.ValidateForgotPassword(txtUserName.Text.Trim(), txtEmailId.Text.Trim());

                if (dtValidate != null && dtValidate.Rows.Count > 0)
                {
                    validationLink = string.Concat("EmployeeId=", dtValidate.Rows[0]["EmployeeMasterId"].ToString(), "&Email=", txtEmailId.Text.Trim(), "&UserName="******"&Timestamp=", DateTime.Now.ToFileTime(), "&Source=ForgotPassword");

                    validationLink = "http://" + HttpContext.Current.Request.Url.Authority + "/ValidateLinks.aspx?enc=" + validationLink.EncryptQueryString();

                    SendEmailValidationLink(txtEmailId.Text.Trim(), dtValidate.Rows[0]["EmployeeName"].ToString(), validationLink);
                    lblUserMessage.InnerText = "Validation link is sent to your office email id.";
                }
                else
                {
                    lblUserMessage.InnerText = "Username and Email Id not found!";
                }
            }
            catch (Exception ex)
            {
                lblUserMessage.InnerText = ex.Message;
                ex.WriteException();
            }
        }
Example #7
0
        private LoginModel AuthenticateLogin(LoginModel model)
        {
            try
            {
                model.ResponseCode = 99;
                Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
                Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
                Entity.Common.Auth         auth = new Auth();
                employeeMaster = objEmployeeMaster.AuthenticateUser(model.UserName);

                if (employeeMaster != null)
                {
                    string passowrd = employeeMaster.Password;
                    string userId   = employeeMaster.UserId.ToString();

                    if (passowrd.Equals(model.Password.Trim().EncodePasswordToBase64()))
                    {
                        model.Name         = employeeMaster.EmployeeName + " (" + employeeMaster.EmployeeCode + ")";
                        model.UserId       = Convert.ToInt32(userId);
                        model.ResponseCode = 200;
                        model.Message      = "Success";

                        auth.UserId = Convert.ToInt32(userId);
                        auth.IP     = GetIP();
                        auth.Status = Entity.Common.LoginStatus.Success;
                        auth.Client = GetClient();
                        objEmployeeMaster.Login_Save(auth);
                    }
                    else
                    {
                        model.Message = "Invalid username/password.";

                        auth.UserId         = Convert.ToInt32(userId);
                        auth.IP             = GetIP();
                        auth.Status         = Entity.Common.LoginStatus.WrongPassword;
                        auth.Client         = GetClient();
                        auth.FailedUserName = model.UserName;
                        auth.FailedPassword = model.Password;
                        objEmployeeMaster.Login_Save(auth);
                    }
                }
                else
                {
                    model.Message = "Invalid username/password.";

                    auth.IP             = GetIP();
                    auth.Status         = Entity.Common.LoginStatus.Failed;
                    auth.Client         = GetClient();
                    auth.FailedUserName = model.UserName;
                    auth.FailedPassword = model.Password;
                    objEmployeeMaster.Login_Save(auth);
                }
            }
            catch (Exception ex)
            {
                new Logger().LogException(ex, "AuthenticateLogin");
                model.Message = ex.Message;
            }
            return(model);
        }
Example #8
0
        private int Generate()
        {
            int       totalCount            = 0;
            DataTable dtLeaveConfigurations = GlobalCache.ExecuteCache <DataTable>(typeof(Business.LeaveManagement.LeaveConfiguration), "LeaveConfigurations_GetAll", new Entity.LeaveManagement.LeaveConfiguration()
            {
            });

            if (dtLeaveConfigurations != null)
            {
                if (dtLeaveConfigurations.Select("LeaveTypeId = " + ddlLeaveType.SelectedValue).Any())
                {
                    DataRow drLeaveConfiguration = dtLeaveConfigurations.Select("LeaveTypeId = " + ddlLeaveType.SelectedValue).FirstOrDefault();
                    if (drLeaveConfiguration != null)
                    {
                        //Getting all Employees
                        DataTable dtEmployees = new Business.HR.EmployeeMaster().Employee_GetAll_Active(new Entity.HR.EmployeeMaster()
                        {
                            CompanyId_FK = 1
                        });
                        //Getting all Designation wise Leave Configurations
                        DataTable dtLeaveDesignationConfigurations =
                            new Business.LeaveManagement.LeaveDesignationWiseConfiguration().LeaveDesignationConfig_GetAll(new Entity.LeaveManagement.LeaveDesignationWiseConfiguration());

                        if (dtLeaveDesignationConfigurations != null && dtLeaveDesignationConfigurations.AsEnumerable().Any())
                        {
                            foreach (DataRow drEmployee in dtEmployees.Rows)
                            {
                                //Getting Designation of each employee
                                int     designationId = Convert.ToInt32(drEmployee["DesignationMasterId"].ToString());
                                int     leaveTypeId   = Convert.ToInt32(ddlLeaveType.SelectedValue);
                                DataRow drLeaveDesignationConfiguration = dtLeaveDesignationConfigurations
                                                                          .Select("DesignationId = " + designationId + " AND LeaveTypeId = " + leaveTypeId.ToString()).FirstOrDefault();
                                if (drLeaveDesignationConfiguration != null)
                                {
                                    decimal leaveAmount = Convert.ToDecimal(drLeaveDesignationConfiguration["LeaveCount"].ToString());

                                    if (leaveAmount > 0)
                                    {
                                        Business.LeaveManagement.LeaveAccountBalance objLeaveAccountBalance = new Business.LeaveManagement.LeaveAccountBalance();
                                        int response = objLeaveAccountBalance.LeaveAccontBalance_Adjust(new Entity.LeaveManagement.LeaveAccountBalance()
                                        {
                                            LeaveTypeId = leaveTypeId,
                                            Amount      = +leaveAmount,
                                            EmployeeId  = Convert.ToInt32(drEmployee["EmployeeMasterId"].ToString()),
                                            Reason      = ddlLeaveType.SelectedItem + " IS GENERATED FOR " + ddlMonths.SelectedValue + "_" + ddlQuarters.SelectedValue + "_" + ddlHalf.SelectedValue + "_" + ddlYears.SelectedValue
                                        });
                                        if (response > 0)
                                        {
                                            totalCount++;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(totalCount);
        }
Example #9
0
        private LoginModel UserAutoLogin(LoginModel model)
        {
            try
            {
                model.ResponseCode = 99;
                Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
                Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
                Entity.Common.Auth         auth = new Auth();
                employeeMaster = objEmployeeMaster.AutoAuthenticateUserByDevice(model.DeviceId);

                if (employeeMaster != null)
                {
                    string userId = employeeMaster.UserId.ToString();

                    if (employeeMaster.IsPasswordChangeRequired)
                    {
                        model.ResponseCode = 99;
                        model.Message      = "Reset password needed. Please visit aegiscrm.in to reset password.";
                    }
                    else if (!employeeMaster.IsLoginActive)
                    {
                        model.ResponseCode = 99;
                        model.Message      = "Login blocked by admin.";
                    }
                    else
                    {
                        model.Name         = employeeMaster.EmployeeName + " (" + employeeMaster.EmployeeCode + ")";
                        model.UserId       = Convert.ToInt32(userId);
                        model.ResponseCode = 200;
                        model.Message      = "Success";

                        auth.UserId = Convert.ToInt32(userId);
                        auth.IP     = GetIP();
                        auth.Status = Entity.Common.LoginStatus.Success;
                        auth.Client = GetClient();
                        objEmployeeMaster.Login_Save(auth);
                    }
                }
                else
                {
                    model.Message = "Device not registered. Please login with username and password.";

                    auth.IP             = GetIP();
                    auth.Status         = Entity.Common.LoginStatus.Failed;
                    auth.Client         = GetClient();
                    auth.FailedUserName = model.DeviceId;
                    auth.FailedPassword = model.Password;
                    objEmployeeMaster.Login_Save(auth);
                }
            }
            catch (Exception ex)
            {
                new Logger().LogException(ex, "UserAutoLogin");
                model.Message = ex.Message;
            }
            return(model);
        }
Example #10
0
        private void EmployeeMaster_GetAll()
        {
            Business.HR.EmployeeMaster ObjBelEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   ObjElEmployeeMaster  = new Entity.HR.EmployeeMaster();
            ObjElEmployeeMaster.CompanyId_FK = 1;
            DataTable dt = ObjBelEmployeeMaster.Employee_GetAll_Active(ObjElEmployeeMaster);

            gvEmployeerMaster.DataSource = dt;
            gvEmployeerMaster.DataBind();
        }
        private void City_GetAll()
        {
            Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
            DataTable dt = objEmployeeMaster.City_GetAll();

            if (dt.Rows.Count > 0)
            {
                ddlCity.DataSource = dt;
                ddlCity.DataBind();
            }
            ddlCity.InsertSelect();
        }
Example #12
0
        private void EmployeeMaster_GetAll()
        {
            Business.HR.EmployeeMaster ObjBelEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   ObjElEmployeeMaster  = new Entity.HR.EmployeeMaster();
            ObjElEmployeeMaster.CompanyId_FK = 1;
            DataTable dt = ObjBelEmployeeMaster.Employee_GetAll_Active(ObjElEmployeeMaster);

            ddlContactPerson.DataSource     = dt;
            ddlContactPerson.DataTextField  = "EmployeeName";
            ddlContactPerson.DataValueField = "EmployeeMasterId";
            ddlContactPerson.DataBind();
            ddlContactPerson.InsertSelect();
        }
Example #13
0
        private string RegisterDevice(int employeeId, string deviceId)
        {
            string retValue = string.Empty;

            Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
            int response = objEmployeeMaster.LinkedDevices_Save(employeeId, deviceId);

            if (response > 0)
            {
                retValue = "Login succeeded.Your device is now registered with us.";
            }
            return(retValue);
        }
        private List <Models.StockSnapModel> GetStockSnaps(int employeeId, string itemName)
        {
            List <Models.StockSnapModel> model = new List <StockSnapModel>();

            Business.Inventory.Stock objStock = new Business.Inventory.Stock();
            string name = (string.IsNullOrEmpty(itemName.Trim())) ? string.Empty : itemName.Trim();

            Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
            DataTable dtEmployee = objEmployeeMaster.EmployeeMaster_ById(new Entity.HR.EmployeeMaster()
            {
                EmployeeMasterId = employeeId
            });

            if (dtEmployee.AsEnumerable().Any())
            {
                employeeMaster = objEmployeeMaster.AuthenticateUser(dtEmployee.Rows[0]["EmployeeCode"].ToString());
            }

            if (employeeMaster != null)
            {
                string[] roles = employeeMaster.Roles.Split(',');
                if (roles.Contains(Entity.HR.Utility.STOCK_LOOKUP))
                {
                    DataTable response = objStock.GetStockSnap(itemName);
                    if (response != null &&
                        response.AsEnumerable().Any())
                    {
                        foreach (DataRow dr in response.Rows)
                        {
                            model.Add(new Models.StockSnapModel
                            {
                                AssetLocationId = dr["AssetLocationId"].ToString(),
                                ItemId          = dr["ItemId"].ToString(),
                                ItemType        = dr["ItemType"].ToString(),
                                Location        = string.Format("Location: {0}", dr["Location"].ToString()),
                                Quantity        = string.Format("Quantity: {0}", dr["Quantity"].ToString()),
                                ItemName        = (Convert.ToInt32(dr["ItemType"].ToString()) == (int)ItemType.Product)
                                ? string.Format("Product Name: {0}", dr["ProductName"].ToString())
                                : string.Format("Spare Name: {0}", dr["SpareName"].ToString()),
                            });
                        }
                    }
                }
                else
                {
                }
            }

            return(model);
        }
Example #15
0
        private void EmployeeMaster_GetAll()
        {
            Business.HR.EmployeeMaster ObjBelEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   ObjElEmployeeMaster  = new Entity.HR.EmployeeMaster();
            ObjElEmployeeMaster.CompanyId_FK = 1;
            DataTable dt = ObjBelEmployeeMaster.Employee_GetAll_Active(ObjElEmployeeMaster);

            dt = dt.Select("DesignationMasterId IN (1,3)").CopyToDataTable();
            ddlEngineer.DataSource     = dt;
            ddlEngineer.DataTextField  = "EmployeeName";
            ddlEngineer.DataValueField = "EmployeeMasterId";
            ddlEngineer.DataBind();
            ddlEngineer.InsertSelect();
        }
Example #16
0
        private void LoadEmployee(DropDownList ddlAssignEngineer)
        {
            Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();

            employeeMaster.CompanyId_FK = 1;
            DataTable dt = objEmployeeMaster.Employee_GetAll_Active(employeeMaster);

            dt = dt.Select("DesignationMasterId IN (1,3)").CopyToDataTable();
            ddlAssignEngineer.DataSource     = dt;
            ddlAssignEngineer.DataTextField  = "EmployeeName";
            ddlAssignEngineer.DataValueField = "EmployeeMasterId";
            ddlAssignEngineer.DataBind();
            ddlAssignEngineer.InsertSelect();
        }
Example #17
0
        protected void EmployeeMaster_GetAll()
        {
            Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
            employeeMaster.CompanyId_FK = 1;
            DataTable dt = objEmployeeMaster.Employee_GetAll_Active(employeeMaster);

            if (dt != null)
            {
                ddlEmployee.DataSource     = dt;
                ddlEmployee.DataValueField = "EmployeeMasterId";
                ddlEmployee.DataTextField  = "EmployeeName";
                ddlEmployee.DataBind();
            }
            ddlEmployee.InsertSelect();
        }
Example #18
0
        private void DesignationMaster_GetAll()
        {
            Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
            employeeMaster.CompanyId_FK = 1;
            DataTable dt = objEmployeeMaster.DesignationMaster_GetAll(employeeMaster);

            if (dt.Rows.Count > 0)
            {
                ddlDesignation.DataSource     = dt;
                ddlDesignation.DataTextField  = "DesignationName";
                ddlDesignation.DataValueField = "DesignationMasterId";
                ddlDesignation.DataBind();
            }
            ddlDesignation.InsertSelect();
        }
Example #19
0
        protected void EmployeeMaster_GetAll()
        {
            Business.HR.EmployeeMaster ObjBelEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   ObjElEmployeeMaster  = new Entity.HR.EmployeeMaster();
            ObjElEmployeeMaster.CompanyId_FK = 1;
            DataTable dt = ObjBelEmployeeMaster.Employee_GetAll_Active(ObjElEmployeeMaster);

            dt = dt.Select("DesignationMasterId IN (1,3)").CopyToDataTable();
            if (dt.Rows.Count > 0)
            {
                gvEmployeerMaster.DataSource = dt;
            }
            else
            {
                gvEmployeerMaster.DataSource = null;
            }
            gvEmployeerMaster.DataBind();
        }
        private int LeaveApprovalDetails_Save(int leaveApplicationId)
        {
            int response = 0;

            Business.LeaveManagement.LeaveApprovalConfiguration objLeaveApprovalConfiguration = new Business.LeaveManagement.LeaveApprovalConfiguration();
            DataTable dtLeaveEmployeeWiseApprovalConfiguration = objLeaveApprovalConfiguration.LeaveEmployeeWiseApprovalConfiguration_GetAll(
                new Entity.LeaveManagement.LeaveApprovalConfiguration()
            {
                EmployeeId = Convert.ToInt32(HttpContext.Current.User.Identity.Name)
            });


            Business.LeaveManagement.LeaveApprovalDetails objLeaveApprovalDetails = new Business.LeaveManagement.LeaveApprovalDetails();
            Entity.LeaveManagement.LeaveApprovalDetails   leaveApprovalDetails    = new Entity.LeaveManagement.LeaveApprovalDetails();

            //If LeaveEmployeeWiseApprovalConfiguration is configured
            if (dtLeaveEmployeeWiseApprovalConfiguration != null &&
                dtLeaveEmployeeWiseApprovalConfiguration.AsEnumerable().Any() &&
                dtLeaveEmployeeWiseApprovalConfiguration.Select("ApprovalLevel = 1").Any())
            {
                leaveApprovalDetails.ApproverId = Convert.ToInt32(dtLeaveEmployeeWiseApprovalConfiguration.Select("ApprovalLevel = 1").FirstOrDefault()["ApproverId"].ToString());
            }
            else //If not confiured then send approval to Reporting employee
            {
                DataTable dtEmployee = new Business.HR.EmployeeMaster().EmployeeMaster_ById(new Entity.HR.EmployeeMaster()
                {
                    EmployeeMasterId = Convert.ToInt32(HttpContext.Current.User.Identity.Name)
                });
                if (dtEmployee != null && dtEmployee.AsEnumerable().Any())
                {
                    leaveApprovalDetails.ApproverId = Convert.ToInt32(dtEmployee.Rows[0]["ReportingEmployeeId"].ToString());
                }
            }
            leaveApprovalDetails.LeaveApprovalDetailId = 0;
            leaveApprovalDetails.LeaveApplicationId    = leaveApplicationId;
            leaveApprovalDetails.Status  = (int)LeaveStatusEnum.Pending;
            leaveApprovalDetails.Remarks = "APPROVAL PENDING";

            response = objLeaveApprovalDetails.LeaveApprovalDetails_Save(leaveApprovalDetails);


            return(response);
        }
        private AccountModel EmployeeMaster_ById(AccountModel model)
        {
            try
            {
                Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
                Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
                employeeMaster.EmployeeMasterId = model.UserId;
                DataTable dtEmployeeMaster = objEmployeeMaster.EmployeeMaster_ById(employeeMaster);

                model.EmployeeName = dtEmployeeMaster.Rows[0]["EmployeeName"].ToString();
                model.ImageProfile = string.Format("http://crm.aegissolutions.in/HR/EmployeeImage/{0}", dtEmployeeMaster.Rows[0]["Image"].ToString());
                model.Designation  = dtEmployeeMaster.Rows[0]["DesignationName"].ToString();
                model.ReportsTo    = dtEmployeeMaster.Rows[0]["ReportingPersion"].ToString();
                model.LoyaltyPoint = IndividualLoyalityPoint_ByEmployeeId(model.UserId).ToString();
                model.LastLogin    = GetLastLogin(model.UserId);
            }
            catch (Exception ex)
            {
                new Logger().LogException(ex, "EmployeeMaster_ById");
            }
            return(model);
        }
 protected void btnChange_Click(object sender, EventArgs e)
 {
     try
     {
         if (ValidateSave())
         {
             Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
             Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
             employeeMaster.EmployeeMasterId = (Business.Common.Context.EmployeeId == 0) ?
                                               Convert.ToInt32(HttpContext.Current.User.Identity.Name) :
                                               Business.Common.Context.EmployeeId;
             employeeMaster.Password = txtNewPassword.Text.Trim().EncodePasswordToBase64();
             int employeeId = 0;
             employeeId = objEmployeeMaster.HR_PasswordReset_Save(employeeMaster);
             if (employeeId > 0)
             {
                 lblMessage.InnerText = "Password changed.";
                 Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
                 Response.Cache.SetCacheability(HttpCacheability.NoCache);
                 Response.Cache.SetNoStore();
                 Thread.Sleep(2000);
                 System.Web.Security.FormsAuthentication.SignOut();
                 System.Web.Security.FormsAuthentication.RedirectToLoginPage();
             }
             else
             {
                 lblMessage.InnerText = "Failed to save data.";
             }
         }
     }
     catch (Exception ex)
     {
         ex.WriteException();
         lblMessage.InnerText = ex.Message;
     }
 }
Example #23
0
        private LoginModel UserLogin(LoginModel model)
        {
            try
            {
                model.ResponseCode = 99;
                Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
                Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
                Entity.Common.Auth         auth = new Auth();
                employeeMaster = objEmployeeMaster.AuthenticateUser(model.UserName);

                if (employeeMaster != null)
                {
                    string passowrd = employeeMaster.Password;
                    string userId   = employeeMaster.UserId.ToString();

                    if (passowrd.Equals(model.Password.Trim().EncodePasswordToBase64()))
                    {
                        DataTable dtDevices = objEmployeeMaster.LinkedDevices_GetByUserId(employeeMaster.UserId);
                        if (dtDevices != null && dtDevices.Rows.Count > 0)
                        {
                            model.ResponseCode = 99;
                            model.Message      = "A device is already linked with you. Please contact admin to change device.";
                        }
                        else if (employeeMaster.IsPasswordChangeRequired)
                        {
                            model.ResponseCode = 99;
                            model.Message      = "Reset password needed. Please visit aegiscrm.in to reset password.";
                        }
                        else if (!employeeMaster.IsLoginActive)
                        {
                            model.ResponseCode = 99;
                            model.Message      = "Login blocked by admin.";
                        }
                        else
                        {
                            model.Name         = employeeMaster.EmployeeName + " (" + employeeMaster.EmployeeCode + ")";
                            model.UserId       = Convert.ToInt32(userId);
                            model.ResponseCode = 200;
                            model.Message      = "Success";

                            auth.UserId = Convert.ToInt32(userId);
                            auth.IP     = GetIP();
                            auth.Status = Entity.Common.LoginStatus.Success;
                            auth.Client = GetClient();
                            objEmployeeMaster.Login_Save(auth);
                        }
                    }
                    else
                    {
                        model.Message = "Invalid username/password.";

                        auth.UserId         = Convert.ToInt32(userId);
                        auth.IP             = GetIP();
                        auth.Status         = Entity.Common.LoginStatus.WrongPassword;
                        auth.Client         = GetClient();
                        auth.FailedUserName = model.UserName;
                        auth.FailedPassword = model.Password;
                        objEmployeeMaster.Login_Save(auth);
                    }
                }
                else
                {
                    model.Message = "Invalid username/password.";

                    auth.IP             = GetIP();
                    auth.Status         = Entity.Common.LoginStatus.Failed;
                    auth.Client         = GetClient();
                    auth.FailedUserName = model.UserName;
                    auth.FailedPassword = model.Password;
                    objEmployeeMaster.Login_Save(auth);
                }
            }
            catch (Exception ex)
            {
                new Logger().LogException(ex, "UserLogin");
                model.Message = ex.Message;
            }
            return(model);
        }
        private bool LeaveApplyValidation()
        {
            if (!LeaveApplicationControlValidation())
            {
                return(false);
            }
            DataTable dtLeaveConfigurations = GlobalCache.ExecuteCache <DataTable>(typeof(Business.LeaveManagement.LeaveConfiguration), "LeaveConfigurations_GetAll", new Entity.LeaveManagement.LeaveConfiguration()
            {
            });

            Entity.LeaveManagement.LeaveApplicationMaster leaveApplicationMaster = new Entity.LeaveManagement.LeaveApplicationMaster();
            leaveApplicationMaster.RequestorId = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
            DataTable dtLeaveApplicationMaster = new Business.LeaveManagement.LeaveApplication().LeaveApplicationMaster_GetAll(leaveApplicationMaster);

            if (dtLeaveConfigurations != null && dtLeaveConfigurations.AsEnumerable().Any())
            {
                DataRow drLeaveConfiguration = dtLeaveConfigurations.Select("LeaveTypeId = " + ddlLeaveType.SelectedValue).FirstOrDefault();

                if (drLeaveConfiguration == null)
                {
                    Message.Text      = "Leave Configuration not found";
                    Message.IsSuccess = false;
                    Message.Show      = true;
                    return(false);
                }

                if (!(DateTime.Now.Date >= Convert.ToDateTime(drLeaveConfiguration["LeaveAccrueDate"].ToString())))
                {
                    Message.Text      = "Leave Not Yet Applicable";
                    Message.IsSuccess = false;
                    Message.Show      = true;
                    return(false);
                }
                if (dtLeaveApplicationMaster != null && dtLeaveApplicationMaster.AsEnumerable().Any())
                {
                    if (dtLeaveApplicationMaster.Select("LeaveStatusId = " + ((int)LeaveStatusEnum.Pending).ToString()).Any())
                    {
                        Message.Text      = "You already have leave approval pending.";
                        Message.IsSuccess = false;
                        Message.Show      = true;
                        return(false);
                    }
                }
            }
            else
            {
                Message.Text      = "Leave Configuration not found";
                Message.IsSuccess = false;
                Message.Show      = true;
                return(false);
            }

            DataTable dtEmployee = new Business.HR.EmployeeMaster().EmployeeMaster_ById(new Entity.HR.EmployeeMaster()
            {
                EmployeeMasterId = Convert.ToInt32(HttpContext.Current.User.Identity.Name)
            });

            if (dtEmployee != null && dtEmployee.AsEnumerable().Any())
            {
                if (dtEmployee.Rows[0]["ReportingEmployeeId"] == DBNull.Value)
                {
                    Message.Text      = "Please update reporting person.";
                    Message.IsSuccess = false;
                    Message.Show      = true;
                    return(false);
                }

                Entity.LeaveManagement.LeaveDesignationWiseConfiguration leaveDesignationWiseConfiguration = new Entity.LeaveManagement.LeaveDesignationWiseConfiguration();
                leaveDesignationWiseConfiguration.LeaveTypeId   = Convert.ToInt32(ddlLeaveType.SelectedValue);
                leaveDesignationWiseConfiguration.DesignationId = Convert.ToInt32(dtEmployee.Rows[0]["DesignationMasterId_FK"].ToString());
                DataTable dtLeaveDesignationConfiguration = new Business.LeaveManagement.LeaveDesignationWiseConfiguration().LeaveDesignationConfig_GetAll(leaveDesignationWiseConfiguration);
                if (dtLeaveDesignationConfiguration != null && dtLeaveDesignationConfiguration.AsEnumerable().Any())
                {
                    decimal totalDays = Convert.ToDecimal(lbTotalCount.Text.Trim());
                    if (totalDays < Convert.ToDecimal(dtLeaveDesignationConfiguration.Rows[0]["MinApplyDays"].ToString()))
                    {
                        Message.Text      = "Min leave should be more than " + dtLeaveDesignationConfiguration.Rows[0]["MinApplyDays"].ToString() + " days";
                        Message.IsSuccess = false;
                        Message.Show      = true;
                        return(false);
                    }
                    else if (totalDays > Convert.ToDecimal(dtLeaveDesignationConfiguration.Rows[0]["MaxApplyDays"].ToString()))
                    {
                        Message.Text      = "Max leave should be less than " + dtLeaveDesignationConfiguration.Rows[0]["MaxApplyDays"].ToString() + " days";
                        Message.IsSuccess = false;
                        Message.Show      = true;
                        return(false);
                    }

                    //if (Convert.ToDecimal(lbTotalCount.Text.Trim()) > Convert.ToDecimal(dtLeaveDesignationConfiguration.Rows[0]["LeaveCount"].ToString()))
                    //{
                    //    Message.Text = "Maximum Leave you can apply is " + dtLeaveDesignationConfiguration.Rows[0]["LeaveCount"].ToString() + " days in a year";
                    //    Message.IsSuccess = false;
                    //    Message.Show = true;
                    //    return false;
                    //}
                }
                else
                {
                    Message.Text      = "Leave designation configuration not found";
                    Message.IsSuccess = false;
                    Message.Show      = true;
                    return(false);
                }


                DataTable dtLeaveAccountBalance = new Business.LeaveManagement.LeaveAccountBalance().LeaveAccountBalance_ByEmployeeId(Convert.ToInt32(HttpContext.Current.User.Identity.Name), Convert.ToInt32(ddlLeaveType.SelectedValue)).Tables[0];
                if (dtLeaveAccountBalance != null && dtLeaveAccountBalance.AsEnumerable().Any())
                {
                    if (Convert.ToInt32(lbTotalCount.Text.Trim()) > Convert.ToDecimal(dtLeaveAccountBalance.Rows[0]["Amount"].ToString()))
                    {
                        Message.Text      = "Your Leave Balance is low.";
                        Message.IsSuccess = false;
                        Message.Show      = true;
                        return(false);
                    }
                    if (Convert.ToBoolean(dtLeaveAccountBalance.Rows[0]["LeaveBlocked"].ToString()))
                    {
                        Message.Text      = "Your leaves are blocked. Please contact to HR.";
                        Message.IsSuccess = false;
                        Message.Show      = true;
                        return(false);
                    }
                }
                else
                {
                    Message.Text      = "You do not have any Leave Balance.";
                    Message.IsSuccess = false;
                    Message.Show      = true;
                    return(false);
                }

                //Checking leave date overlapping
                DataTable dtLeaveApplicationDetails = new Business.LeaveManagement.LeaveApplication().LeaveApplicationDetails_GetByDate(new Entity.LeaveManagement.LeaveApplicationMaster()
                {
                    RequestorId   = Convert.ToInt32(HttpContext.Current.User.Identity.Name),
                    FromLeaveDate = Convert.ToDateTime(lbFromDate.Text.Trim()),
                    ToLeaveDate   = Convert.ToDateTime(lbToDate.Text.Trim()),
                    LeaveStatuses = Convert.ToString((int)LeaveStatusEnum.Approved) + "," + Convert.ToString((int)LeaveStatusEnum.Pending)
                });
                if (dtLeaveApplicationDetails != null && dtLeaveApplicationDetails.AsEnumerable().Any())
                {
                    Message.Text      = "Your leave dates are overlapping. Please check your Approved/Pending list.";
                    Message.IsSuccess = false;
                    Message.Show      = true;
                    return(false);
                }

                if (!string.IsNullOrEmpty(hdnHalfDayList.Value.Replace(',', ' ').Trim()))
                {
                    if (!(ddlLeaveType.SelectedValue == ((int)LeaveTypeEnum.CL).ToString()) && !(ddlLeaveType.SelectedValue == ((int)LeaveTypeEnum.LWP).ToString()))
                    {
                        Message.Text      = "You cannot apply half day with leave type " + ddlLeaveType.SelectedItem.Text;
                        Message.IsSuccess = false;
                        Message.Show      = true;
                        return(false);
                    }
                }
            }
            else
            {
                Message.Text      = "Employee Details not found.";
                Message.IsSuccess = false;
                Message.Show      = true;
                return(false);
            }
            return(true);
        }
        private void UserLogin()
        {
            try
            {
                Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
                Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
                Entity.Common.Auth         auth = new Auth();
                employeeMaster = objEmployeeMaster.AuthenticateUser(txtUserName.Text);

                if (employeeMaster != null)
                {
                    string passowrd = employeeMaster.Password;
                    string userId   = employeeMaster.UserId.ToString();
                    if (employeeMaster.IsActive && passowrd.Equals(txtPassword.Text.Trim().EncodePasswordToBase64()))
                    {
                        if (employeeMaster.IsLoginActive)
                        {
                            string roles        = employeeMaster.Roles;
                            string userSettings = new Business.Settings.UserSettings().GetByUserId(Convert.ToInt32(userId)).Tables[0].Rows[0]["UserSettings"].ToString();
                            roles = string.Concat(roles, userSettings);
                            Business.Common.Context.Username   = employeeMaster.EmployeeName;
                            Business.Common.Context.Image      = employeeMaster.Image;
                            Business.Common.Context.UserGender = employeeMaster.GenderId;


                            FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
                                1,
                                userId,
                                DateTime.Now,
                                DateTime.Now.AddHours(2),
                                false,
                                roles,                                            //define roles here
                                "/");
                            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(authTicket));
                            Response.Cookies.Add(cookie);

                            auth.UserId = Convert.ToInt32(userId);
                            auth.IP     = GetIP();
                            auth.Status = Entity.Common.LoginStatus.Success;
                            auth.Client = GetClient();
                            objEmployeeMaster.Login_Save(auth);
                            if (employeeMaster.IsPasswordChangeRequired)
                            {
                                Response.Redirect(@"ResetPassword.aspx");
                            }
                            else
                            {
                                Response.Redirect(@"Dashboard.aspx");
                            }
                        }
                        else
                        {
                            lblUserMessage.InnerHtml = "Login blocked by admin.";
                            lblUserMessage.Visible   = true;
                        }
                    }
                    else
                    {
                        auth.UserId         = Convert.ToInt32(userId);
                        auth.IP             = GetIP();
                        auth.Status         = Entity.Common.LoginStatus.WrongPassword;
                        auth.Client         = GetClient();
                        auth.FailedUserName = txtUserName.Text;
                        auth.FailedPassword = txtPassword.Text;
                        objEmployeeMaster.Login_Save(auth);
                        lblUserMessage.InnerHtml = "Invalid Username/Password";
                        lblUserMessage.Visible   = true;
                    }
                }
                else
                {
                    auth.IP             = GetIP();
                    auth.Status         = Entity.Common.LoginStatus.Failed;
                    auth.Client         = GetClient();
                    auth.FailedUserName = txtUserName.Text;
                    auth.FailedPassword = txtPassword.Text;
                    objEmployeeMaster.Login_Save(auth);
                    lblUserMessage.InnerHtml = "Invalid Username/Password";
                    lblUserMessage.Visible   = true;
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();
                lblUserMessage.InnerHtml = "Invalid Username/Password";
                lblUserMessage.Visible   = true;
            }
        }
        private bool ClaimAddValidation()
        {
            int       designationId = 0;
            DataTable dtEmployee    = new Business.HR.EmployeeMaster().EmployeeMaster_ById(new EmployeeMaster()
            {
                EmployeeMasterId = Convert.ToInt32(HttpContext.Current.User.Identity.Name)
            });

            if (dtEmployee != null && dtEmployee.AsEnumerable().Any())
            {
                designationId = Convert.ToInt32(dtEmployee.Rows[0]["DesignationMasterId_FK"].ToString());
            }
            else
            {
                Message.IsSuccess = false;
                Message.Text      = "Employee details not found!  Contact administrator.";
                Message.Show      = true;
                return(false);
            }
            DataTable dtClaimDesignationWiseConfiguration = GlobalCache.ExecuteCache <DataTable>(typeof(Business.ClaimManagement.ClaimDesignationWiseConfiguration), "ClaimDesignationConfig_GetAllCached", new Entity.ClaimManagement.ClaimDesignationWiseConfiguration());

            if (dtClaimDesignationWiseConfiguration != null && dtClaimDesignationWiseConfiguration.AsEnumerable().Any())
            {
                using (DataView dvClaimDesignationWiseConfiguration = new DataView(dtClaimDesignationWiseConfiguration))
                {
                    dvClaimDesignationWiseConfiguration.RowFilter = "DesignationId = " + designationId + " AND ClaimCategoryId = " + ddlCategory.SelectedValue + "";
                    dtClaimDesignationWiseConfiguration           = dvClaimDesignationWiseConfiguration.ToTable();
                }
            }
            else
            {
                Message.IsSuccess = false;
                Message.Text      = "Claim configuration for your designation not found! Contact administrator.";
                Message.Show      = true;
                return(false);
            }
            if (dtClaimDesignationWiseConfiguration != null && dtClaimDesignationWiseConfiguration.AsEnumerable().Any())
            {
                decimal totalCost = Convert.ToDecimal(txtCost.Text);

                if (_ClaimDetails != null && _ClaimDetails.AsEnumerable().Any())
                {
                    using (DataView dvClaimDetails = new DataView(_ClaimDetails))
                    {
                        dvClaimDetails.RowFilter = "CategoryId = " + ddlCategory.SelectedValue;
                        if (dvClaimDetails.ToTable() != null && dvClaimDetails.ToTable().AsEnumerable().Any())
                        {
                            totalCost += Convert.ToDecimal(dvClaimDetails.ToTable().Compute("SUM(Cost)", string.Empty));
                        }
                    }
                }
                if (totalCost > Convert.ToDecimal(dtClaimDesignationWiseConfiguration.Rows[0]["Limit"].ToString()))
                {
                    Message.IsSuccess = false;
                    Message.Text      = "Your claim limit exceeded.";
                    Message.Show      = true;
                    return(false);
                }
            }
            else
            {
                Message.IsSuccess = false;
                Message.Text      = "Claim configuration for your designation not found! Contact administrator.";
                Message.Show      = true;
                return(false);
            }

            return(true);
        }
        private List <Models.TonerModel> GetToner(int employeeId)
        {
            List <Models.TonerModel> model = new List <Models.TonerModel>();

            Business.Service.TonerRequest objTonnerRequest = new Business.Service.TonerRequest();

            Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
            DataTable dtEmployee = objEmployeeMaster.EmployeeMaster_ById(new Entity.HR.EmployeeMaster()
            {
                EmployeeMasterId = employeeId
            });

            if (dtEmployee.AsEnumerable().Any())
            {
                employeeMaster = objEmployeeMaster.AuthenticateUser(dtEmployee.Rows[0]["EmployeeCode"].ToString());
            }

            int assignEngineer = 0;

            if (employeeMaster != null)
            {
                string[] roles = employeeMaster.Roles.Split(',');
                if (roles.Contains(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL))
                {
                    assignEngineer = 0;
                }
                else
                {
                    assignEngineer = employeeId;
                }
            }

            string callStatusIds = string.Empty;

            callStatusIds = string.Concat(((int)CallStatusType.TonerOpenForApproval).ToString(),
                                          ",",
                                          ((int)CallStatusType.TonerRequestInQueue).ToString(),
                                          ",",
                                          ((int)CallStatusType.TonerResponseGiven).ToString());

            DataTable response = objTonnerRequest.Service_Toner_GetByCallStatusIds(callStatusIds, assignEngineer);

            if (response != null &&
                response.AsEnumerable().Any())
            {
                foreach (DataRow dr in response.Rows)
                {
                    model.Add(new Models.TonerModel
                    {
                        CallStatus    = string.Format("Call Status: {0}", dr["CallStatus"].ToString()),
                        ContactPerson = string.Format("Contact Person: {0}", dr["ContactPerson"].ToString()),
                        CustomerName  = string.Format("Customer Name: {0}", dr["CustomerName"].ToString()),
                        TonerDateTime = string.Format("Toner Date & Time: {0}", Convert.ToDateTime(dr["RequestDate"].ToString()).ToString("dd MMM yyyy")),
                        TonerNo       = string.Format("Toner No: {0}", dr["TonnerRequestId"].ToString()),
                        ProductName   = string.Format("Product Name: {0}", dr["ProductName"].ToString())
                    });
                }
            }

            return(model);
        }
 private void EmployeeWorkReport()
 {
     Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
     gvEmployeeWorkReport.DataSource = objEmployeeMaster.EmployeeWorkReport(Convert.ToDateTime(txtFromDate.Text.Trim()), Convert.ToDateTime(txtToDate.Text.Trim()));
     gvEmployeeWorkReport.DataBind();
 }
        private List <Models.DocketModel> GetDocket(int employeeId)
        {
            List <Models.DocketModel> model = new List <Models.DocketModel>();

            Business.Service.Docket objDocket = new Business.Service.Docket();
            Entity.Service.Docket   docket    = new Entity.Service.Docket();

            Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
            Entity.HR.EmployeeMaster   employeeMaster    = new Entity.HR.EmployeeMaster();
            DataTable dtEmployee = objEmployeeMaster.EmployeeMaster_ById(new Entity.HR.EmployeeMaster()
            {
                EmployeeMasterId = employeeId
            });

            if (dtEmployee.AsEnumerable().Any())
            {
                employeeMaster = objEmployeeMaster.AuthenticateUser(dtEmployee.Rows[0]["EmployeeCode"].ToString());
            }

            int assignEngineer = 0;

            if (employeeMaster != null)
            {
                string[] roles = employeeMaster.Roles.Split(',');
                if (roles.Contains(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL))
                {
                    assignEngineer = 0;
                }
                else
                {
                    assignEngineer = employeeId;
                }
            }

            string callStatusIds = string.Empty;

            callStatusIds         = string.Concat(((int)CallStatusType.DocketClose).ToString(), ",", ((int)CallStatusType.DocketFunctional).ToString());//DOCKET CLOSE && FUNCTIONAL
            docket.CallStatusIds  = callStatusIds;
            docket.AssignEngineer = assignEngineer;

            DataTable response = objDocket.Service_Docket_GetAllByCallStatusIds(docket);

            if (response != null &&
                response.AsEnumerable().Any())
            {
                foreach (DataRow dr in response.Rows)
                {
                    model.Add(new Models.DocketModel
                    {
                        AssignedEngineerName = string.Format("Assigned Engineer: {0}", dr["AssignedEngineerName"].ToString()),
                        CallStatus           = string.Format("Call Status: {0}", dr["CallStatus"].ToString()),
                        ContactPerson        = string.Format("Contact Person: {0}", dr["ContactPerson"].ToString()),
                        CustomerName         = string.Format("Customer Name: {0}", dr["CustomerName"].ToString()),
                        DocketDateTime       = string.Format("Docket Date & Time: {0}", Convert.ToDateTime(dr["DocketDate"].ToString()).ToString("dd MMM yyyy")),
                        DocketNo             = string.Format("Docket No: {0}", dr["DocketId"].ToString()),
                        IsCallAttended       = string.Format("Call Attended: {0}", (dr["IsCallAttended"].ToString().Equals("1")) ? "True" : "False"),
                        ProductName          = string.Format("Product Name: {0}", dr["ProductName"].ToString())
                    });
                }
            }

            return(model);
        }