Exemplo n.º 1
0
        public IHttpActionResult getLeaveAllowanceAmount(string logonname)
        {
            logwriter.WriteTolog("In get leave Allowance");

            string employee_number = getEmployeeNumber(@"AFRICA\" + logonname);
            string employee_grade  = getEmployeeInfo(@"AFRICA\" + logonname).employee_grade;

            var leave_allowance = new List <LeaveAllowanceModel>();

            if (!string.IsNullOrEmpty(employee_number))
            {
                XceedEntities xceedcnxn = new XceedEntities();
                leave_allowance = (from a in xceedcnxn.vw_leaveallowance
                                   where a.description == employee_grade
                                   select new LeaveAllowanceModel
                {
                    leaveAllowance = a.allow_amount,
                    leaveEffPeriod = a.eff_period_from,
                    staffGrade = a.description,
                    financialYear = DateTime.Now.Year
                }).ToList();

                return(Ok(leave_allowance));
            }
            else
            {
                return(Ok(leave_allowance));
            }
        }
Exemplo n.º 2
0
        //[System.Web.Http.Route("Login/{logonname}/{password}")]
        //public IHttpActionResult Login(string logonName, string password)
        //{
        //    LoginModel model = new LoginModel();
        //    try
        //    {
        //        if (Membership.ValidateUser(logonName, password))
        //        {
        //            FormsAuthentication.SetAuthCookie(logonName, false);
        //            try
        //            {
        //                StaffADProfile staffADProfile = getStaffADProfile(logonName);
        //            }
        //            catch (Exception ex)
        //            {
        //                this.ModelState.AddModelError(string.Empty, "Your staff profile has not been properly setup. Please contact InfoTech");
        //            }
        //            model.responseCode = "00";
        //            model.responseDescription = "successful";
        //            return Ok(model);

        //        }
        //        model.responseCode = "20";
        //        model.responseDescription = "The user name or password provided is incorrect.";
        //    }
        //    catch (Exception ex)
        //    {
        //        model.responseCode = "40";
        //        model.responseDescription = ex.Message;
        //    }
        //    return Ok(model);
        //}



        public string getEmployeeNumber(string logonname)
        {
            XceedEntities xceedcnxn       = new XceedEntities();
            var           employee_number = (from u in xceedcnxn.vw_employeeinfo
                                             where u.logon_name == logonname
                                             select u.employee_number).FirstOrDefault();

            logwriter.WriteTolog("getEmployeeNumber");
            return(employee_number.ToString());
        }
Exemplo n.º 3
0
        public IHttpActionResult getLeaveType()
        {
            var leaveTypes_ = new List <LeaveTypeModel>();

            XceedEntities xceedcnxn = new XceedEntities();

            leaveTypes_ = (from a in xceedcnxn.Vw_LeaveType
                           where a.org_id == 1
                           orderby a.LeaveType ascending
                           select new LeaveTypeModel
            {
                leaveTypeId = a.leave_id,
                leaveType = a.LeaveType
            }).ToList();
            return(Ok(leaveTypes_));
        }
        public IHttpActionResult GetReportingStructureByStaffID(string staff_id, string branch_code)
        {
            //var empty = new object();
            var name                    = new System.Data.Entity.Core.Objects.ObjectParameter("name", typeof(string));
            var employee_id             = new System.Data.Entity.Core.Objects.ObjectParameter("employee_id", typeof(string));
            var hop_unit_head_number    = new System.Data.Entity.Core.Objects.ObjectParameter("hop_unit_head_number", typeof(string));
            var hop_unit_head_name      = new System.Data.Entity.Core.Objects.ObjectParameter("hop_unit_head_name", typeof(string));
            var hop_unit_head_logon     = new System.Data.Entity.Core.Objects.ObjectParameter("hop_unit_head_logon", typeof(string));
            var hop_unit_head_email     = new System.Data.Entity.Core.Objects.ObjectParameter("hop_unit_head_email", typeof(string));
            var bhead_dept_head_number  = new System.Data.Entity.Core.Objects.ObjectParameter("bhead_dept_head_number", typeof(string));
            var bhead_dept_head_name    = new System.Data.Entity.Core.Objects.ObjectParameter("bhead_dept_head_name", typeof(string));
            var bhead_dept_head_logon   = new System.Data.Entity.Core.Objects.ObjectParameter("bhead_dept_head_logon", typeof(string));
            var bhead_dept_head_email   = new System.Data.Entity.Core.Objects.ObjectParameter("bhead_dept_head_email", typeof(string));
            var ghead_zonal_head_number = new System.Data.Entity.Core.Objects.ObjectParameter("ghead_zonal_head_number", typeof(string));
            var ghead_zonal_head_name   = new System.Data.Entity.Core.Objects.ObjectParameter("ghead_zonal_head_name", typeof(string));
            var ghead_zonal_head_logon  = new System.Data.Entity.Core.Objects.ObjectParameter("ghead_zonal_head_logon", typeof(string));
            var ghead_zonal_head_email  = new System.Data.Entity.Core.Objects.ObjectParameter("ghead_zonal_head_email", typeof(string));
            var ed_number               = new System.Data.Entity.Core.Objects.ObjectParameter("ed_number", typeof(string));
            var ed_name                 = new System.Data.Entity.Core.Objects.ObjectParameter("ed_name", typeof(string));
            var ed_logon                = new System.Data.Entity.Core.Objects.ObjectParameter("ed_logon", typeof(string));
            var ed_email                = new System.Data.Entity.Core.Objects.ObjectParameter("ed_email", typeof(string));
            var md_number               = new System.Data.Entity.Core.Objects.ObjectParameter("md_number", typeof(string));
            var md_name                 = new System.Data.Entity.Core.Objects.ObjectParameter("md_name", typeof(string));
            var md_logon                = new System.Data.Entity.Core.Objects.ObjectParameter("md_logon", typeof(string));
            var md_email                = new System.Data.Entity.Core.Objects.ObjectParameter("md_email", typeof(string));
            var email                   = new System.Data.Entity.Core.Objects.ObjectParameter("email", typeof(string));
            var logon_name              = new System.Data.Entity.Core.Objects.ObjectParameter("logon_name", typeof(string));
            var ZsErrorCode             = new System.Data.Entity.Core.Objects.ObjectParameter("ZsErrorCode", typeof(string));
            var ZsErrorMsg              = new System.Data.Entity.Core.Objects.ObjectParameter("ZsErrorMsg", typeof(string));

            XceedEntities ent        = new XceedEntities();
            List <string> rStructure = new List <string>();

            //rStructure = ent.zsp_get_reporting_line("", "",  staff_id, branch_code, name, employee_id, hop_unit_head_number, hop_unit_head_name,
            //                                                  hop_unit_head_logon, hop_unit_head_email, bhead_dept_head_number,
            //                                                  bhead_dept_head_name, bhead_dept_head_logon, bhead_dept_head_email,
            //                                                  ghead_zonal_head_number, ghead_zonal_head_name, ghead_zonal_head_logon,
            //                                                  ghead_zonal_head_email, ed_number, ed_name, ed_logon, ed_email,
            //                                                  md_number, md_name, md_logon, md_email, email, logon_name,
            //                                                  ZsErrorCode, ZsErrorMsg).ToList();

            if (rStructure == null)
            {
                return(NotFound());
            }
            return(Ok(rStructure));
        }
Exemplo n.º 5
0
        internal static bool IsBranchHead(StaffADProfile staffADProfile)
        {
            XceedEntities ctx    = new XceedEntities();
            var           result = new List <LinqResponseModel>();

            switch (staffADProfile.branch_code)
            {
            case "001":
                result = (from w in ctx.vw_headoffice_workflow
                          where w.depthead_number == staffADProfile.employee_number
                          select new LinqResponseModel
                {
                    value = w.depthead_name
                }).ToList();
                break;

            case "013":
                result = (from w in ctx.vw_abuja_workflow
                          where w.branch_head_number == staffADProfile.employee_number
                          select new LinqResponseModel
                {
                    value = w.branchhead_name
                }).ToList();
                break;

            default:
                result = (from w in ctx.vw_branches_workflow
                          where w.branch_head_number == staffADProfile.employee_number
                          select new LinqResponseModel
                {
                    value = w.branchhead_name
                }).ToList();
                break;
            }

            if (result.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 6
0
        public IHttpActionResult getLeaveDetails(string logonname, int leaveTypeId)
        {
            logwriter.WriteTolog("In get leave details");

            string        employee_number = getEmployeeNumber(@"AFRICA\" + logonname);
            var           leave_details   = new List <LeaveDetailsModel>();
            XceedEntities xceedcnxn       = new XceedEntities();

            leave_details = (from a in xceedcnxn.fn_ReturnLeavedaysentitled(employee_number, leaveTypeId)
                             select new LeaveDetailsModel
            {
                daysEntitled = a.daysEntitled,
                daysAlreadyTaken = a.daysAlreadyTaken,
                prevLeaveBalance = a.prevLeaveBal,
                daysCarriedForward = a.daysCarriedForward,
                lastleaveDate = a.lastLeaveDate
            }).ToList();
            return(Ok(leave_details));
        }
Exemplo n.º 7
0
        public EmployeeInfoModel getEmployeeInfo(string logonname)
        {
            XceedEntities xceedcnxn     = new XceedEntities();
            var           employee_info = (from u in xceedcnxn.vw_employeeinfo
                                           where u.logon_name == logonname
                                           select new EmployeeInfoModel
            {
                employee_account_number = u.account_no,
                employee_number = u.employee_number,
                employee_branch_code = u.Branch_code,
                employee_branch = u.Branch,
                employee_doe = (DateTime)u.employment_date,
                employee_email = u.email,
                employee_grade = u.paygroup,
                employee_id = u.employee_id,
                employee_name = u.name
            }).ToList();

            logwriter.WriteTolog("getEmployeeInfo");
            return(employee_info.FirstOrDefault());
        }
Exemplo n.º 8
0
        static public StaffADProfile getXceedProfile(StaffADProfile staffADProfile)
        {
            XceedEntities xceed = new XceedEntities();


            try
            {
                var profile = (from distinct in xceed.vw_employeeinfo
                               from zone in xceed.vw_manpowergroupings
                               where (distinct.employee_number == staffADProfile.employee_number) &&
                               distinct.Branch_code.Equals(zone.branch_code) &&
                               distinct.org_id.Equals(zone.org_id)

                               select

                               new StaffADProfile
                {
                    branch_name = distinct.Branch,
                    branch_code = distinct.Branch_code,
                    employee_number = distinct.employee_number,
                    name = distinct.name.Replace(",", ""),
                    doe = distinct.employment_date /*.Value.ToString("dddd MMMM d, yyyy", CultureInfo.CreateSpecificCulture("en-US"))*/,
                    dob = distinct.date_of_birth.Value /*.ToString("dddd MMMM d, yyyy", CultureInfo.CreateSpecificCulture("en-US"))*/,
                    lastpromotiondate = distinct.last_promo_date,
                    grade = distinct.grade_code,
                    grade_id = distinct.grade_id,
                    email = distinct.email,
                    SelectedDept = distinct.dept,
                    department_id = distinct.department_id,
                    unit = distinct.unit,
                    jobtitle = distinct.jobtitle,
                    confirm = distinct.emp_confirm,
                    gender = (int)distinct.gender,
                    org_id = (int)distinct.org_id,
                    ranking = (int)distinct.ranking,
                    account_no = distinct.account_no,
                    mobile_phone = distinct.mobile_phone,
                    category = distinct.Category ?? "OPERATIONS",
                    groupcode = zone.zone_id.ToString(),
                    groupname = zone.zonal_name,
                    //financial_year  = distinct.ye
                    imagelink = "url(http://xceedservermain/EmployeePassport/" + distinct.employee_number + ".jpg)"
                }).Distinct().First();

                staffADProfile.branch_name       = profile.branch_name;
                staffADProfile.branch_code       = profile.branch_code;
                staffADProfile.employee_number   = profile.employee_number;
                staffADProfile.name              = profile.name;
                staffADProfile.doe               = profile.doe;
                staffADProfile.dob               = profile.dob;
                staffADProfile.lastpromotiondate = profile.lastpromotiondate;
                staffADProfile.grade             = profile.grade;
                staffADProfile.grade_id          = profile.grade_id;
                staffADProfile.email             = profile.email;
                staffADProfile.SelectedDept      = profile.SelectedDept;
                staffADProfile.department_id     = profile.department_id;
                staffADProfile.unit              = profile.unit;
                staffADProfile.jobtitle          = profile.jobtitle;
                staffADProfile.confirm           = profile.confirm;
                staffADProfile.gender            = profile.gender;
                staffADProfile.org_id            = profile.org_id;
                staffADProfile.ranking           = profile.ranking;
                staffADProfile.account_no        = profile.account_no;
                staffADProfile.mobile_phone      = profile.mobile_phone;
                staffADProfile.category          = profile.category;
                staffADProfile.imagelink         = profile.imagelink;
                staffADProfile.groupcode         = profile.groupcode;
                staffADProfile.groupname         = profile.groupname;
                staffADProfile.supergroupcode    = 1;
                staffADProfile.supergroupname    = "ZENITH BANK PLC";

                staffADProfile.financial_year = DataHandler.getFinancialYear();
            }
            catch (Exception ex)
            {
                LogWriter logWriter = new LogWriter();
                return(null);
            }

            return(staffADProfile);
        }