public ActionResult LetterRequests()
 {
     if (Request.Cookies["user"] != null && Request.Cookies["compid"] != null)
     {
         var username = Convert.ToInt64(Request.Cookies["user"].Value);
         var compid   = Request.Cookies["compid"].Value;
         ESSWebService.CallContext callcont = new ESSWebService.CallContext();
         ESSWebService.SDSGeneralRequestServiceClient sdgenreq = new ESSWebService.SDSGeneralRequestServiceClient();
         sdgenreq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
         sdgenreq.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
         var ss = (from a in sdgenreq.getAllGeneralRequestListByNature(callcont, username, ESSWebService.SDSGeneralNature.Letter, compid).parmGeneralRequestList
                   select new DTOGeneralRequests
         {
             TransactionId = a.TransactionId,
             RequestId = a.RequestId,
             RequestgroupId = "",
             Transactiondate = a.Transactiondate.ToShortDateString(),
             PersonalNumber = a.NameEn.Split('-')[0],
             ReqNature = a.Generalnature.ToString(),
             ReasonCode = a.ReasonCode,
             Name = a.NameEn.Split('-')[1],
             State = a.Status.ToString(),
             URL = "/GeneralRequest/ViewGeneralRequestbyId?genreqid=" + a.TransactionId,
         }).ToList();
         return(View(ss));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
 public string CreateLetterRequest(string reason, string requestid, string comment, string reportlang, string sendto)
 {
     if (Request.Cookies["user"] != null && Request.Cookies["compid"] != null)
     {
         ESSWebService.CallContext callcont = new ESSWebService.CallContext();
         var compid   = Request.Cookies["compid"].Value;
         var username = Convert.ToInt64(Request.Cookies["user"].Value);
         ESSWebService.SDSGeneralRequestServiceClient sdsgenreq = new ESSWebService.SDSGeneralRequestServiceClient();
         sdsgenreq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
         ESSWebService.GeneralRequest _cregenreq = new ESSWebService.GeneralRequest();
         sdsgenreq.ClientCredentials.Windows.ClientCredential = new NetworkCredential("webapp", "pass" + '"' + "word123");
         _cregenreq.Comments        = comment;
         _cregenreq.Transactiondate = DateTime.Now;
         _cregenreq.Workerrecid     = username;
         _cregenreq.RequestId       = requestid;
         _cregenreq.ReasonCode      = reason;
         _cregenreq.Sendto          = sendto;
         _cregenreq.Reportlanguage  = (ESSPortal.ESSWebService.SDSReportLang)Convert.ToInt32(reportlang);
         _cregenreq.Generalnature   = ESSWebService.SDSGeneralNature.Letter;
         //_cregenreq.ge
         string g = sdsgenreq.createGeneralRequestByNature(callcont, _cregenreq, ESSWebService.SDSGeneralNature.Letter, compid);
         return(g);
     }
     else
     {
         RedirectToAction("Login", "Account");
         return("");
     }
 }
        public string Workflowforrequest(string requesid)
        {
            string workcom = "";

            ESSWebService.CallContext callcont = new ESSWebService.CallContext();
            var compid   = Request.Cookies["compid"].Value;
            var username = Convert.ToInt64(Request.Cookies["user"].Value);

            ESSWebService.SDSGeneralRequestServiceClient sdsworkcom = new ESSWebService.SDSGeneralRequestServiceClient();
            sdsworkcom.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
            sdsworkcom.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
            ESSWebService.SDSWorkflowApprovalWorkItemHistory workflowHistory = sdsworkcom.getWorkflowHistory(callcont, requesid);
            if (workflowHistory != null)
            {
                foreach (ESSWebService.SDSWorkflowApprovalWorkItemComment wfHistory in workflowHistory.Comments)
                {
                    if (wfHistory.IsStep == 0)
                    {
                        workcom = workcom + (wfHistory.Time + " - " + wfHistory.ActionLabel + " - " + "Comments : " + wfHistory.Comment) + " \n";
                    }
                    else
                    {
                        workcom = workcom + (wfHistory.StepName) + " \n";
                    }
                }
            }
            return(workcom);
        }
        public JsonResult getrequestids()
        {
            ESSWebService.CallContext callcont = new ESSWebService.CallContext();
            var compid   = Request.Cookies["compid"].Value;
            var username = Convert.ToInt64(Request.Cookies["user"].Value);

            ESSWebService.SDSGeneralRequestServiceClient sdsgenreq = new ESSWebService.SDSGeneralRequestServiceClient();
            sdsgenreq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
            sdsgenreq.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
            var retreasons = sdsgenreq.getRequestIds(callcont, compid).parmRequestIdList;

            return(Json(retreasons, JsonRequestBehavior.AllowGet));
        }
 public ActionResult ViewGeneralRequestbyId(string genreqid)
 {
     if (Request.Cookies["user"] != null && Request.Cookies["compid"] != null)
     {
         ESSWebService.CallContext callcont = new ESSWebService.CallContext();
         var compid   = Request.Cookies["compid"].Value;
         var username = Convert.ToInt64(Request.Cookies["user"].Value);
         ESSWebService.SDSGeneralRequestServiceClient sdsgenreq = new ESSWebService.SDSGeneralRequestServiceClient();
         sdsgenreq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
         sdsgenreq.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
         var ss = sdsgenreq.getGeneralRequest(callcont, genreqid, compid);
         ss.NameAr = Workflowforrequest(genreqid);
         return(View(ss));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
        public string RejecteGeneralRequestbyRequestNumber(string leaverequest, string Comment)
        {
            if (Request.Cookies["user"] != null && Request.Cookies["compid"] != null)
            {
                ESSWebService.CallContext callcont = new ESSWebService.CallContext();
                var compid   = Request.Cookies["compid"].Value;
                var username = Convert.ToInt64(Request.Cookies["user"].Value);
                ESSWebService.SDSGeneralRequestServiceClient sdleavereq = new ESSWebService.SDSGeneralRequestServiceClient();
                sdleavereq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
                sdleavereq.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
                ESSWebService.GeneralRequest _crleavereq = new ESSWebService.GeneralRequest();
                _crleavereq = sdleavereq.getPendingWorkflowList(callcont, username).parmGeneralRequestList.Where(x => x.TransactionId == leaverequest).FirstOrDefault();

                //sdleavereq.Approve(callcont, _crleavereq.WorkflowItem, username, Comment);
                return(sdleavereq.Reject(callcont, _crleavereq.WorkflowItem, username, Comment));
            }
            else
            {
                RedirectToAction("Login", "Account");
                return("");
                // return _perinfo;
            }
        }
        public ActionResult SubmittedGeneralRequest()
        {
            if (Request.Cookies["user"] != null && Request.Cookies["compid"] != null)
            {
                var username = Convert.ToInt64(Request.Cookies["user"].Value);
                var compid   = Request.Cookies["compid"].Value;
                ESSWebService.CallContext callcont = new ESSWebService.CallContext();
                ESSWebService.SDSGeneralRequestServiceClient sd = new ESSWebService.SDSGeneralRequestServiceClient();
                sd.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
                sd.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
                //sd.getPendingWorkflowList()
                // sd.Approve()
                //  sd.getAllleaveRequestList(callcont, username, compid).

                var ss = (from a in sd.getPendingWorkflowList(callcont, username).parmGeneralRequestList
                          select new DTOGeneralRequests
                {
                    TransactionId = a.TransactionId,
                    RequestId = a.RequestId,
                    RequestgroupId = "",
                    Transactiondate = a.Transactiondate.ToShortDateString(),
                    PersonalNumber = a.NameEn.Split('-')[0],
                    ReasonCode = a.ReasonCode,
                    Name = a.NameEn.Split('-')[1],
                    State = a.Status.ToString(),
                    URL = "/GeneralRequest/ViewGeneralRequestbyId?genreqid=" + a.TransactionId,
                }).ToList();

                return(View(ss.OrderByDescending(x => x.RequestId).ToList()));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
                // return _perinfo;
            }
        }
Exemplo n.º 8
0
        public ActionResult Home()
        {
            DTOModels.DTOPersonalInfo _perinfo = new DTOModels.DTOPersonalInfo();
            ESSWebService.CallContext callcont = new ESSWebService.CallContext();
            if (Request.Cookies["user"] != null && Request.Cookies["compid"] != null)
            {
                var username = Convert.ToInt64(Request.Cookies["user"].Value);
                var compid   = Request.Cookies["compid"].Value;
                ESSWebService.SDSPersonalInfoServicesClient sd         = new ESSWebService.SDSPersonalInfoServicesClient();
                ESSWebService.SDSBankInfoServicesClient     sdbank     = new ESSWebService.SDSBankInfoServicesClient();
                ESSWebService.SDSDashboardServicesClient    dashclient = new ESSWebService.SDSDashboardServicesClient();


                ESSWebService.SDSBenefitsInfoServiceClient sdbenfits = new ESSWebService.SDSBenefitsInfoServiceClient();
                sdbenfits.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
                sdbenfits.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
                var beninfocount = sdbenfits.getAllowanceDeductionCostList(callcont, username).parmbenefitsAllowDedList.Count();


                ESSWebService.SDSLeaveRequestServicesClient sdleavereq = new ESSWebService.SDSLeaveRequestServicesClient();
                sdleavereq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
                sdleavereq.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
                var ticketcount     = sdleavereq.getAllleaveRequestByNatureList(callcont, username, (int)SDSLeaveReqNature.TicketRequest, compid).parmGeneralRequestList.Count();
                var leavecount      = sdleavereq.getAllleaveRequestByNatureList(callcont, username, (int)SDSLeaveReqNature.LeaveRequest, compid).parmGeneralRequestList.Count();
                var tcktencahscount = sdleavereq.getAllleaveRequestByNatureList(callcont, username, (int)SDSLeaveReqNature.TicketEncashment, compid).parmGeneralRequestList.Count();

                ESSWebService.SDSExcuseRequestServicesClient sdexcusereq = new ESSWebService.SDSExcuseRequestServicesClient();
                sdexcusereq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
                sdexcusereq.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
                var absencecount  = sdexcusereq.getAllExcuseReqeustByNature(callcont, username, ESSWebService.SDSExcuseNature.Absence, compid).parmExcuseRequestList.Count();
                var overtimecount = sdexcusereq.getAllExcuseReqeustByNature(callcont, username, ESSWebService.SDSExcuseNature.Overtime, compid).parmExcuseRequestList.Count();

                ESSWebService.SDSGeneralRequestServiceClient sdgenreq = new ESSWebService.SDSGeneralRequestServiceClient();
                sdgenreq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
                sdgenreq.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
                var lettercount  = sdgenreq.getAllGeneralRequestListByNature(callcont, username, ESSWebService.SDSGeneralNature.Letter, compid).parmGeneralRequestList.Count();
                var generalcount = sdgenreq.getAllGeneralRequestListByNature(callcont, username, ESSWebService.SDSGeneralNature.General, compid).parmGeneralRequestList.Count();


                dashclient.ClientCredentials.Windows.ClientCredential = new NetworkCredential("webapp", "pass" + '"' + "word123");

                ESSPortal.ESSWebService.Dashboard retdash = dashclient.getDashboard(callcont, username, compid);

                ESSWebService.SDSIdentificationInfoServicesClient sdidentify = new ESSWebService.SDSIdentificationInfoServicesClient();
                sd.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
                sd.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");

                ESSPortal.ESSWebService.PersonalInfo perinfoser = sd.getOnePersonalInfo(callcont, username);
                _perinfo.ArabicName          = perinfoser.ArabicName;
                _perinfo.EnglishName         = perinfoser.EnglishName;
                _perinfo.FirstName           = perinfoser.EnglishName.Split(' ')[0];
                _perinfo.NewID               = perinfoser.OldId;
                _perinfo.OldID               = perinfoser.OldId;
                _perinfo.JoiningDate         = perinfoser.Joiningdate.ToShortDateString();
                _perinfo.BirthDate           = perinfoser.Birthdate.ToShortDateString();
                _perinfo.JobDesc             = perinfoser.JobId;
                _perinfo.PositionDesc        = perinfoser.Positiondescription;
                _perinfo.PersonalNumber      = perinfoser.Personnelnumber;
                _perinfo.Companyname         = perinfoser.Companyname;
                _perinfo.Gender              = perinfoser.Gender;
                _perinfo.MaritalStatus       = perinfoser.Maritalstatus;
                _perinfo.dashboardlist       = FormDynamicDashBoard(retdash);
                _perinfo.Departmentname      = perinfoser.DepartmentName;
                _perinfo.ProbationEndDate    = perinfoser.ProbationEndDate.ToShortDateString();
                _perinfo.CountAddress        = retdash.EmployeeDashboard.CountAddress;
                _perinfo.PositionId          = perinfoser.PositionId;
                _perinfo.JobType             = perinfoser.JobTypeId;
                _perinfo.CountBank           = retdash.EmployeeDashboard.CountBank;
                _perinfo.CountContact        = retdash.EmployeeDashboard.CountContact;
                _perinfo.CountDependents     = retdash.EmployeeDashboard.CountDependents;
                _perinfo.CountExcuseRequest  = retdash.EmployeeDashboard.CountExcuseRequest;
                _perinfo.CountIdentification = retdash.EmployeeDashboard.CountIdentification;
                _perinfo.CountLeaveRequest   = retdash.EmployeeDashboard.CountLeaveRequest;
                _perinfo.CountSkills         = retdash.EmployeeDashboard.CountSkills;
                _perinfo.DatePayslip         = retdash.EmployeeDashboard.DatePayslip.ToShortDateString();
                _perinfo.DatePayslipPrevious = retdash.EmployeeDashboard.DatePayslip.ToShortDateString();

                _perinfo.LoanedItemCount        = retdash.EmployeeDashboard.CountLoanedItems;
                _perinfo.AttendanceCount        = retdash.EmployeeDashboard.CountAttendance;
                _perinfo.MyBusinessTripCount    = retdash.EmployeeDashboard.CountBusinessTripRequest;
                _perinfo.CountMedicalInsuarance = retdash.EmployeeDashboard.CountMedicalInsurance;
                _perinfo.MyGeneralCount         = retdash.EmployeeDashboard.CountGeneralRequest;
                _perinfo.MyLoanCount            = retdash.EmployeeDashboard.CountLoanRequest;
                _perinfo.MyGeneralCount         = retdash.EmployeeDashboard.CountGeneralRequest;
                //_perinfo.CountLeaveRequest = retdash.EmployeeDashboard.CountLeaveRequest;
                _perinfo.MyEOSCount    = retdash.EmployeeDashboard.CountEOSRequest;
                _perinfo.MyExcuseCount = retdash.EmployeeDashboard.CountExcuseRequest;
                var medinsurance = sd.getMedicalInsuranceList(callcont, username, compid);
                // _perinfo.CountMedicalInsuarance = medinsurance.parmMedicalInsuranceList.Count();
                _perinfo.ImageArray = (sd.getPersonPhoto(callcont, Convert.ToInt64(username))).parmPersonPhoto;
                _perinfo.Datepay    = retdash.EmployeeDashboard.DatePayslip == new DateTime(1900, 1, 1, 12, 0, 0) ? "-" : retdash.EmployeeDashboard.DatePayslip.Day.ToString();
                _perinfo.DayPaid    = retdash.EmployeeDashboard.DatePayslip == new DateTime(1900, 1, 1, 12, 0, 0) ? "-" : retdash.EmployeeDashboard.DatePayslip.ToString("dddd");
                _perinfo.YearMonth  = retdash.EmployeeDashboard.DatePayslip == new DateTime(1900, 1, 1, 12, 0, 0) ? "-" : retdash.EmployeeDashboard.DatePayslip.ToString("MMMM") + " " + retdash.EmployeeDashboard.DatePayslip.Year.ToString();

                _perinfo.DatepayPrev        = retdash.EmployeeDashboard.DatePayslipPrevious == new DateTime(1900, 1, 1, 12, 0, 0) ? "-" : retdash.EmployeeDashboard.DatePayslipPrevious.Day.ToString();
                _perinfo.DayPaidPrev        = retdash.EmployeeDashboard.DatePayslipPrevious == new DateTime(1900, 1, 1, 12, 0, 0) ? "-" : retdash.EmployeeDashboard.DatePayslipPrevious.ToString("dddd");
                _perinfo.YearMonthPrev      = retdash.EmployeeDashboard.DatePayslipPrevious == new DateTime(1900, 1, 1, 12, 0, 0) ? "-" : retdash.EmployeeDashboard.DatePayslipPrevious.ToString("MMMM") + " " + retdash.EmployeeDashboard.DatePayslipPrevious.Year.ToString();
                _perinfo.MyOverTimeCount    = overtimecount;
                _perinfo.CountBenifits      = beninfocount;
                _perinfo.MyGeneralCount     = generalcount;
                _perinfo.CountLeaveRequest  = leavecount;
                _perinfo.CountTicketRequest = ticketcount;
                _perinfo.CountLetter        = lettercount;
                _perinfo.tcktencahscount    = tcktencahscount;
                _perinfo.absencecount       = absencecount;
                List <DTOPersonalContact> lstpersocontact = new List <DTOPersonalContact>();
                DTOPersonalContact        additem         = new DTOPersonalContact();
                additem.EmergencyContact = perinfoser.Perosnalcontactemergency;
                additem.Name             = perinfoser.Perosnalcontactname;
                additem.RelationShip     = perinfoser.Perosnalcontactrelationship;
                lstpersocontact.Add(additem);

                //if ((sd.getPersonPhoto(callcont, Convert.ToInt64(username))).parmPersonPhoto != null)
                //{



                //    //Save the Byte Array as File.
                //    string filePath = "~/Prflpics/" + Path.GetFileName(username.ToString()) + ".jpg";
                //    string x = (sd.getPersonPhoto(callcont, Convert.ToInt64(username))).parmPersonPhoto;
                //    byte[] imageBytes = Convert.FromBase64String(x);
                //    MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);

                //    // Convert byte[] to Image
                //    ms.Write(imageBytes, 0, imageBytes.Length);
                //    System.Drawing.Image image = System.Drawing.Image.FromStream(ms, true);
                //    Bitmap bmp = new Bitmap(image);
                //    // bm.Save(filePath, ImageFormat.Bmp);
                //    try
                //    {
                //        // bmp.Save(filePath);
                //    }
                //    catch
                //    {
                //        Bitmap bitmap = new Bitmap(bmp.Width, bmp.Height, bmp.PixelFormat);
                //        Graphics g = Graphics.FromImage(bitmap);
                //        g.DrawImage(bmp, new Point(0, 0));
                //        g.Dispose();
                //        bmp.Dispose();
                //        bmp = null;
                //        //  bitmap.Save(filePath);

                //        // bmp = bitmap; // preserve clone
                //    }
                //    // image.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);



                //    //   System.IO.File.WriteAllBytes(Server.MapPath(filePath), Encoding.UTF8.GetBytes((sd.getPersonPhoto(callcont, Convert.ToInt64(username))).parmPersonPhoto));

                //}
                // _perinfo.ImageArray = Encoding.ASCII.GetBytes((sd.getPersonPhoto(callcont, Convert.ToInt64(username))).parmPersonPhoto);

                // sd.get
                return(View(_perinfo));
            }
            else
            {
                return(RedirectToAction("Login"));
            }
        }