Beispiel #1
0
        private List <SelectListItem> GetLeaveType()
        {
            MTSHRDataLayer.Leave  data      = new MTSHRDataLayer.Leave();
            List <SelectListItem> leavetype = new List <SelectListItem>();

            try
            {
                DataTable leavenamelist = data.ReadLeavePolicy();
                leavetype.Add(new SelectListItem()
                {
                    Value = "", Text = "---- Select Leave type----"
                });
                for (int i = 0; i < leavenamelist.Rows.Count; i++)
                {
                    leavetype.Add(new SelectListItem()
                    {
                        Value = leavenamelist.Rows[i]["LEAVE_CODE"].ToString(), Text = leavenamelist.Rows[i]["LEAVE_TYPE"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(leavetype);
        }
        private List <SelectListItem> GetVendorName()
        {
            MTSHRDataLayer.Vendors data_Ass  = new MTSHRDataLayer.Vendors();
            List <SelectListItem>  Assetlist = new List <SelectListItem>();

            try
            {
                var Vendor = data_Ass.ReadVendorName();
                Assetlist.Add(new SelectListItem()
                {
                    Value = "", Text = "---- Select Vendor Name----"
                });
                for (int i = 0; i < Vendor.Tables[0].Rows.Count; i++)
                {
                    Assetlist.Add(new SelectListItem()
                    {
                        Value = Vendor.Tables[0].Rows[i]["ID"].ToString(), Text = Vendor.Tables[0].Rows[i]["NAME"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(Assetlist);
        }
Beispiel #3
0
        private List <SelectListItem> getmaritalstatus()
        {
            MTSHRDataLayer.Employee data_emp      = new MTSHRDataLayer.Employee();
            List <SelectListItem>   maritalstatus = new List <SelectListItem>();

            try
            {
                var employeemaritalstatus = data_emp.getMaritalstatus();
                maritalstatus.Add(new SelectListItem()
                {
                    Value = "", Text = "---- Select Marital Status----"
                });
                for (int i = 0; i < employeemaritalstatus.Tables[0].Rows.Count; i++)
                {
                    maritalstatus.Add(new SelectListItem()
                    {
                        Value = employeemaritalstatus.Tables[0].Rows[i]["id"].ToString(), Text = employeemaritalstatus.Tables[0].Rows[i]["Marital_status"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }

            return(maritalstatus);
        }
        public JsonResult AssetName(Int64 Id)
        {
            MTSHRDataLayer.AssetMaintenanceDetails data_asset_name = new MTSHRDataLayer.AssetMaintenanceDetails();
            List <SelectListItem> Assetnamelist = new List <SelectListItem>();

            try
            {
                var Assetname = data_asset_name.GetSpecificAsset(Id);
                Assetnamelist.Add(new SelectListItem()
                {
                    Value = "", Text = "---- Select Category----"
                });
                for (int i = 0; i < Assetname.Rows.Count; i++)
                {
                    Assetnamelist.Add(new SelectListItem()
                    {
                        Value = Assetname.Rows[i]["Id"].ToString(), Text = Assetname.Rows[i]["AssetName"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            ViewBag.Assetname = Assetnamelist;

            return(Json(new { success = true, AssetList = JsonConvert.SerializeObject(Assetnamelist) }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetAllLeaveType(Int64 empid)
        {
            // string empid = Session["UserID"].ToString();
            //string department = Session["DepartmentId"].ToString();
            //Int64 id = Convert.ToInt64(empid);
            //Int64 departmentid = Convert.ToInt64(department);
            MTSHRDataLayer.EmployeeLeave LeaveTypedata = new MTSHRDataLayer.EmployeeLeave();
            var LeaveTypes = LeaveTypedata.GetAllLeaveType(empid);
            List <SelectListItem> LeaveTypelist = new List <SelectListItem>();

            try
            {
                LeaveTypelist.Add(new SelectListItem()
                {
                    Value = "0", Text = "----Select LeaveType----"
                });
                for (int i = 0; i < LeaveTypes.Tables[0].Rows.Count; i++)
                {
                    LeaveTypelist.Add(new SelectListItem()
                    {
                        Value = LeaveTypes.Tables[0].Rows[i]["id"].ToString(), Text = LeaveTypes.Tables[0].Rows[i]["LeaveType"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            ViewBag.LeaveTypes = LeaveTypelist;
            // return LeaveTypelist;
            return(Json(new { success = true, LeaveList = JsonConvert.SerializeObject(LeaveTypelist) }, JsonRequestBehavior.AllowGet));
        }
        private List <SelectListItem> GetAssetName()
        {
            MTSHRDataLayer.Asset  data_Ass      = new MTSHRDataLayer.Asset();
            List <SelectListItem> Assetnamelist = new List <SelectListItem>();

            try
            {
                var Assetname = data_Ass.ReadAssetNames();
                Assetnamelist.Add(new SelectListItem()
                {
                    Value = "", Text = "---- Select Category----"
                });
                for (int i = 0; i < Assetname.Rows.Count; i++)
                {
                    Assetnamelist.Add(new SelectListItem()
                    {
                        Value = Assetname.Rows[i]["Id"].ToString(), Text = Assetname.Rows[i]["Assetname"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(Assetnamelist);
        }
        public ActionResult ViewDocuments()
        {
            try
            {
                ViewBag.Documents = TempData["Documents"];
                TempData.Keep("Documents");
                ViewBag.Image     = TempData["image"];
                ViewBag.Imagename = TempData["imagename"];
                string Imagename = TempData["imagename"].ToString();
                string ext       = Path.GetExtension(Imagename);


                if (ext == ".png")
                {
                    var imagefile = Convert.FromBase64String(TempData["image"].ToString());
                    return(this.File(imagefile, "image/" + ext, Imagename));
                }
                else
                {
                    var imagefile = Convert.FromBase64String(TempData["image"].ToString());
                    return(this.File(imagefile, "image/" + ext, Imagename));
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(View("ShowAllPolicies"));
        }
        public JsonResult GetLocationDetails(Int64 id)
        {
            MTSHRDataLayer.AssignAsset data_location_details = new MTSHRDataLayer.AssignAsset();
            List <SelectListItem>      locationDetailList    = new List <SelectListItem>();

            try
            {
                var LocationDetail = data_location_details.GetLocationDetails(id);
                locationDetailList.Add(new SelectListItem()
                {
                    Value = "", Text = "---- Select Location Details----"
                });
                for (int i = 0; i < LocationDetail.Rows.Count; i++)
                {
                    locationDetailList.Add(new SelectListItem()
                    {
                        Value = LocationDetail.Rows[i]["PLACE_ID"].ToString(), Text = LocationDetail.Rows[i]["PLACE_NAME"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            ViewBag.LocationDetails = locationDetailList;

            return(Json(new { success = true, LocationDetailList = JsonConvert.SerializeObject(locationDetailList) }, JsonRequestBehavior.AllowGet));
        }
        private List <SelectListItem> GetAsset()
        {
            MTSHRDataLayer.Asset  data_Ass  = new MTSHRDataLayer.Asset();
            List <SelectListItem> Assetlist = new List <SelectListItem>();

            try
            {
                var Asset = data_Ass.ReadCategory();
                Assetlist.Add(new SelectListItem()
                {
                    Value = "", Text = "---- Select Asset Classification----"
                });
                for (int i = 0; i < Asset.Tables[0].Rows.Count; i++)
                {
                    Assetlist.Add(new SelectListItem()
                    {
                        Value = Asset.Tables[0].Rows[i]["CategoryId"].ToString(), Text = Asset.Tables[0].Rows[i]["CategoryName"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(Assetlist);
        }
Beispiel #10
0
        public JsonResult GetEvaluatorsList()
        {
            DataSet ds = new DataSet();

            MTSHRDataLayer.Appraisal data = new MTSHRDataLayer.Appraisal();
            try
            {
                ds = data.GetEvaluatorsList();
                if (ds != null)
                {
                    return(Json(new
                    {
                        success = true,
                        result = JsonConvert.SerializeObject(ds.Tables[0]),
                        result1 = JsonConvert.SerializeObject(ds.Tables[1])
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { success = false }));
                }
            }
            catch (Exception ex)
            {
                BaseExceptionHandler.HandleException(ref ex);
            }

            return(Json(new { success = false }));
        }
Beispiel #11
0
        public ActionResult SkipManagersToEmployee(string EmployeeIdlist, string AppraisalProcessId = "")
        {
            Int64 result = 0;

            MTSHRDataLayer.PerformanceAppraisal data = new MTSHRDataLayer.PerformanceAppraisal();
            try
            {
                string[] IdList = EmployeeIdlist.Split(',');

                if (IdList != null && IdList.Length > 0)
                {
                    for (int int_i = 0; int_i < IdList.Length; int_i++)
                    {
                        result = data.SkipManagersToEmployee(Convert.ToInt64(IdList[int_i]), AppraisalProcessId == "" ? (Int64?)0 : Convert.ToInt64(AppraisalProcessId));
                    }
                }
                if (result > 0)
                {
                    result = 1;
                }
                else
                {
                    result = 0;
                }
            }
            catch (Exception e)
            {
                BaseExceptionHandler.HandleException(ref e);
            }
            return(Json(new { result = result }));
        }
Beispiel #12
0
        private List <SelectListItem> getFunctionalRole()
        {
            MTSHRDataLayer.Designation data_role      = new MTSHRDataLayer.Designation();
            List <SelectListItem>      FunctionalRole = new List <SelectListItem>();

            try
            {
                var employeeFunctionalRole = data_role.Read_FunctionalRole();
                FunctionalRole.Add(new SelectListItem()
                {
                    Value = "", Text = "----Select Functional Role----"
                });
                for (int i = 0; i < employeeFunctionalRole.Rows.Count; i++)
                {
                    FunctionalRole.Add(new SelectListItem()
                    {
                        Value = employeeFunctionalRole.Rows[i]["id"].ToString(), Text = employeeFunctionalRole.Rows[i]["Role_Name"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }

            return(FunctionalRole);
        }
Beispiel #13
0
        public ActionResult EditEmployee(Employee emp)
        {
            try
            {
                MTSHRDataLayer.Employee data_emp = new MTSHRDataLayer.Employee();
                data_emp.UpdateEmployeeLeavePolicy(emp.id, emp.DepartmentId);
                Int64 result = data_emp.Edit(emp.Aadhar, emp.Dateofbirth, emp.Dateofjoin, emp.Designation, emp.DepartmentId, emp.Email, emp.Employee_ID, emp.Fathername, emp.Firstname, emp.Gender, emp.id, emp.Lastname, emp.Maritalstatus, emp.Mobile, emp.Nationality, emp.Pancard, emp.Spousename, emp.PF_AccountNumber, emp.PF_UAN, emp.ESI_Number, emp.FunctionalRole);

                if (result >= 1)
                {
                    TempData["employeeid"] = result;
                    TempData.Keep("employeeid");
                    return(Content("EditSuccess"));
                }
                else
                {
                    return(Content("Failed"));
                }
            }
            catch (Exception ex)
            {
                BaseExceptionHandler.HandleException(ref ex);
            }
            return(Content("Failed"));
        }
Beispiel #14
0
        public ActionResult ViewDocuments()
        {
            try
            {
                ViewBag.Documents = TempData["Documents"];
                TempData.Keep("Documents");
                ViewBag.Image     = TempData["image"];
                ViewBag.Imagename = TempData["imagename"];
                string Imagename = TempData["imagename"].ToString();
                //   string checkfunction = TempData["functiontype"].ToString();
                //   TempData.Keep("functiontype");
                string ext = Path.GetExtension(Imagename);


                if (ext == ".pdf")
                {
                    var imagefile = Convert.FromBase64String(TempData["image"].ToString());
                    // return this.File(imagefile, "image/" + ext, Imagename);
                    return(new FileStreamResult(new MemoryStream(imagefile), ext));
                }
                else
                {
                    return(View("ViewImage"));
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(View("ViewImage"));
        }
Beispiel #15
0
        private List <SelectListItem> getnationality()
        {
            MTSHRDataLayer.Employee data_emp    = new MTSHRDataLayer.Employee();
            List <SelectListItem>   nationality = new List <SelectListItem>();

            try
            {
                var employeenationality = data_emp.getNationality();
                nationality.Add(new SelectListItem()
                {
                    Value = "", Text = "----Select Nationality----"
                });
                for (int i = 0; i < employeenationality.Tables[0].Rows.Count; i++)
                {
                    nationality.Add(new SelectListItem()
                    {
                        Value = employeenationality.Tables[0].Rows[i]["id"].ToString(), Text = employeenationality.Tables[0].Rows[i]["Nationality"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }

            return(nationality);
        }
Beispiel #16
0
        ////public List<SelectListItem> GetAllLocation()
        ////{
        ////    List<SelectListItem> LocationList = new List<SelectListItem>();
        ////    try
        ////    {
        ////        string empid = Session["UserID"].ToString();

        ////        MTSHRDataLayer.Asset _data = new MTSHRDataLayer.Asset();
        ////        var LocationNames = _data.ReadLocation();

        ////        LocationList.Add(new SelectListItem() { Value = "", Text = "----Select Location----" });
        ////        for (int i = 0; i < LocationNames.Rows.Count; i++)
        ////        {
        ////            LocationList.Add(new SelectListItem() { Text = LocationNames.Rows[i]["LocationName"].ToString(), Value = LocationNames.Rows[i]["LocationId"].ToString() });
        ////        }
        ////    }
        ////    catch (Exception exec)
        ////    {
        ////        BaseExceptionHandler.HandleException(ref exec);
        ////    }
        ////    return LocationList;
        //}
        public List <SelectListItem> GetAllVendorNames()
        {
            List <SelectListItem> VendorList = new List <SelectListItem>();

            try
            {
                string empid = Session["UserID"].ToString();

                MTSHRDataLayer.Asset _data = new MTSHRDataLayer.Asset();
                var VendorNames            = _data.ReadVendorNames();

                VendorList.Add(new SelectListItem()
                {
                    Value = "", Text = "----Select Vendor----"
                });
                for (int i = 0; i < VendorNames.Rows.Count; i++)
                {
                    VendorList.Add(new SelectListItem()
                    {
                        Text = VendorNames.Rows[i]["Name"].ToString(), Value = VendorNames.Rows[i]["Id"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(VendorList);
        }
Beispiel #17
0
        public List <SelectListItem> GetAllEmployeeNames()
        {
            List <SelectListItem> EmployeeNameList = new List <SelectListItem>();

            try
            {
                string empid = Session["UserID"].ToString();
                //string empName = String.Format("{0} {1}", Session["FirstName"].ToString(), Session["LastName"].ToString());
                MTSHRDataLayer.EmployeeLeave EmployeeNamedata = new MTSHRDataLayer.EmployeeLeave();
                var EmployeeNames = EmployeeNamedata.GetAllEmployeeNames();
                EmployeeNameList.Add(new SelectListItem()
                {
                    Value = "", Text = "----Select Employee----"
                });
                for (int i = 0; i < EmployeeNames.Tables[0].Rows.Count; i++)
                {
                    string ID = EmployeeNames.Tables[0].Rows[i]["id"].ToString();
                    EmployeeNameList.Add(new SelectListItem()
                    {
                        Text = EmployeeNames.Tables[0].Rows[i]["EmployeeName"].ToString(), Value = ID
                    });
                }
                //EmployeeNameList.RemoveAt(EmployeeNameList.IndexOf(new SelectListItem() { Value = empid, Text = empName }));
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(EmployeeNameList);
        }
Beispiel #18
0
 public ActionResult ImageFiles(AssetsEntry _asset)
 {
     try
     {
         var docname = Request.Params["docname"].ToString();
         if (Request.Files.Count > 0)
         {
             var    file     = Request.Files[0];
             string FileName = file.FileName;
             if (file != null && file.ContentLength > 0)
             {
                 BinaryReader            reader   = new BinaryReader(file.InputStream);
                 MTSHRDataLayer.Policies data_doc = new MTSHRDataLayer.Policies();
                 byte[] bytes  = reader.ReadBytes((int)file.ContentLength);
                 int    result = data_doc.Create(docname, bytes, FileName);
                 return(Content("Success"));
             }
         }
     }
     catch (Exception exec)
     {
         BaseExceptionHandler.HandleException(ref exec);
     }
     return(Content("Failed"));
 }
        public JsonResult GetAllEmployeeLeaveList(Leave le)
        {
            try
            {
                MTSHRDataLayer.EmployeeLeave data_leaves = new MTSHRDataLayer.EmployeeLeave();

                DataTable dt = new DataTable();
                dt = data_leaves.GetAllEmployeeLeaveList(le.FromDate, le.ToDate, le.EmployeeName);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DateTime startdate = Convert.ToDateTime(dt.Rows[i]["FromDate"]);
                    DateTime enddate   = Convert.ToDateTime(dt.Rows[i]["ToDate"]);

                    List <DateTime> alldate = returnalldates(startdate, enddate);
                }

                return(Json(JsonConvert.SerializeObject(data_leaves.GetAllEmployeeLeaveList(le.FromDate, le.ToDate, le.EmployeeName))));
            }
            catch (Exception ex)
            {
                BaseExceptionHandler.HandleException(ref ex);
            }
            return(Json(new { success = true }));
        }
Beispiel #20
0
        public int ResetEmployeePassword(Employee emp)
        {
            int result = 0;

            try
            {
                UserLogonData userLogon = new UserLogonData();
                Encrypt       encrypt   = new Encrypt();
                string        password  = encrypt.CreateRandomPassword(6);
                string        hashPwd   = encrypt.GetSHA1HashData(password);
                string        shapwd    = encrypt.GetSHA1HashData(hashPwd + emp.id);


                //Get Paremeters from the Database
                //Status=1, initial status when user created.
                string TemplateId = "3";
                string SpName     = emp.Email + "," + emp.Firstname + "," + emp.Lastname + "," + password;

                DbCommand DCMD = DataAccess.ExecuteNonQueryCMD("MTS_AddEmailMasterEntry", TemplateId, SpName);
                result = userLogon.ForgotPassword(emp.id, shapwd);
            }
            catch (Exception ex)
            {
                BaseExceptionHandler.HandleException(ref ex);
            }
            return(result);
        }
Beispiel #21
0
        public ActionResult RemoveEmployeeMappingDetails(Int64 status, Int64 weightage, Int64 rowID)
        {
            //Int64 result = 0;
            //MTSHRDataLayer.Appraisal data = new MTSHRDataLayer.Appraisal();
            //var Mapping_Detail = data.RemoveEmployeeMappingDetails(EmpId);
            //return Json(new { success = true, result1 = JsonConvert.SerializeObject(Mapping_Detail) }, JsonRequestBehavior.AllowGet);

            Int64 result = 0;

            MTSHRDataLayer.Appraisal data = new MTSHRDataLayer.Appraisal();
            try
            {
                result = data.RemoveEmployeeMappingDetails(status, weightage, rowID);
                if (status == 1)
                {
                    result = 1;
                }
                else if (status == 2)
                {
                    result = 2;
                }
                else
                {
                    result = 0;
                }
            }
            catch (Exception e)
            {
                BaseExceptionHandler.HandleException(ref e);
            }
            return(Json(new { result = result }));
        }
Beispiel #22
0
        private List <SelectListItem> getdepartment()
        {
            MTSHRDataLayer.Employee data_dep       = new MTSHRDataLayer.Employee();
            List <SelectListItem>   departmentlist = new List <SelectListItem>();

            try
            {
                var employeeDepartment = data_dep.getDepartment();
                departmentlist.Add(new SelectListItem()
                {
                    Value = "", Text = "---- Select Department----"
                });
                for (int i = 0; i < employeeDepartment.Tables[0].Rows.Count; i++)
                {
                    departmentlist.Add(new SelectListItem()
                    {
                        Value = employeeDepartment.Tables[0].Rows[i]["id"].ToString(), Text = employeeDepartment.Tables[0].Rows[i]["Department"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(departmentlist);
        }
Beispiel #23
0
        public JsonResult GetSelfAppraisalTabNameAndData(string employeeid = null, bool isSelfDirectAppraisalPage = false, string viewStatus = "", Int64 AppraisalProcessId = 0)
        {
            Int64  EmplID = Convert.ToInt64(employeeid);
            string empid  = string.Empty;

            if (EmplID == 0)
            {
                empid = Session["UserID"].ToString();
                Int64 id = Convert.ToInt64(empid);
            }
            else
            {
                empid = employeeid.ToString();
                Int64 id = Convert.ToInt64(EmplID);
            }
            MTSHRDataLayer.PerformanceAppraisal performanceAppraisal = new MTSHRDataLayer.PerformanceAppraisal();
            try
            {
                var tabTypes = performanceAppraisal.GetSelfAppraisalTabNameAndData(empid, isSelfDirectAppraisalPage, Convert.ToInt64(viewStatus), AppraisalProcessId);
                return(Json(new { success = true, result1 = JsonConvert.SerializeObject(tabTypes.Tables[0]), result2 = JsonConvert.SerializeObject(tabTypes.Tables[1]) }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(Json(new { success = false }));
        }
        public ActionResult UpdateAddImageFiles()
        {
            try
            {
                //var Employee_Id = Session["UserID"];
                var docname    = Request.Params["docname"].ToString();
                var EmployeeId = Request.Params["Employee_Id"].ToString();


                if (Request.Files.Count > 0 && EmployeeId != "")
                {
                    var    file     = Request.Files[0];
                    string FileName = file.FileName;
                    if (file != null && file.ContentLength > 0)
                    {
                        BinaryReader reader = new BinaryReader(file.InputStream);
                        MTSHRDataLayer.EmployeeDocuments data_doc = new MTSHRDataLayer.EmployeeDocuments();
                        byte[] bytes  = reader.ReadBytes((int)file.ContentLength);
                        int    result = data_doc.Create(EmployeeId, docname, bytes, FileName);
                        return(Content("Success"));
                    }
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(Content("Failed"));
        }
Beispiel #25
0
        public JsonResult getempRatingsForKraSkills(string empid = null, Int64 AppraisalProcessId = 0, bool isSelfDirectAppraisalPage = false, string viewType = null)
        {
            Int64 Empl_ID    = 0;
            Int64 ViewStatus = 0;                                  // To See Which one is seeing the Employee rating page
            Int64 RoleID     = Convert.ToInt64(Session["RoleId"]);
            Int64 ViewType   = Convert.ToInt64(viewType);

            //if (RoleID == 1)
            //{
            //    ViewStatus = 2;
            //}
            //if (RoleID == 2 || RoleID == 4)
            //{
            //    ViewStatus = 0;
            //}
            //if (RoleID == 3)
            //{
            //    ViewStatus = 1;
            //}
            if (ViewType == 1)
            {
                ViewStatus = 1;
            }
            if (ViewType == 2 || ViewType == 3)
            {
                ViewStatus = 2;
            }
            if (ViewType == 0)
            {
                ViewStatus = 0;
            }
            if (empid == "0")
            {
                Empl_ID = Convert.ToInt64(Session["UserID"]);
            }
            else
            {
                Empl_ID = Convert.ToInt64(empid);
            }

            MTSHRDataLayer.PerformanceAppraisal performanceAppraisal = new MTSHRDataLayer.PerformanceAppraisal();
            try
            {
                var Emp_Ratings = performanceAppraisal.Get_Emp_Ratings(Empl_ID, AppraisalProcessId, isSelfDirectAppraisalPage, ViewStatus);
                if (Emp_Ratings.Tables.Count > 0)
                {
                    return(Json(new { success = true, result1 = JsonConvert.SerializeObject(Emp_Ratings.Tables[0]) }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    string result = "NoMappingIsAvailable";
                    return(Json(new { success = true, result = result }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            return(Json(new { success = false }));
        }
Beispiel #26
0
        private void DoEmailProcess(string TemplateId)
        {
            int Status = cStatusSucess;

            DataRow[] drEmailDataImmediate = dsEmailMaster.Tables[0].Select("TemplateId=" + TemplateId);
            foreach (var itemdata in drEmailDataImmediate)
            {
                Status = cStatusSucess;

                try
                {
                    EmailTemplate template = new EmailTemplate();

                    DataRow[] itemtemplate = dsEmailTemplates.Tables[0].Select("TemplateId=" + itemdata["TemplateId"].ToString());

                    Template templateForSend = template.CreateEmailTemplateAndProcess(itemtemplate[0]["HTMLPAGE"].ToString(), itemdata["EmailSP"].ToString());
                    string   smtpId          = dsEmailTemplates.Tables[0].Select("TemplateId=" + itemdata["TemplateId"].ToString())[0]["SMTPID"].ToString();

                    if (!SendMail(templateForSend, smtpId))
                    {
                        Status = cStatusFailure;
                    }
                }
                catch (Exception ex)
                {
                    Status = cStatusFailure;
                    BaseExceptionHandler.HandleException(ref ex);
                }

                UpdateEmailStatus((Int64)itemdata["ID"], Status);
            }
        }
        //public JsonResult GetItemCode(Int64 id)
        //{
        //    MTSHRDataLayer.AssignAsset data_item_code = new MTSHRDataLayer.AssignAsset();
        //    List<SelectListItem> itemCodeList = new List<SelectListItem>();
        //    try
        //    {
        //        var ItemCode = data_item_code.GetItemCode(id);
        //        itemCodeList.Add(new SelectListItem() { Value = "", Text = "---- Select Item Code----" });
        //        for (int i = 0; i < ItemCode.Rows.Count; i++)
        //        {
        //            itemCodeList.Add(new SelectListItem() { Value = ItemCode.Rows[i]["IDENTIFICATION_CODE"].ToString(), Text = ItemCode.Rows[i]["IDENTIFICATION_CODE"].ToString() });
        //        }
        //    }
        //    catch (Exception exec)
        //    {
        //        BaseExceptionHandler.HandleException(ref exec);
        //    }
        //    ViewBag.ItemCode = itemCodeList;

        //    return Json(new { success = true, ItemCodeList = JsonConvert.SerializeObject(itemCodeList) }, JsonRequestBehavior.AllowGet);
        //}
        public JsonResult GetItemCode(Int64 Assettypeid, Int64 Assetnameid)
        {
            MTSHRDataLayer.AssetMaintenanceDetails data_item = new MTSHRDataLayer.AssetMaintenanceDetails();
            List <SelectListItem> itemCodeList = new List <SelectListItem>();

            try
            {
                var item = data_item.GetItem(Assettypeid, Assetnameid);
                itemCodeList.Add(new SelectListItem()
                {
                    Value = "", Text = "--Select Item--"
                });
                for (int i = 0; i < item.Rows.Count; i++)
                {
                    itemCodeList.Add(new SelectListItem()
                    {
                        Value = item.Rows[i]["ID"].ToString(), Text = item.Rows[i]["Item"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            ViewBag.ItemCode = itemCodeList;

            return(Json(new { success = true, ItemCodeList = JsonConvert.SerializeObject(itemCodeList) }, JsonRequestBehavior.AllowGet));
        }
Beispiel #28
0
        public JsonResult GetAllApprovalLeaveList(Leave le)
        {
            try
            {
                if (Request.Headers["Range"] == null)
                {
                    le.FromDate = DateTime.Now;
                    le.ToDate   = DateTime.Now.AddMonths(3);
                }
                //else if (Request.Headers["Range"] == "1")
                //{
                //    String[] date = le.DateRange.Split('-');
                //    le.FromDate = Convert.ToDateTime(date[0].Trim());
                //    le.ToDate = Convert.ToDateTime(date[1].Trim());

                //}

                string empid = Session["UserID"].ToString();
                Int64  id    = Convert.ToInt64(empid);
                MTSHRDataLayer.LeavePending_Approve leaves_pending = new MTSHRDataLayer.LeavePending_Approve();
                return(Json(JsonConvert.SerializeObject(leaves_pending.GetAllApprovedLeaveList(empid, le.FromDate, le.ToDate))));
            }
            catch (Exception ex)
            {
                BaseExceptionHandler.HandleException(ref ex);
            }
            return(Json(JsonConvert.SerializeObject(new { Success = false })));
        }
Beispiel #29
0
        public ActionResult AddVendorDetails(Vendors _vendor)
        {
            try
            {
                int result = 0;
                MTSHRDataLayer.Vendors _data = new MTSHRDataLayer.Vendors();
                result = _data.Create(Convert.ToInt32(_vendor.Type), _vendor.Name,
                                      _vendor.Address, _vendor.Phone,
                                      _vendor.ContactPerson, _vendor.MobileNo,
                                      _vendor.Email);


                if (result == 1)
                {
                    return(Content("Success"));
                }
                else
                {
                    return(Content("Failed"));
                }
            }

            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
                throw exec;
            }
        }
Beispiel #30
0
        private void DoTaskForService(string param = "")
        {
            workevent.Reset();
            try
            {
                bool HasReachedMaxRetryCnt = false;

                LogMessage("Service Execution Started");
                LogDebugMessage("DoTask Method Call Started");

                object Status = new object();

                if (string.IsNullOrEmpty(param))
                {
                    Status = ServiceBaseType.InvokeMember("DoTask", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, objService, null);
                }
                else
                {
                    Status = ServiceBaseType.InvokeMember("DoTask", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, objService, new object[] { param });
                }

                LogDebugMessage("Status" + Status.ToString());
                LogMessage("Service Execution End Status:" + Status.ToString());
                LogDebugMessage("DoTask Method Call End");
                if (!Convert.ToBoolean(Status))
                {
                    if (CurrentMaxErrorsCnt == MaxErrorsCount)
                    {
                        this.Stop();
                        return;
                    }
                    if (CurrentRetryCnt == Retrycount)
                    {
                        ++CurrentMaxErrorsCnt;
                        HasReachedMaxRetryCnt = true;
                    }
                    if (!HasReachedMaxRetryCnt)
                    {
                        ++CurrentRetryCnt;
                        DoTaskForService(param);
                    }
                }
                CurrentRetryCnt = 0;
            }
            catch (Exception ex)
            {
                LogMessage(ex.Message);
                LogMessage(ex.StackTrace);
                LogDebugMessage(ex.Message);
                LogDebugMessage(ex.StackTrace);
                BaseExceptionHandler.HandleException(ref ex);
                ++CurrentRetryCnt;
            }
            finally
            {
                workevent.Set();
            }
        }