// RETURNS SALARY OBJECT WITH ALL PROPERTIES
    public Salary getSalary(int scid, double increment, double decrement)
    {
        SqlConnection con = new SqlConnection();

        con.ConnectionString = Convert.ToString(ConfigurationManager.ConnectionStrings["connection"]);

        SqlDataAdapter gs = new SqlDataAdapter("SELECT BASIC,DA,HRA,PF FROM SALARY", con);
        DataTable dts = new DataTable();
        gs.Fill(dts);

        DataRow dr = dts.Rows[0];

         String basic = ( dr[0]).ToString();
        String da = dr[1].ToString();
        String hra = dr[2].ToString();
        String pf = dr[3].ToString();

        double b=Convert.ToDouble(basic);
        double d=Convert.ToDouble(da);
        double h=Convert.ToDouble(hra);
        double p=Convert.ToDouble(pf);

        Salary s=new Salary(b,d,h,p,increment,decrement);

        return s;
    }
        public static EmployeeViewModel ConvertToViewModel(this Employee employee, Department department, Employee manager, Salary salary, Title title)
        {
            var employeeViewModel = new EmployeeViewModel
            {
                BirthDate = employee.BirthDate.Value.ToShortDateString(),
                CurrentManager = string.Empty,
                Id = employee.PersistenceId.ToString(),
                FirstName = employee.FirstName,
                Gender = employee.Gender.DisplayName,
                HireDate = employee.HireDate.Value.ToShortDateString(),
                LastName = employee.LastName,
            };

            if (manager != null)
            {
                employeeViewModel.CurrentManager = manager.FirstName + " " + manager.LastName;
            }

            if (department != null)
            {
                employeeViewModel.CurrentDepartment = department.Name;
            }
            if (salary != null)
            {
                employeeViewModel.CurrentSalary = salary.Amount.ToString();
            }
            if (title != null)
            {
                employeeViewModel.CurrentTitle = title.Name;
            }

            return employeeViewModel;
        }
Example #3
0
        /// <summary>
        /// Les Informtions d'une renumeration
        /// </summary>
        /// <param name="salary"></param>
        public SalaryCard(Salary salary)
        {
            SalaryGuid = salary.SalaryGuid;
            Denomination = salary.Designation;

            Description = salary.Remuneration + " dhs (";
            using (var db = new WinxoContext()) Description += db.Employments.Find(salary.EmploymentGuid).SalaryRecurrence.GetEnumDescription() + ")";

            DateString = salary.StartDate.GetValueOrDefault().ToShortDateString() + " -> " +
                          salary.EndDate.GetValueOrDefault().ToShortDateString();

            IsExpiredColor = salary.EndDate.GetValueOrDefault() < DateTime.Today ? "Beige" : "LightGray";

        }
        public void TestPrivateMember()
        {
            //arrange
            string name = "Abhishek";
            int age = 30;
            Salary osalary = new Salary(name, age);

            //act
            PrivateObject pObj = new PrivateObject(osalary);

            //assert
            Assert.AreEqual<int>(age, Convert.ToInt32(pObj.GetField("age")));
            Assert.AreEqual<string>(name, pObj.GetFieldOrProperty("name") as string);
        }
        public void GetName_StaticMethodTest()
        {
            //arrange
            string name = "Abhishek";
            int age = 30;
            Salary osalary = new Salary(name, age);

            //act
            PrivateType pType = new PrivateType(typeof(Salary));
            string returnValue = pType.InvokeStatic("GetName", osalary) as string;

            //assert
            Assert.AreEqual(name, returnValue);
        }
Example #6
0
 public static Salary Get(int Id)
 {
     Salary Salary = new Salary();
     SqlCommand SQLCmd = new SqlCommand();
     SQLCmd.CommandType = CommandType.StoredProcedure;
     SQLCmd.CommandText = "GetSalary";
     SQLCmd.Parameters.Add("CandidateId", SqlDbType.Int).Value = Id;
     BaseDataAccess.OpenConnection(SQLCmd);
     SqlDataReader dr = SQLCmd.ExecuteReader(CommandBehavior.CloseConnection);
     while (dr.Read())
     {
         Salary = Parse(dr);
     }
     dr.Close();
     return Salary;
 }
        public frmSalaryTariffsEdit(int?_nSalaryTariffID)
        {
            if (_nSalaryTariffID.HasValue)
            {
                nSalaryTariffID = (int)_nSalaryTariffID;
            }
            else
            {
                nSalaryTariffID = 0;
            }

            oSalaryTariff = new Salary();
            if (oSalaryTariff.ErrorNumber != 0)
            {
                IsValid = false;
            }

            if (IsValid)
            {
                InitializeComponent();
            }
        }
Example #8
0
 public bool Insert(Salary item)
 {
     try
     {
         Salary check = db.Salaries.Where(x => x.EmpID == item.EmpID).SingleOrDefault();
         if (check == null)
         {
             db.Salaries.Add(item);
             db.SaveChanges();
             return(true);
         }
         else
         {
             MessageBox.Show("mã nhân viên trong bảng Salary đã bị trùng");
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Example #9
0
        public ActionResult Save(Salary salary)
        {
            if (salary.Id == 0)
            {
                salary.Unpaid = salary.Total - salary.Paid;
                _context.Salaries.Add(salary);
            }
            else
            {
                var salaryInDb = _context.Salaries.SingleOrDefault(s => s.Id == salary.Id);

                salaryInDb.MonthId = salary.MonthId;
                salaryInDb.YearId  = salary.YearId;
                salaryInDb.Total   = salary.Total;
                salaryInDb.Paid    = salary.Paid;
                salaryInDb.Unpaid  = salary.Total - salary.Paid;
            }

            _context.SaveChanges();

            return(RedirectToAction("Index", "Teachers"));
        }
        public JsonResult Edit(int id)
        {
            var    list = db.Salaries.Where(model => model.SalaryId == id).FirstOrDefault();
            Salary sal  = new Salary
            {
                SalaryId      = list.SalaryId,
                Basic         = list.Basic,
                Allowance     = list.Allowance,
                Medical       = list.Medical,
                Tax           = list.Tax,
                LabourWelfare = list.LabourWelfare,
                Fund          = list.Fund,
                NetSalary     = list.NetSalary,
                CmpId         = list.CmpId,
                DeptId        = list.DeptId,
                EmpId         = list.EmpId,
                //RoleId = list.RoleId
            };


            return(Json(sal, JsonRequestBehavior.AllowGet));
        }
Example #11
0
        public List <Salary> GetSalaryOfEmployee(string month, string year) // Lấy lương của những nhân viên đang làm việc
        {
            List <Salary> salaries = new List <Salary>();

            try
            {
                OpenConnection();
                string query = "select Salary.idEmployee, Salary.numOfShift, Salary.numOfFault, Salary.totalSalary , Salary.salaryMonth, Salary.idSalaryRecord from Salary " +
                               "join Employee on Salary.idEmployee = Employee.idEmployee" +
                               " where Employee.isDeleted = 0 and month(Salary.salaryMonth) = @month and year(Salary.salaryMonth) =@year";
                SqlCommand cmd = new SqlCommand(query, conn);
                cmd.Parameters.AddWithValue("@month", month);
                cmd.Parameters.AddWithValue("@year", year);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataTable      dt      = new DataTable();
                adapter.Fill(dt);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int idSalaryRecord = -1;
                    if (dt.Rows[i].ItemArray[5].ToString() != "")
                    {
                        idSalaryRecord = int.Parse(dt.Rows[i].ItemArray[5].ToString());
                    }
                    Salary salary = new Salary(int.Parse(dt.Rows[i].ItemArray[0].ToString()), int.Parse(dt.Rows[i].ItemArray[1].ToString()),
                                               int.Parse(dt.Rows[i].ItemArray[2].ToString()), long.Parse(dt.Rows[i].ItemArray[3].ToString())
                                               , DateTime.Parse(dt.Rows[i].ItemArray[4].ToString()), idSalaryRecord);
                    salaries.Add(salary);
                }
            }
            catch
            {
                CustomMessageBox.Show("Lỗi!", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                CloseConnection();
            }
            return(salaries);
        }
Example #12
0
        public void can_get_active_deductions()
        {
            using (var uow = new NHUnitOfWork()) {
                var employee = Employee.Create(Person.Create("a", "a", "a", "", Gender.MALE, Date.Now), Date.Now);
                var salary   = Salary.Create(employee, MonetaryValue.of("PHP", 15000));
                Deduction.Create(salary, 3, MonetaryValue.of("php", 1000));
                Deduction.Create(salary, 3, MonetaryValue.of("php", 2000));
                Deduction.Create(salary, 3, MonetaryValue.of("php", 3000));
                // Deduction.Create(salary, 3, MonetaryValue.of("php", 0));
                EventBroker.getInstance().Command(new CommandAssociateSalaryToEmployee(salary, employee));

                _employees.Save(employee);
                _salaries.Save(salary);
                uow.Commit();
            }

            using (var uow = new NHUnitOfWork()) {
                var ees = _employees.FetchAllActive();
                var ds  = _salaries.FetchEmployeeActiveDeduction(ees[0]);
                Assert.Equal(3, ds.Count);
            }
        }
Example #13
0
 public static void Edit(Salary pSalary)
 {
     SqlCommand SQLCmd = new SqlCommand();
     SQLCmd.CommandType = CommandType.StoredProcedure;
     SQLCmd.CommandText = "UpdateSalary";
     SQLCmd.Parameters.Add("Id", SqlDbType.Int).Value = pSalary.Id;
     SQLCmd.Parameters.Add("CandidateId", SqlDbType.Int).Value = pSalary.CandidateId;
     SQLCmd.Parameters.Add("FullTime", SqlDbType.Bit).Value = pSalary.FullTime;
     SQLCmd.Parameters.Add("PartTime", SqlDbType.Bit).Value = pSalary.PartTime;
     SQLCmd.Parameters.Add("Student", SqlDbType.Bit).Value = pSalary.Student;
     SQLCmd.Parameters.Add("Temp", SqlDbType.Bit).Value = pSalary.Temp;
     SQLCmd.Parameters.Add("NightShifts", SqlDbType.Bit).Value = pSalary.NightShifts;
     SQLCmd.Parameters.Add("DayShifts", SqlDbType.Bit).Value = pSalary.DayShifts;
     SQLCmd.Parameters.Add("Other", SqlDbType.Bit).Value = pSalary.Other;
     SQLCmd.Parameters.Add("TempWage", SqlDbType.Int).Value = pSalary.TempWage;
     SQLCmd.Parameters.Add("TempRateId", SqlDbType.Int).Value = pSalary.TempRateId;
     SQLCmd.Parameters.Add("PermWage", SqlDbType.Int).Value = pSalary.PermWage;
     SQLCmd.Parameters.Add("PermRateId", SqlDbType.Int).Value = pSalary.PermRateId;
     BaseDataAccess.OpenConnection(SQLCmd);
     BaseDataAccess.ExecuteNonSelect(SQLCmd);
     BaseDataAccess.CloseConnection();
 }
Example #14
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Title.Length != 0)
            {
                hash ^= Title.GetHashCode();
            }
            if (Salary != 0)
            {
                hash ^= Salary.GetHashCode();
            }
            if (JobDescription.Length != 0)
            {
                hash ^= JobDescription.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #15
0
        public List <Salary> GetUnPaidSalary(string idEmployee, string month, string year)
        {
            List <Salary> salaries = new List <Salary>();

            try
            {
                OpenConnection();
                string     query = @"select* from Salary where month(salaryMonth) = @month and year(salaryMonth) = @year and idEmployee =@idEmployee and idSalaryRecord is null";
                SqlCommand cmd   = new SqlCommand(query, conn);
                cmd.Parameters.AddWithValue("@month", month);
                cmd.Parameters.AddWithValue("@year", year);
                cmd.Parameters.AddWithValue("@idEmployee", idEmployee);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataTable      dt      = new DataTable();
                adapter.Fill(dt);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int idSalaryRecord = -1;
                    if (dt.Rows[i].ItemArray[5].ToString() != "")
                    {
                        idSalaryRecord = int.Parse(dt.Rows[i].ItemArray[5].ToString());
                    }
                    Salary salary = new Salary(int.Parse(dt.Rows[i].ItemArray[0].ToString()), int.Parse(dt.Rows[i].ItemArray[1].ToString()),
                                               int.Parse(dt.Rows[i].ItemArray[2].ToString()), long.Parse(dt.Rows[i].ItemArray[3].ToString())
                                               , DateTime.Parse(dt.Rows[i].ItemArray[4].ToString()), idSalaryRecord);
                    salaries.Add(salary);
                }
            }
            catch
            {
                CustomMessageBox.Show("Lỗi!", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                CloseConnection();
            }
            return(salaries);
        }
        /// <summary>
        /// Parse salary information from the XML of a single TribePad job advert
        /// </summary>
        /// <param name="sourceData">XML for a single job, with a root element of &lt;job&gt;</param>
        /// <returns></returns>
        public async Task <Salary> ParseSalary(string sourceData)
        {
            await EnsureLookups();

            var jobXml = XDocument.Parse(sourceData);

            var salary = new Salary();

            var hourlyFrequencyId = _salaryFrequencies?.SingleOrDefault(x => x.Text == "Hourly")?.LookupValueId;
            var frequencyId       = jobXml.Root.Element("salary_frequency")?.Value;

            if (frequencyId == hourlyFrequencyId)
            {
                salary.MinimumHourlyRate = Decimal.Parse(jobXml.Root.Element("salary_from").Value);
                salary.MaximumHourlyRate = Decimal.Parse(jobXml.Root.Element("salary_to").Value);

                SetSalaryFromData(jobXml, salary,
                                  x => x.MinimumHourlyRate == 0 && x.MaximumHourlyRate == 0,
                                  x => (x.MinimumHourlyRate == x.MaximumHourlyRate || x.MaximumHourlyRate < x.MinimumHourlyRate),
                                  x => $"£{x.MinimumHourlyRate?.ToString("n2")} per annum",
                                  x => $"£{x.MinimumHourlyRate?.ToString("n2")} to £{x.MaximumHourlyRate?.ToString("n2")} per hour"
                                  );
            }
            else
            {
                salary.MinimumSalary = Int32.Parse(jobXml.Root.Element("salary_from").Value, CultureInfo.InvariantCulture);
                salary.MaximumSalary = Int32.Parse(jobXml.Root.Element("salary_to").Value, CultureInfo.InvariantCulture);

                SetSalaryFromData(jobXml, salary,
                                  x => x.MinimumSalary == 0 && x.MaximumSalary == 0,
                                  x => (x.MinimumSalary == x.MaximumSalary || x.MaximumSalary < x.MinimumSalary),
                                  x => $"£{x.MinimumSalary?.ToString("n0")} per annum",
                                  x => $"£{x.MinimumSalary?.ToString("n0")} to £{x.MaximumSalary?.ToString("n0")} per annum"
                                  );
            }

            return(salary);
        }
 public bool UpdatePaid(Salary salary)
 {
     logger.EnterMethod();
     try
     {
         var paid = this._salaryRepositories.Get(_ => _.Id == salary.Id);
         if (paid != null)
         {
             paid.IsPaid      = salary.IsPaid;
             paid.Time        = salary.Time;
             paid.TimePay     = this._salaryRepositories.GetDateTimeServer();
             paid.TotalSalary = salary.TotalSalary;
             paid.Description = salary.Description;
             using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required))
             {
                 this._salaryRepositories.Update(paid);
                 transactionScope.Complete();
             }
             this._iUnitOfWork.Save();
             logger.Info("Update success salary Id: [" + salary.Id + "]");
             return(true);
         }
         else
         {
             logger.Info("Update false salary Id: [" + salary.Id + "]");
             return(false);
         }
     }
     catch (Exception e)
     {
         logger.Error("Error: [" + e.Message + "]");
         return(false);
     }
     finally
     {
         logger.LeaveMethod();
     }
 }
Example #18
0
        //Вставка строки
        private void InsertRecord()
        {
            fmSalaryAdd fmEdit = new fmSalaryAdd(EnumFormMode.Insert, "Створення зарлати");
            Salary      sal    = new Salary();
            int         month  = SalaryHelper.GetMonthByIndex(cmbCalendar.SelectedIndex, true);

            if (month == 0)
            {
                sal.Salary_Date = DateTime.MinValue.AddYears(DateTime.Today.Year - 1).AddMonths(DateTime.Today.Month - 1);
            }
            else
            {
                int year = SalaryHelper.GetYearByIndex(DateTime.Today.Year - SetupProgram.YearSalary, cmbCalendar.SelectedIndex, true);
                sal.Salary_Date = DateTime.MinValue.AddYears(year - 1).AddMonths(month - 1);
            }

            if (MenuItemDeps.CheckState == CheckState.Checked)
            {
                v_Dep dep = dgvDep.CurrentRow.DataBoundItem as v_Dep;
                if (dep != null)
                {
                    sal.Salary_RefDep_Id = dep.Id;
                }
            }
            fmEdit.SetData(sal);
            if (fmEdit.ShowDialog() == DialogResult.OK)
            {
                string error;
                Salary salary = fmEdit.GetData();
                if (!_repoSalary.AddSalary(salary, out error))
                {
                    MessageBox.Show("Помилка додавання зарлати.\nТехнічна інформація: " + error, "Помилка");
                    return;
                }

                RefreshTableSalary(_depId, _datBeg, _datEnd);
            }
        }
Example #19
0
        private static Salary FudgeSalary(Salary salary)
        {
            // increase the salary slightly from the job ad range

            if (salary == null)
            {
                return(null);
            }

            var fudgedSalary = salary.Clone();

            if (salary.LowerBound != null)
            {
                fudgedSalary.LowerBound = Decimal.Multiply(salary.LowerBound.Value, .9M);
            }

            if (salary.UpperBound != null)
            {
                fudgedSalary.UpperBound = Decimal.Multiply(salary.UpperBound.Value, 1.1M);
            }

            return(fudgedSalary);
        }
Example #20
0
        public bool Update(Salary sal, ref string error)
        {
            SqlParameter[] sqlParas = new SqlParameter[2];
            sqlParas[0] = new SqlParameter()
            {
                ParameterName = "emp_id",
                Value         = sal.Employee.Id
            };
            sqlParas[1] = new SqlParameter()
            {
                ParameterName = "sal_value"
            };
            if (sal.Value != -1)
            {
                sqlParas[1].Value = sal.Value;
            }
            else
            {
                sqlParas[1].Value = DBNull.Value;
            }

            return(AccessDb.AccessDb.Instance.ExcuteQuery("EXEC dbo.UpdateSalary @emp_id, @sal_value", sqlParas, ref error));
        }
Example #21
0
            public int CompareTo(object obj)
            {
                Salary staff = obj as Salary;

                #region 這段如同下面 BaseSalary.CompareTo(staff.BaseSalary)

                if (BaseSalary > staff.BaseSalary)
                {
                    return(1);
                }
                else if (BaseSalary == staff.BaseSalary)
                {
                    return(0);
                }
                else
                {
                    return(-1);
                }
                #endregion
                //return BaseSalary.CompareTo(staff.BaseSalary);//當被呼叫 .sort()時優先以BaseSalary資料做排序

                //return Bonus.CompareTo(staff.Bonus);//當被呼叫 .sort()Bonus
            }
Example #22
0
        static protected IAttestable AttestableFromRecordId(string recordId)
        {
            char recordType = recordId[0];
            int  itemId     = Int32.Parse(recordId.Substring(1));

            switch (recordType)
            {
            case 'E':     // Expense claim
                return(ExpenseClaim.FromIdentity(itemId));

            case 'A':     // Cash advance
                return(CashAdvance.FromIdentity(itemId));

            case 'I':     // Inbound invoice
                return(InboundInvoice.FromIdentity(itemId));

            case 'S':     // Salary
                return(Salary.FromIdentity(itemId));

            default:
                throw new NotImplementedException("Unknown record type");
            }
        }
        public Salary CalculateSalary(double hoursWorked, double hourlyRate)
        {
            var grossSalary = hoursWorked * hourlyRate;

            var salary = new Salary
            {
                GrossSalary = grossSalary,
                Deduction   = new Deduction
                {
                    IncomeTax = grossSalary > 600
                    ? .25 * 600 + (grossSalary - 600) * .40
                    : .25 * grossSalary,
                    UniversalSocialCharge = grossSalary > 500
                    ? .07 * 500 + (grossSalary - 500) * .08
                    : .07 * grossSalary,
                    Pension = .04 * grossSalary
                }
            };

            salary.NetIncome = salary.GrossSalary - (salary.Deduction.IncomeTax + salary.Deduction.UniversalSocialCharge + salary.Deduction.Pension);

            return(salary);
        }
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Salary salary = db.Salaries.Find(id);

            if (salary == null)
            {
                return(HttpNotFound());
            }
            var model = new SalaryViewModel
            {
                Id                     = salary.SerialId,
                EmployeeName           = salary.Employee.FullName,
                IssueDate              = salary.IssueDate,
                BasicSalary            = salary.BasicSalary,
                PerformanceBasedSalary = salary.PerformanceBasedSalary
            };

            return(View(model));
        }
Example #25
0
        public List <Salary> readSalary()
        {
            List <Salary> listSalaries = new List <Salary>();
            StreamReader  streamReader = System.IO.File.OpenText("Salary.txt");

            string[] fields;
            string   line = null;

            line = streamReader.ReadLine();

            while (line != null)
            {
                fields = line.Split(';');
                Salary salary = new Salary();
                salary.idCode  = fields[0];
                salary.Salary1 = Int32.Parse(fields[1]);
                salary.Salary2 = Int32.Parse(fields[2]);

                listSalaries.Add(salary);
                line = streamReader.ReadLine();
            }
            return(listSalaries);
        }
Example #26
0
 private void buttonUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         if (TextBoxManager.IsNotNullOrWhiteSpaceTextBoxes(this.Controls.OfType <TextBox>()) &&
             dataGridView1.SelectedRows[0] != null)
         {
             int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
             using (MyModel context = new MyModel())
             {
                 Salary salary = context.Salaries.First(s => s.id == id);
                 salary.amount     = Convert.ToInt32(textBoxAmount.Text);
                 salary.dtSalary   = Convert.ToDateTime(textBoxDate.Text);
                 salary.idPosition = (comboBoxPosition.SelectedItem as Position).id;
                 context.SaveChanges();
             }
             TextBoxManager.IsNotNullOrWhiteSpaceTextBoxes(this.Controls.OfType <TextBox>());
             this.comboBoxPosition.Text = string.Empty;
             InitializeDataGridView();
         }
     }
     catch { }
 }
        public void  FillClass()
        {
            string x    = txtId.Text;
            string d    = DateTime.Now.Day.ToString();
            string m    = DateTime.Now.Month.ToString();
            string y    = DateTime.Now.Year.ToString();
            string code = x + d + m + y;

            try
            {
                curentSalary = new Salary(code);
                isnew        = false;
            }
            catch
            {
                curentSalary.SalaryCoud = code;
                isnew = true;
                curentSalary.CodeWorker = txtId.Text;
                curentSalary.TimeEnter  = "0000";
                curentSalary.TimeLeave  = "0000";
                curentSalary.DateToday  = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString();
            }
        }
        public async Task <ActionResult> Create(Salary salary)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    await _salaryService.AddSalary(salary);

                    return(RedirectToAction("Index"));
                }

                var employees = Common.GetEmployees(_employeeService);
                ViewBag.EmployeeList = employees;
                return(View(salary));
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    int    index   = ex.InnerException.Message.IndexOf("UC_");
                    string message = ex.InnerException.Message;
                    if (index > 0)
                    {
                        message = message.Substring(0, index - 1);
                    }
                    ModelState.AddModelError("Error", "There was an error during: " + message);
                }
                else
                {
                    ModelState.AddModelError("Error", "There was an error during: " + ex.ToString());
                }

                var employees = Common.GetEmployees(_employeeService);
                ViewBag.EmployeeList = employees;
                return(View(salary));
            }
        }
Example #29
0
        private static void ReadXml(XmlReader reader, Salary salary)
        {
            // Read values into temporary locals, so that if an exception is thrown the object is not left
            // in an inconsistent state (eg. lower bound was changed, but upper was not).

            decimal?lBound = null;
            decimal?uBound = null;

            var readingAttribute = reader.MoveToFirstAttribute();

            while (readingAttribute)
            {
                switch (reader.LocalName)
                {
                case "minAmount":
                    lBound = ParseUtil.ParseUserInputDecimal(reader.Value, "minValue salary attribute");
                    break;

                case "maxAmount":
                    uBound = ParseUtil.ParseUserInputDecimal(reader.Value, "maxAmount salary attribute");
                    break;

                default:
                    throw new ApplicationException("Unexpected attribute '" + reader.LocalName + "' was found on the Salary element.");
                }

                readingAttribute = reader.MoveToNextAttribute();
            }

            reader.MoveToContent();
            reader.Read();

            salary.LowerBound = lBound;
            salary.UpperBound = uBound;
            salary.Rate       = XmlPersistenceRangeType;
            salary.Currency   = Currency.AUD;
        }
 /// <summary>
 /// 条件查询
 /// </summary>
 private void search_buttonSalary()
 {
     if (combox_search.SelectedItem == null)
     {
         MessageBox.Show("请先选择查询条件");
         return;
     }
     if (txt_search.Text != "" && (combox_search.SelectedItem).ToString() != "")
     {
         SalaryBLL salaryBLL = new SalaryBLL();
         Salary    salary    = null;
         salaryList.Clear();
         if (combox_search.SelectedIndex == 1)
         {
             if (!isInteger(txt_search.Text))
             {
                 MessageBox.Show("请输入数字");
                 txt_search.Text = "";
                 return;
             }
             int id = int.Parse(txt_search.Text);
             salary = salaryBLL.GetsalaryByID(id);
             if (salary != null)
             {
                 salaryList.Add(salary);
                 UserGrid.ItemsSource = salaryList;
             }
         }
         sum = salaryList.Count;
         SalaryBinding(maxnum, 1);
     }
     else
     {
         MessageBox.Show("查找方式和内容不能为空!");
     }
     txt_search.Text = "";
 }
Example #31
0
    protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response)
    {
        me.CurrentPostValue = postValue;

        string activityCode = this.Request.ActivityCode;  //活动节点编码

        if (activityCode == ActivityRK && actionName == "Submit")
        {
            dp.FillPerson(me, ProcessName);
        }
        if (activityCode == ActivityXJ && actionName == "Submit")
        {
            dp.FillPerson(me, ProcessName);
        }
        if (activityCode == ActivitySJ && actionName == "Submit")
        {
            me["工人"] = this.Request.ParticipantId;
        }

        updatePR(activityCode, actionName);
        //发起异常 是
        if (me["发起异常"] == "是")
        {
            me["OwnerId"] = this.Request.UserContext.UserId;
        }

        base.OnSubmit(actionName, postValue, response);
        //多阶段加工新方案升级机加工任务记录
        UpdateRecordForm(actionName, activityCode);

        if (activityCode == ActivityJY && actionName == "Submit")
        {
            Salary slr = new Salary(me.Engine, me.PostValue("ID"));
            slr.Save(ProcessName, false);
        }
        abnormalStep(me, postValue, response);
    }
        void show_inf()
        {
            Salary Salary_show = new Salary();

            mysql_database.inquire_inf(user_inf.id, ref data);
            this.id_input.Text                    = data.id;
            this.name_input.Text                  = data.basic_inf.name;
            this.sex_input.Text                   = data.basic_inf.sex;
            this.organization_input.Text          = data.basic_inf.organization;
            this.address_province_input.Text      = data.basic_inf.address_province;
            this.address_city_input.Text          = data.basic_inf.address_city;
            this.address_county_input.Text        = data.basic_inf.address_country;
            this.address_detailed_input.Text      = data.basic_inf.address_detailed;
            this.telephone_input.Text             = data.basic_inf.telephone;
            this.base_pay_input.Text              = data.salary_inf.base_pay.ToString();
            this.allowance_input.Text             = data.salary_inf.allowance.ToString();
            this.subsistence_allowance_input.Text = data.salary_inf.subsistence_allowance.ToString();
            this.telephone_bill_input.Text        = data.aggregate_inf.telephone_bill.ToString();
            this.water_electricity_input.Text     = data.aggregate_inf.water_electricity.ToString();
            this.the_rent_input.Text              = data.aggregate_inf.the_rent.ToString();
            this.income_tax_input.Text            = data.aggregate_inf.income_tax.ToString();
            this.sanitation_fee_input.Text        = data.aggregate_inf.sanitation_fee.ToString();
            this.accumulation_fund_input.Text     = data.aggregate_inf.accumulation_fund.ToString();
            Salary_show.salary                    = data.salary_inf.base_pay +
                                                    data.salary_inf.allowance +
                                                    data.salary_inf.subsistence_allowance + 0.00f;
            salary_show.Text      = Salary_show.salary.ToString();
            Salary_show.aggregate = data.aggregate_inf.telephone_bill +
                                    data.aggregate_inf.water_electricity +
                                    data.aggregate_inf.the_rent +
                                    data.aggregate_inf.income_tax +
                                    data.aggregate_inf.sanitation_fee +
                                    data.aggregate_inf.accumulation_fund + 0.0f;
            aggregate_show.Text = Salary_show.aggregate.ToString();
            Salary_show.payroll = Salary_show.salary - Salary_show.aggregate + 0.00f;
            payroll_show.Text   = Salary_show.payroll.ToString();
        }
Example #33
0
        public ActionResult Salary(string error = "")
        {
            var           a     = Request.Form["SalaryValue"].Split(','); //по порядку вывода // фореачем до events.count();
            int           index = 0;
            List <Salary> adder = new List <Salary>();

            foreach (Employee empl in _DataManager.EmR.GetCollection())
            {
                foreach (Event ev in _DataManager.EvR.GetCollection())
                {
                    Salary salary = new Salary();
                    salary.Employee        = empl;
                    salary.Event           = ev;
                    salary.PercentOfSalary = ev.Percent;
                    int nol;

                    salary.Value = Int32.TryParse(a[index++], out nol) == false?empl.Salary.Where(y => y.Employee.Id == empl.Id && y.Event.Id == ev.Id).Select(x => x.Value).FirstOrDefault() : nol;

                    adder.Add(salary);
                }
            }
            _DataManager.SalR.Add(adder);
            return(RedirectToAction("CompanyFinanses"));
        }
Example #34
0
        public frmSalaryExtraWorksEdit(int?_nSalaryExtraWorkID)
        {
            if (_nSalaryExtraWorkID.HasValue)
            {
                nSalaryExtraWorkID = (int)_nSalaryExtraWorkID;
            }

            oSalaryExtraWork = new Salary();
            if (oSalaryExtraWork.ErrorNumber != 0)
            {
                IsValid = false;
            }

            oEmployee = new Employee();
            if (oEmployee.ErrorNumber != 0)
            {
                IsValid = false;
            }

            if (IsValid)
            {
                InitializeComponent();
            }
        }
Example #35
0
        public Response <SalaryDto> Delete(Guid id)
        {
            Salary salary = _context.Salaries.Find(id);

            if (salary == null)
            {
                throw new RestException(HttpStatusCode.NotFound, new { Salary = "Not found" });
            }

            _context.Salaries.Remove(salary);
            var success = _context.SaveChanges() > 0;

            if (success)
            {
                return(new Response <SalaryDto>
                {
                    Data = null,
                    Message = "Salary removed successfully",
                    Time = DateTime.Now,
                    IsSuccess = true
                });
            }
            throw new Exception("Problem on deleting a salary");
        }
Example #36
0
 protected void ToString(StringBuilder sb)
 {
     sb.AppendFormat(
         "{0}: ad title: '{1}', location: '{2}', community id: {3}, community only: {4}, include synonyms: {5}, recency: {6}, sort order: {7}, reverse sort order: {8}, keywords: '{9}', advertiser: '{10}', salary range: {11}, job types: {12}, distance: {13}, industry ids: {14}, is flagged: {15}, has viewed: {16}, has notes: {17}, has applied: {18}",
         GetType().Name,
         AdTitle,
         Location == null ? null : (Location.IsCountry ? Location.Country.Name : Location.ToString()),
         CommunityId.HasValue ? CommunityId.ToString() : String.Empty,
         CommunityOnly.HasValue ? CommunityOnly.Value.ToString() : String.Empty,
         IncludeSynonyms,
         Recency,
         SortCriteria.SortOrder,
         SortCriteria.ReverseSortOrder,
         GetKeywords(),
         AdvertiserNameExpression == null ? "" : AdvertiserNameExpression.GetUserExpression(),
         Salary == null ? "(none)" : Salary.ToString(),
         JobTypes,
         Distance,
         IndustryIds == null ? null : string.Join(", ", (from i in IndustryIds select i.ToString()).ToArray()),
         IsFlagged,
         HasViewed,
         HasNotes,
         HasApplied);
 }
        public override string GetInfo()
        {
            bool   isExperience = (Experience > 0);
            bool   wasPublished = (NumberOfPublications > 0);
            string info         = GetFullName() + " - заведующий кафедрой \"" + Cathedra + "\"" + ", преподающий предмет \"" + Subject + "\"";

            if (isExperience)
            {
                info += " со стажем " + Experience + " лет и с зарплатой " + Salary.ToString("F2") + " рублей";
            }
            else
            {
                info += " без стажа и с зарплатой " + Salary.ToString("F2") + " рублей";
            }
            if (wasPublished)
            {
                info += ", публикаций - " + NumberOfPublications;
            }
            else
            {
                info += ", не имеет публикаций";
            }
            return(info);
        }
Example #38
0
        public static int Create(Salary pSalary)
        {
            SqlCommand SQLCmd = new SqlCommand();
            SQLCmd.CommandType = CommandType.StoredProcedure;
            SQLCmd.CommandText = "CreateSalary";
            SQLCmd.Parameters.Add("CandidateId", SqlDbType.Int).Value = pSalary.CandidateId;
            SQLCmd.Parameters.Add("FullTime", SqlDbType.Bit).Value = pSalary.FullTime;
            SQLCmd.Parameters.Add("PartTime", SqlDbType.Bit).Value = pSalary.PartTime;
            SQLCmd.Parameters.Add("Student", SqlDbType.Bit).Value = pSalary.Student;
            SQLCmd.Parameters.Add("Temp", SqlDbType.Bit).Value = pSalary.Temp;
            SQLCmd.Parameters.Add("NightShifts", SqlDbType.Bit).Value = pSalary.NightShifts;
            SQLCmd.Parameters.Add("DayShifts", SqlDbType.Bit).Value = pSalary.DayShifts;
            SQLCmd.Parameters.Add("Other", SqlDbType.Bit).Value = pSalary.Other;
            SQLCmd.Parameters.Add("TempWage", SqlDbType.Int).Value = pSalary.TempWage;
            SQLCmd.Parameters.Add("TempRateId", SqlDbType.Int).Value = pSalary.TempRateId;
            SQLCmd.Parameters.Add("PermWage", SqlDbType.Int).Value = pSalary.PermWage;
            SQLCmd.Parameters.Add("PermRateId", SqlDbType.Int).Value = pSalary.PermRateId;
            SQLCmd.Parameters.Add("Id", SqlDbType.Int).Direction = ParameterDirection.Output;
            BaseDataAccess.OpenConnection(SQLCmd);
            BaseDataAccess.ExecuteNonSelect(SQLCmd);
            BaseDataAccess.CloseConnection();

            return Convert.ToInt32(SQLCmd.Parameters["Id"].Value);
        }
Example #39
0
        public static Salary Parse(SqlDataReader dr)
        {
            Salary Salary = new Salary();

            Salary.Id = Convert.ToInt32(dr["Id"]);
            Salary.CandidateId = Convert.ToInt32(dr["CandidateId"]);

            Salary.FullTime = Convert.ToBoolean(dr["FullTime"]);
            Salary.PartTime = Convert.ToBoolean(dr["PartTime"]);
            Salary.Student = Convert.ToBoolean(dr["Student"]);
            Salary.Temp = Convert.ToBoolean(dr["Temp"]);
            Salary.NightShifts = Convert.ToBoolean(dr["NightShifts"]);
            Salary.DayShifts = Convert.ToBoolean(dr["DayShifts"]);
            Salary.Other = Convert.ToBoolean(dr["Other"]);

            Salary.TempWage = Convert.ToInt32(dr["TempWage"]);
            Salary.TempRateId = Convert.ToInt32(dr["TempRateId"]);
            Salary.SetTempRate(Convert.ToString(dr["TempRate"]));
            Salary.PermWage = Convert.ToInt32(dr["PermWage"]);
            Salary.PermRateId = Convert.ToInt32(dr["PermRateId"]);
            Salary.SetPermRate(Convert.ToString(dr["PermRate"]));

            return Salary;
        }
 private void AddSalaryTaxToDebug(Salary salary)
 {
     debugLookup[Organization.PPSE.FinancialAccounts.DebtsTax.Identity].Salaries -= salary.TaxTotalDecimal;
 }
 private void AddSalaryNetToDebug(Salary salary)
 {
     debugLookup[Organization.PPSE.FinancialAccounts.DebtsSalary.Identity].Salaries -= salary.NetSalaryDecimal;
 }
Example #42
0
 public static Salary CreateSalary(short yearID, string teamID, string lgID, string playerID)
 {
     Salary salary = new Salary();
     salary.yearID = yearID;
     salary.teamID = teamID;
     salary.lgID = lgID;
     salary.playerID = playerID;
     return salary;
 }
Example #43
0
 public void AddToSalaries(Salary salary)
 {
     base.AddObject("Salaries", salary);
 }
    private void AddSalaryEvent(int parentId, Salary salary, bool tax)
    {
        int newId = transactionEvents.Count + 1;

        transactionEvents.Add(new TransactionEvent(newId, parentId, (tax? "Tax for ": string.Empty) + "Salary #" + salary.Identity.ToString()));
        transactionEvents.Add(
            new TransactionEvent(newId + 1, newId,
                                 "To: " + salary.PayrollItem.Person.Canonical));
        transactionEvents.Add(
            new TransactionEvent(newId + 2, newId,
                                 "Payday: " + salary.PayoutDate.ToString("yyyy-MM-dd")));

        AddValidations(newId, salary);

        transactionEvents.Add(
            new TransactionEvent(transactionEvents.Count + 1, newId,
                         "Base Salary: " + salary.BaseSalaryDecimal.ToString("N2")));

        PayrollAdjustments adjustments = salary.Adjustments;

        foreach (PayrollAdjustment adjustment in adjustments)
        {
            if (adjustment.Type == PayrollAdjustmentType.GrossAdjustment)
            {
                transactionEvents.Add(
                    new TransactionEvent(transactionEvents.Count + 1, newId,
                                 adjustment.Description + ": " + adjustment.AmountDecimal.ToString("N2")));
            }
        }

        transactionEvents.Add(
            new TransactionEvent(transactionEvents.Count + 1, newId,
                         "Primary Income Tax: " + (-salary.SubtractiveTaxDecimal).ToString("N2")));

        foreach (PayrollAdjustment adjustment in adjustments)
        {
            if (adjustment.Type == PayrollAdjustmentType.NetAdjustment)
            {
                transactionEvents.Add(
                    new TransactionEvent(transactionEvents.Count + 1, newId,
                                 adjustment.Description + ": " + adjustment.AmountDecimal.ToString("N2")));
            }
        }

        transactionEvents.Add(
            new TransactionEvent(transactionEvents.Count + 1, newId,
                         "NET PAYOUT: " + salary.NetSalaryDecimal.ToString("N2")));

        transactionEvents.Add(
            new TransactionEvent(transactionEvents.Count + 1, newId,
                         "Additional Tax: " + salary.AdditiveTaxDecimal.ToString("N2")));

    }
 private void Reg()
 {
     Salary S = new Salary()
     {
         Cost = utility.ConvertCommaPrice(Txt_Cost.Text.Trim()),
         Description = Txt_Description.Text.Trim(),
         DateStart = Txt_DateStart.GeoDate.Value,
         DateFinish = Txt_DateFinish.GeoDate.Value,
         Date = Date.GeoDate.Value,
         Person = per
     };
     if (Combo_P.SelectedIndex != -1)
     {
         S.Project = ListProject.Single(p => p.ProjectID == Convert.ToInt32(Combo_P.SelectedValue));
     }
     ListSalary.Add(S);
     Grid_ListSalary.Rows.Add(++i, per.EmployeeFullName, per.EmployeeNationalCode, utility.ConvertPrice(S.Cost), per.EmployeeID, S.Id);
     per = null;
     ClearSalaryInfo();
     Txt_Fname.Focus();
 }