示例#1
0
    private void SaveDeposit()
    {
        depositManager   = new DepositManager(this);
        original_deposit = depositManager.GetDeposit(Convert.ToInt32(Page.ViewState["DepositId"]));
        deposit          = new Deposit();

        if (original_deposit != null)
        {
            deposit.CopyPropertiesFrom(original_deposit);
        }

        deposit.Name          = txtName.Text;
        deposit.CompanyId     = Company.CompanyId;
        deposit.PostalCode    = ucDepositAddress.PostalCode;
        deposit.AddressComp   = ucDepositAddress.AddressComp;
        deposit.AddressNumber = ucDepositAddress.AddressNumber;


        if (ucCurrFieldFirstWeekGoal.CurrencyValue.HasValue)
        {
            deposit.FirstWeekGoal = ucCurrFieldFirstWeekGoal.CurrencyValue.Value;
        }

        if (ucCurrFieldSecondWeekGoal.CurrencyValue.HasValue)
        {
            deposit.SecondWeekGoal = ucCurrFieldSecondWeekGoal.CurrencyValue.Value;
        }

        if (ucCurrFieldThirdWeekGoal.CurrencyValue.HasValue)
        {
            deposit.ThirdWeekGoal = ucCurrFieldThirdWeekGoal.CurrencyValue.Value;
        }

        if (ucCurrFieldForthWeekGoal.CurrencyValue.HasValue)
        {
            deposit.ForthWeekGoal = ucCurrFieldForthWeekGoal.CurrencyValue.Value;
        }

        if (ucCurrFieldFirstWeekGoal.CurrencyValue.HasValue)
        {
            deposit.FifthWeekGoal = ucCurrFieldFifthWeekGoal.CurrencyValue.Value;
        }

        if (ucCurrFieldMonthlyGoal.CurrencyValue.HasValue)
        {
            deposit.MonthlyGoal = ucCurrFieldMonthlyGoal.CurrencyValue.Value;
        }


        if (original_deposit != null)
        {
            depositManager.Update(original_deposit, deposit);
        }
        else
        {
            depositManager.Insert(deposit);
        }

        Response.Redirect("Deposits.aspx");
    }
示例#2
0
 protected void cboDeposit_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (var depositManager = new DepositManager(null))
     {
         Deposit deposit = depositManager.GetDeposit(Convert.ToInt32(cboDeposit.SelectedValue));
         Address1.PostalCode    = deposit.PostalCode;
         Address1.AddressNumber = deposit.AddressNumber;
         Address1.AddressComp   = deposit.AddressComp;
     }
 }
 public static bool DeleteDeposit(Int32 companyId, Int32 depositId)
 {
     bool result = true;
     using (DepositManager depositManager = new DepositManager(null))
     {
         try
         {
             depositManager.Delete(depositManager.GetDeposit(depositId));
         }
         catch (System.Data.SqlClient.SqlException e)
         {
             result = false;
         }
     }
     return result;
 }
示例#4
0
        public static bool DeleteDeposit(Int32 companyId, Int32 depositId)
        {
            bool result = true;

            using (DepositManager depositManager = new DepositManager(null))
            {
                try
                {
                    depositManager.Delete(depositManager.GetDeposit(depositId));
                }
                catch (System.Data.SqlClient.SqlException e)
                {
                    result = false;
                }
            }
            return(result);
        }
    private void SaveDeposit()
    {

        depositManager = new DepositManager(this);
        original_deposit = depositManager.GetDeposit(Convert.ToInt32(Page.ViewState["DepositId"]));
        deposit = new Deposit();

        if (original_deposit != null)
            deposit.CopyPropertiesFrom(original_deposit);

        deposit.Name = txtName.Text;
        deposit.CompanyId = Company.CompanyId;
        deposit.PostalCode = ucDepositAddress.PostalCode;
        deposit.AddressComp = ucDepositAddress.AddressComp;
        deposit.AddressNumber = ucDepositAddress.AddressNumber;


        if (ucCurrFieldFirstWeekGoal.CurrencyValue.HasValue)
            deposit.FirstWeekGoal = ucCurrFieldFirstWeekGoal.CurrencyValue.Value;

        if (ucCurrFieldSecondWeekGoal.CurrencyValue.HasValue)
            deposit.SecondWeekGoal = ucCurrFieldSecondWeekGoal.CurrencyValue.Value;

        if (ucCurrFieldThirdWeekGoal.CurrencyValue.HasValue)
            deposit.ThirdWeekGoal = ucCurrFieldThirdWeekGoal.CurrencyValue.Value;

        if (ucCurrFieldForthWeekGoal.CurrencyValue.HasValue)
            deposit.ForthWeekGoal = ucCurrFieldForthWeekGoal.CurrencyValue.Value;

        if (ucCurrFieldFirstWeekGoal.CurrencyValue.HasValue)
            deposit.FifthWeekGoal = ucCurrFieldFifthWeekGoal.CurrencyValue.Value;

        if(ucCurrFieldMonthlyGoal.CurrencyValue.HasValue)
            deposit.MonthlyGoal = ucCurrFieldMonthlyGoal.CurrencyValue.Value;


        if (original_deposit != null)
            depositManager.Update(original_deposit, deposit);
        else
            depositManager.Insert(deposit);

        Response.Redirect("Deposits.aspx");

    }
 protected void cboDeposit_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (var depositManager = new DepositManager(null))
     {
         Deposit deposit = depositManager.GetDeposit(Convert.ToInt32(cboDeposit.SelectedValue));
         Address1.PostalCode = deposit.PostalCode;
         Address1.AddressNumber = deposit.AddressNumber;
         Address1.AddressComp = deposit.AddressComp;
     }
 }