Example #1
0
        public bool updateAccountItemTaxRateSetting(long id, Dictionary <string, object> dic)
        {
            bool ret = false;

            using (NaNaEntities db = new NaNaEntities()) {
                AccountItemTaxRateSetting a = db.AccountItemTaxRateSetting.AsQueryable().First(x => x.id == id);

                if (a != null)
                {
                    Type cl = a.GetType();

                    foreach (var obj in dic)
                    {
                        if (cl.GetProperty(obj.Key) != null)
                        {
                            cl.GetProperty(obj.Key).SetValue(a, obj.Value);
                        }
                    }

                    db.SaveChanges();
                    ret = true;
                }
            }

            return(ret);
        }
Example #2
0
        public AccountItemTaxRateSetting getAccountItemTaxRateSetting(long id)
        {
            AccountItemTaxRateSetting ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.AccountItemTaxRateSetting.FirstOrDefault(x => x.id == id);
            }

            return(ret);
        }
Example #3
0
        public AccountItemTaxRateSetting addAccountItemTaxRateSetting(AccountItemTaxRateSetting a)
        {
            AccountItemTaxRateSetting ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.AccountItemTaxRateSetting.Add(a);
                db.SaveChanges();
            }

            return(ret);
        }
Example #4
0
        public bool deleteAccountItemTaxRateSetting(long id)
        {
            bool ret = false;

            using (NaNaEntities db = new NaNaEntities()) {
                AccountItemTaxRateSetting a = db.AccountItemTaxRateSetting.FirstOrDefault(x => x.id == id);

                if (a == null)
                {
                    return(false);
                }

                db.AccountItemTaxRateSetting.Remove(a);

                db.SaveChanges();

                ret = true;
            }

            return(ret);
        }
        protected void btn_paymentItemSetting_add_Click(object sender, EventArgs e)
        {
            this.lt_paymentItemSetting_msg.Text = "";

            /* validate form */

            if (string.IsNullOrEmpty(this.ddl_paymentItemSetting_accountItem.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("請選擇會計科目");
                return;
            }

            if (string.IsNullOrEmpty(this.ddl_paymentItemSetting_type.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("請選擇費用類型");
                return;
            }

            if (string.IsNullOrEmpty(this.txt_paymentItemSetting_foreignRate.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("請輸入外國人所得稅率");
                return;
            }

            if (string.IsNullOrEmpty(this.txt_paymentItemSetting_localRate.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("請輸入本國人所得稅率");
                return;
            }


            /*
             * if (string.IsNullOrEmpty(this.txt_paymentItemSetting_memo.Text)) {
             *  this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("請輸入說明文字");
             *  return;
             * }*/


            if (string.IsNullOrEmpty(this.txt_paymentItemSetting_name.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("品項不能為空值");
                return;
            }


            if (string.IsNullOrEmpty(this.txt_paymentItemSetting_secondNHITaxRate.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("二代健保稅率不能為空值");
                return;
            }

            if (string.IsNullOrEmpty(this.txt_paymentItemSetting_taxRate.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("稅率不能為空值");
                return;
            }

            /* add account item */
            List <AccountItemViewModel.XXX_EP_ACC_COMB_V> accCombVList = this.accountItemSvc.getAccCombVList();

            if (!accCombVList.Exists(x => x.ACC_COMB_2 == this.ddl_paymentItemSetting_accountItem.SelectedValue))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("selected  ACC_COMB_2 value is not exist");
                return;
            }
            AccountItemTaxRateSetting acc = new AccountItemTaxRateSetting();

            acc.accountNo            = this.ddl_paymentItemSetting_accountItem.SelectedValue;
            acc.accountName          = accCombVList.First(x => x.ACC_COMB_2 == acc.accountNo).ACC_COMB_2_NAME;
            acc.applyTypeKey         = this.ddl_paymentItemSetting_type.SelectedValue;
            acc.dateCreated          = DateTime.Now;
            acc.deleted              = false;
            acc.foreignIncomeTaxRate = Math.Round(float.Parse(this.txt_paymentItemSetting_foreignRate.Text), 2);
            acc.itemName             = this.txt_paymentItemSetting_name.Text.Trim();
            acc.localIncomeTaxRate   = Math.Round(float.Parse(this.txt_paymentItemSetting_localRate.Text), 2);
            acc.memo             = this.txt_paymentItemSetting_memo.Text;
            acc.secondNHITaxRate = Math.Round(float.Parse(this.txt_paymentItemSetting_secondNHITaxRate.Text), 2);
            acc.taxRate          = Math.Round(float.Parse(this.txt_paymentItemSetting_taxRate.Text), 2);
            acc.needCountersign  = this.chk_paymentItemSetting_needCountersign.Checked;
            acc.code             = this.txt_paymentItemSetting_code.Text;

            AccountItemViewModel.AccountItemTaxRateSettingResult accRet = this.accountItemSvc.addAccountItemTaxRateSetting(acc);

            if (accRet.success)
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("新增成功");
                this.clearForm();
                this.reloadAccountList();
            }
            else
            {
                this.lt_paymentItemSetting_msg.Text = accRet.resultException;
            }
        }
Example #6
0
 public AccountItemTaxRateSettingResult() : base()
 {
     this.acc = null;
 }