Beispiel #1
0
        private void EditSalaryHistory(int salaryHistoryID)
        {
            pnlSalaryHistory.Visible = false;
            pnlSalaryDetails.Visible = true;
            ihSalaryHistoryID.Value  = salaryHistoryID.ToString();

            if (salaryHistoryID != -1)
            {
                SalaryHistory history = new SalaryHistory(salaryHistoryID);
                cbFullTime.Checked   = history.FullTime;
                tbHourlyRate.Text    = string.Format("{0:F2}", history.HourlyRate);
                tbCurrentSalary.Text = string.Format("{0:F2}", history.Salary);
                tbHousing.Text       = string.Format("{0:F2}", history.Housing);
                tbFuel.Text          = string.Format("{0:F2}", history.Fuel);
                dtbRaiseDate.Text    = history.RaiseDate != _defaultDate?history.RaiseDate.ToShortDateString() : string.Empty;

                tbRaiseAmt.Text = string.Format("{0:F2}", history.RaiseAmount);
                ddlReviewScoreLU.SelectedLookup = history.ReviewScore;
                dtbReviewDate.Text = history.ReviewDate != _defaultDate?history.ReviewDate.ToShortDateString() : string.Empty;

                lblReviewerEdit.Text     = history.Reviewer.FullName + "<br />";
                ihReviewerID.Value       = history.Reviewer.PersonID.ToString();
                lbRemoveReviewer.Visible = lblReviewerEdit.Text.Trim() != string.Empty;
                dtbNextReview.Text       = history.NextReview != _defaultDate?history.NextReview.ToShortDateString() : string.Empty;
            }
        }
Beispiel #2
0
        private async Task <SalaryHistory> PrepareSalaryHistory(SalaryServiceModel model)
        {
            var salaryHistoryRepo = _unitOfWork.GetRepository <SalaryHistory>();

            var lastChanged = (await salaryHistoryRepo.GetAsync(x => x.SalaryId == model.Id, x => x.OrderBy(x => x.DateChanged)))
                              .LastOrDefault();
            DateTime fromDate;

            if (lastChanged == null)
            {
                fromDate = model.Employee.HiredDate;
            }
            else
            {
                fromDate = lastChanged.ToDate;
            }

            var salaryHistory = new SalaryHistory
            {
                DateChanged = DateTime.UtcNow,
                Amount      = model.Amount,
                FromDate    = fromDate,
                ToDate      = DateTime.UtcNow,
                Employee    = _mapper.Map <Employee>(model.Employee),
                SalaryId    = model.Id
            };

            return(salaryHistory);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            SalaryHistory salaryhistory = db.SalaryHistories.Find(id);

            db.SalaryHistories.Remove(salaryhistory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "SalaryHistoryID,EmpID,Dates,Basics,HouseRent,Medical,Convences,Taxes,Gross_Salary,PromotionID")] SalaryHistory salaryhistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(salaryhistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmpID       = new SelectList(db.Employees, "EmpID", "Name", salaryhistory.EmpID);
     ViewBag.PromotionID = new SelectList(db.Promotions, "PromotionID", "Promotion_type", salaryhistory.PromotionID);
     return(View(salaryhistory));
 }
 public ActionResult Edit([Bind(Include = "Id,Emploees,Sum,Date,PostOrder,Payment")] SalaryHistory salaryhistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(salaryhistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Emploees  = new SelectList(db.Employees, "Id", "FullName", salaryhistory.Emploees);
     ViewBag.PostOrder = new SelectList(db.PostOrder, "Id", "Id", salaryhistory.PostOrder);
     return(View(salaryhistory));
 }
        public ActionResult Create([Bind(Include = "Id,Emploees,Sum,Date,PostOrder,Payment")] SalaryHistory salaryhistory)
        {
            if (ModelState.IsValid)
            {
                db.SalaryHistory.Add(salaryhistory);
                db.SaveChanges();
                return(RedirectToAction("Order"));
            }

            ViewBag.Emploees  = new SelectList(db.Employees, "Id", "FullName", salaryhistory.Emploees);
            ViewBag.PostOrder = new SelectList(db.PostOrder, "Id", "Id", salaryhistory.PostOrder);
            return(View(salaryhistory));
        }
Beispiel #7
0
        public void FillReport(bool throwException = true)
        {
            string rep_params        = vals.Text;
            ReportGenericRequest req = new ReportGenericRequest();

            req.paramString = rep_params;
            ListResponse <Model.Reports.RT201> resp = _reportsService.ChildGetAll <Model.Reports.RT201>(req);

            //if (!resp.Success)
            //{

            //    throw new Exception(resp.Error + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + resp.LogId + "</br>");

            //}
            if (!resp.Success)
            {
                Common.ReportErrorMessage(resp, GetGlobalResourceObject("Errors", "Error_1").ToString(), GetGlobalResourceObject("Errors", "ErrorLogId").ToString());
            }

            string getLang = _systemService.SessionHelper.getLangauge();

            Dictionary <string, string> parameters = Web.UI.Forms.Common.FetchReportParameters(texts.Text);
            SalaryHistory h = new SalaryHistory(parameters, getLang);

            h.RightToLeft       = _systemService.SessionHelper.CheckIfArabicSession() ? DevExpress.XtraReports.UI.RightToLeft.Yes : DevExpress.XtraReports.UI.RightToLeft.No;
            h.RightToLeftLayout = _systemService.SessionHelper.CheckIfArabicSession() ? DevExpress.XtraReports.UI.RightToLeftLayout.Yes : DevExpress.XtraReports.UI.RightToLeftLayout.No;
            resp.Items.ForEach(x => {
                x.PaymentFrequencyString = x.paymentFrequency.HasValue? GetGlobalResourceObject("Common", ((PaymentFrequency)x.paymentFrequency).ToString()).ToString():"";
                x.SalaryTypeString       = x.salaryType.HasValue ? GetGlobalResourceObject("Common", ((SalaryType)x.salaryType).ToString()).ToString() : "";
                x.EffectiveDateString    = x.effectiveDate.ToString(_systemService.SessionHelper.GetDateformat(), CultureInfo.CurrentCulture);
            });

            h.DataSource = resp.Items;
            string user = _systemService.SessionHelper.GetCurrentUser();

            h.Parameters["User"].Value = user;


            h.CreateDocument();
            //string format = "Pdf";
            //string fileName = String.Format("Report.{0}", format);
            //MemoryStream ms = new MemoryStream();
            //h.ExportToPdf(ms,new DevExpress.XtraPrinting.PdfExportOptions() { ShowPrintDialogOnOpen = true });
            //Response.Clear();
            //Response.ContentType = "application/pdf";
            //Response.AddHeader("Content-Disposition", String.Format("{0}; filename={1}", "inline", fileName));
            //Response.BinaryWrite(ms.ToArray());
            //Response.End();
            ASPxWebDocumentViewer1.OpenReport(h);
            ASPxWebDocumentViewer1.DataBind();
        }
        // GET: /SalaryHistory/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SalaryHistory salaryhistory = db.SalaryHistories.Find(id);

            if (salaryhistory == null)
            {
                return(HttpNotFound());
            }
            return(View(salaryhistory));
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ReportCompositeRequest req = GetRequest();

            ListResponse <Model.Reports.RT201> resp = _reportsService.ChildGetAll <Model.Reports.RT201>(req);



            SalaryHistory h = new SalaryHistory(new Dictionary <string, string> (), "");

            h.DataSource = resp.Items;

            ASPxWebDocumentViewer1.OpenReport(h);
        }
        // GET: /SalaryHistory/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SalaryHistory salaryhistory = db.SalaryHistories.Find(id);

            if (salaryhistory == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EmpID       = new SelectList(db.Employees, "EmpID", "Name", salaryhistory.EmpID);
            ViewBag.PromotionID = new SelectList(db.Promotions, "PromotionID", "Promotion_type", salaryhistory.PromotionID);
            return(View(salaryhistory));
        }
        // GET: /SalaryHistory/Edit/5
        public ActionResult Edit(short?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SalaryHistory salaryhistory = db.SalaryHistory.Find(id);

            if (salaryhistory == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Emploees  = new SelectList(db.Employees, "Id", "FullName", salaryhistory.Emploees);
            ViewBag.PostOrder = new SelectList(db.PostOrder, "Id", "Id", salaryhistory.PostOrder);
            return(View(salaryhistory));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            //if (LastSalaryHistory != null)
            //{


            //}

            NewSalaryHistory = new SalaryHistory
            {
                EmployeeID         = Employee.ID,
                SalaryPeriodBegan  = Employee.DateHired,
                SalaryForThePeriod = Employee.Salary,
                SalaryPeriodEnded  = DateTime.Now
            };

            LastSalaryHistory = await _context.SalaryHistory.OrderByDescending(s => s.ID).FirstOrDefaultAsync(s => s.EmployeeID == Employee.ID);

            LastSalaryHistory.SalaryPeriodEnded = Employee.DateHired;
            _context.SalaryHistory.Update(LastSalaryHistory);

            _context.Attach(Employee).State = EntityState.Modified;
            _context.SalaryHistory.Add(NewSalaryHistory);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(Employee.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("/Employees"));
        }
Beispiel #13
0
        public JsonResult SalaryHistory(int EmployeeID)
        {
            List <SalaryHistory> t = new List <SalaryHistory>();
            string conn            = ConfigurationManager.ConnectionStrings["kalingaPPDO"].ConnectionString;

            using (SqlConnection cn = new SqlConnection(conn))
            {
                string     myQuery = "select * from vw_EmployeeSalaryHistory where empid = @EmployeeID";
                SqlCommand cmd     = new SqlCommand()
                {
                    CommandText = myQuery,
                    CommandType = CommandType.Text
                };
                cmd.Parameters.AddWithValue("@EmployeeID", EmployeeID);
                cmd.Connection = cn;
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    int counter = 0;
                    while (dr.Read())
                    {
                        SalaryHistory tsData = new SalaryHistory()
                        {
                            Department        = dr["Company"].ToString(),
                            DateHired         = dr["StartDate"].ToString(),
                            DateResigned      = dr["EndDate"].ToString(),
                            PositionTitle     = dr["PositionDescription"].ToString(),
                            MonthlySalary     = dr["MonthlySalary"].ToString(),
                            SalaryGrade       = dr["SalaryGradeDescription"].ToString(),
                            StepIncrement     = dr["StepIncrement"].ToString(),
                            AppointmentStatus = dr["EmpStatusDescription"].ToString(),
                            GovernmentService = dr["IsGovService"].ToString()
                        };
                        t.Add(tsData);
                        counter++;
                    }
                }
            }
            return(Json(t, JsonRequestBehavior.AllowGet));
        }
Beispiel #14
0
        private void SaveSalary(int salaryHistoryID)
        {
            try
            {
                SalaryHistory salaryHistory = new SalaryHistory(salaryHistoryID);

                salaryHistory.PersonID    = _staff.PersonID;
                salaryHistory.FullTime    = cbFullTime.Checked;
                salaryHistory.HourlyRate  = tbHourlyRate.Text != string.Empty ? decimal.Parse(tbHourlyRate.Text) : 0;
                salaryHistory.Salary      = tbCurrentSalary.Text != string.Empty ? decimal.Parse(tbCurrentSalary.Text) : 0;
                salaryHistory.Housing     = tbHousing.Text != string.Empty ? decimal.Parse(tbHousing.Text) : 0;
                salaryHistory.Fuel        = tbFuel.Text != string.Empty ? decimal.Parse(tbFuel.Text) : 0;
                salaryHistory.RaiseDate   = dtbRaiseDate.Text.Trim() != string.Empty ? DateTime.Parse(dtbRaiseDate.Text) : _defaultDate;
                salaryHistory.RaiseAmount = tbRaiseAmt.Text != string.Empty ? decimal.Parse(tbRaiseAmt.Text) : 0;
                salaryHistory.ReviewScore = ddlReviewScoreLU.SelectedLookup;
                salaryHistory.ReviewDate  = dtbReviewDate.Text.Trim() != string.Empty ? DateTime.Parse(dtbReviewDate.Text) : _defaultDate;

                if (ihReviewerID.Value.Trim() != string.Empty)
                {
                    salaryHistory.ReviewerID = int.Parse(ihReviewerID.Value);
                }

                salaryHistory.NextReview = dtbNextReview.Text.Trim() != string.Empty ? DateTime.Parse(dtbNextReview.Text) : _defaultDate;

                if (salaryHistoryID == -1)
                {
                    _staff.SalaryHistory.Insert(0, salaryHistory);
                    _staff.Save(CurrentUser.Identity.Name);
                }

                salaryHistory.Save(CurrentUser.Identity.Name);
                lblErrorMessage.Visible = false;
                ShowSalaryHistory();
            }
            catch
            {
                lblErrorMessage.Text    = "Please enter valid dates or numbers in the text boxes below.";
                lblErrorMessage.Visible = true;
            }
        }
        private async void menu_salaryHistory_Click(object sender, RoutedEventArgs e)
        {
            if (instructors_listView.SelectedIndex == -1 || instructors_listView.SelectedItems.Count > 1)
            {
                await this.ShowMessageAsync("Error", "Please make sure to select one instructor!");

                return;
            }

            var ins = (Instructor)((ListViewItem)instructors_listView.SelectedItem).Content;

            if (Globals.InstructorSalaries[ins.Id].Count == 0)
            {
                await this.ShowMessageAsync("Warning", "There's no salary history for this instructor.");

                return;
            }

            SalaryHistory win = new SalaryHistory();

            win.c = ins;
            win.ShowDialog();
        }