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"));
     }
 }
Ejemplo n.º 2
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"));
            }
        }