Exemple #1
0
        public static PayrollAdjustment Create(PayrollItem item, PayrollAdjustmentType type, double amount,
                                               string description)
        {
            int id = SwarmDb.GetDatabaseForWriting().CreatePayrollAdjustment(item.Identity, type, amount, description);

            return(FromIdentity(id));
        }
 public BasicPayrollAdjustment (int payrollAdjustmentId, int payrollItemId, PayrollAdjustmentType type, Int64 amountCents,
     string description, bool open, int salaryId)
 {
     this.PayrollAdjustmentId = payrollAdjustmentId;
     this.PayrollItemId = payrollItemId;
     this.Type = type;
     this.AmountCents = amountCents;
     this.Description = description;
     this.Open = open;
     this.SalaryId = salaryId;
 }
 public BasicPayrollAdjustment(int payrollAdjustmentId, int payrollItemId, PayrollAdjustmentType type, Int64 amountCents,
                               string description, bool open, int salaryId)
 {
     this.PayrollAdjustmentId = payrollAdjustmentId;
     this.PayrollItemId       = payrollItemId;
     this.Type        = type;
     this.AmountCents = amountCents;
     this.Description = description;
     this.Open        = open;
     this.SalaryId    = salaryId;
 }
Exemple #4
0
 public BasicPayrollAdjustment(int payrollAdjustmentId, int payrollItemId, PayrollAdjustmentType type,
                               Int64 amountCents,
                               string description, bool open, int salaryId)
 {
     PayrollAdjustmentId = payrollAdjustmentId;
     PayrollItemId       = payrollItemId;
     Type        = type;
     AmountCents = amountCents;
     Description = description;
     Open        = open;
     SalaryId    = salaryId;
 }
    protected void ButtonAdd_Click(object sender, EventArgs e)
    {
        if (!_authority.HasPermission(Permission.CanManagePayroll, _payrollItem.OrganizationId, -1, Authorization.Flag.ExactOrganization))
        {
            ScriptManager.RegisterStartupScript(this, Page.GetType(), "getlost",
                                                "alert ('You do not have access to change payroll records.');", true);
            return;
        }

        if (!Page.IsValid)
        {
            return;
        }

        string description         = this.TextDescription.Text;
        string amount              = this.TextAmount.Text;
        PayrollAdjustmentType type = (PayrollAdjustmentType)Int32.Parse(this.DropType.SelectedValue);

        amount = amount.Replace(",", ".");  // compensate for cultures

        double adjustmentAmount;

        bool success = Double.TryParse(amount, NumberStyles.Any, CultureInfo.InvariantCulture, out adjustmentAmount);

        if (!success)
        {
            ScriptManager.RegisterStartupScript(this, Page.GetType(), "getlost",
                                                "alert ('Unable to parse the amount.');", true);
            return;
        }

        PayrollAdjustment.Create(_payrollItem, type, adjustmentAmount, description);

        this.TextDescription.Text   = string.Empty;
        this.TextAmount.Text        = string.Empty;
        this.DropType.SelectedIndex = 0;

        PopulateGrid();
    }
        public int CreatePayrollAdjustment(int payrollItemId, PayrollAdjustmentType type, double amount, string description)
        {
            if (description.Length > 128)
            {
                description = description.Substring(0, 128);
            }

            using (DbConnection connection = GetMySqlDbConnection())
            {
                connection.Open();

                DbCommand command = GetDbCommand("CreatePayrollAdjustment", connection);
                command.CommandType = CommandType.StoredProcedure;

                AddParameterWithName(command, "payrollItemId", payrollItemId);
                AddParameterWithName(command, "payrollAdjustmentTypeId", (int)type);
                AddParameterWithName(command, "amount", amount);
                AddParameterWithName(command, "description", description);

                return(Convert.ToInt32(command.ExecuteScalar()));
            }
        }
        public int CreatePayrollAdjustment(int payrollItemId, PayrollAdjustmentType type, double amount, string description)
        {
            if (description.Length > 128)
            {
                description = description.Substring(0, 128);
            }

            using (DbConnection connection = GetMySqlDbConnection())
            {
                connection.Open();

                DbCommand command = GetDbCommand("CreatePayrollAdjustment", connection);
                command.CommandType = CommandType.StoredProcedure;

                AddParameterWithName(command, "payrollItemId", payrollItemId);
                AddParameterWithName(command, "payrollAdjustmentTypeId", (int)type);
                AddParameterWithName(command, "amount", amount);
                AddParameterWithName(command, "description", description);

                return Convert.ToInt32(command.ExecuteScalar());
            }
        }
 public static PayrollAdjustment Create (PayrollItem item, PayrollAdjustmentType type, double amount, string description)
 {
     int id = SwarmDb.GetDatabaseForWriting().CreatePayrollAdjustment(item.Identity, type, amount, description);
     return PayrollAdjustment.FromIdentity(id);
 }
Exemple #9
0
 public void CreateAdjustment(PayrollAdjustmentType type, double amount, string description)
 {
     PayrollAdjustment.Create(this, type, amount, description);
 }