Exemple #1
0
 public void LoadEditData(FinDetails detail)
 {
     if (detail == null) return;
     this.Tag = detail;
     this.EventNameTxt.Text = detail.Description;
     this.EventTimeTxt.Text = detail.FinDate;
     this.RemarkTxt.Text = detail.Remark;
     this.OrderNoTxt.Text = detail.OrderNo;
     this.TotalAmount.Text = detail.TotalAmount.ToString("#,##0.00");
     this.AmountTxt.Text = detail.Amount.ToString("#,##0.00");
     AliHelperUtils.LoadAppDicComboBoxValue(this.EventTypeTxt, detail.EventType);
     AliHelperUtils.LoadAppDicComboBoxValue(this.ItemTypeTxt, detail.ItemType);
     AliHelperUtils.LoadAppDicComboBoxValue(this.CurrenyTxt, detail.Currency);
     AliHelperUtils.LoadAppDicComboBoxValue(this.AssociationTxt, detail.Association);
 }
Exemple #2
0
 private void Confirm_Click(object sender, EventArgs e)
 {
     FinDetails detail = new FinDetails();
     if (this.Tag == null)
     {
         detail = new FinDetails();
     }
     else
     {
         detail = (FinDetails)this.Tag;
     }
     detail.Description = this.EventNameTxt.Text.Trim();
     detail.EventType = ((AppDic)this.EventTypeTxt.SelectedItem).Key;
     detail.FinDate = this.EventTimeTxt.Value.ToString(Constants.DateFormat);
     detail.ItemType = ((AppDic)this.ItemTypeTxt.SelectedItem).Key; ;
     detail.Remark = this.RemarkTxt.Text.Trim();
     detail.OrderNo = this.OrderNoTxt.Text.Trim();
     detail.Association = ((AppDic)this.AssociationTxt.SelectedItem).Key;
     detail.Rate = Convert.ToDouble(this.RateTxt.Text.Trim());
     detail.Currency = ((AppDic)this.CurrenyTxt.SelectedItem).Key;
     detail.Amount = Convert.ToDouble(this.AmountTxt.Text);
     if (detail.Amount == 0)
     {
         return;
     }
     if (string.IsNullOrEmpty(detail.Description))
     {
         return;
     }
     if (string.IsNullOrEmpty(detail.Association))
     {
         return;
     }
     List<FinDetails> list = new List<FinDetails>();
     list.Add(detail);
     finOrderManager.InsertOrUpdateDetails(list);
     list.Clear();
     list = null;
     this.Close();
 }
Exemple #3
0
 public List<FinDetails> DetailTableToList(DataTable dt)
 {
     List<FinDetails> list = new List<FinDetails>();
     foreach (DataRow row in dt.Rows)
     {
         FinDetails info = new FinDetails();
         info.DetailId = Convert.ToInt32(row["DetailId"]);
         info.FinId = Convert.ToInt32(row["FinId"]);
         info.FinDate = (string)row["FinDate"];
         info.Description = (string)row["Description"];
         info.EventType = (string)row["EventType"];
         info.Amount = Convert.ToDouble(row["Amount"]);
         info.Currency = (string)row["Currency"];
         info.TotalAmount = Convert.ToDouble(row["TotalAmount"]);
         info.Rate = Convert.ToDouble(row["Rate"]);
         info.Association = (string)row["Association"];
         info.OrderNo = (string)row["OrderNo"];
         info.ItemType = (string)row["ItemType"];
         info.Remark = Convert.IsDBNull(row["Remark"])?"": (string)row["Remark"];
         list.Add(info);
     }
     return list;
 }
Exemple #4
0
 public void InsertOrUpdateDetails(FinDetails detail)
 {
     List<FinDetails> list = new List<FinDetails>();
     list.Add(detail);
     financeDao.InsertOrUpdateDetails(list);
     list.Clear();
     list = null;
     FireEditFinDetailEvent(detail);
 }
Exemple #5
0
        private void Confirm_Click(object sender, EventArgs e)
        {
            Finance finance;
            if (this.Tag == null)
            {
                finance = new Finance();
            }
            else
            {
                finance = (Finance)this.Tag;
            }
            finance.Description = this.Description.Text.Trim();
            finance.EventType = ((AppDic)this.EventType.SelectedItem).Key;
            finance.FinDate = this.FinDate.Value.ToString(Constants.DateFormat);
            finance.ItemType = ((AppDic)this.ItemType.SelectedItem).Key; ;
            finance.Remark = this.Remark.Text.Trim();
            finance.Association = ((AppDic)this.Association.SelectedItem).Key;
            finance.Rate = Convert.ToDouble(this.Rate.Text.Trim());
            finance.Currency = ((AppDic)this.Curreny.SelectedItem).Key;
            finance.Amount = Convert.ToDouble(this.Amount.Text);
            finance.ReceivePaymentor = this.ReceivePaymentor.Text.Trim();
            finance.Account = ((AppDic)this.Account.SelectedItem).Key;
            finance.ReferenceNo = this.ReferenceNo.Text.Trim();
            finance.Customer = this.Customer.Text.Trim();
            if (finance.Amount == 0)
            {
                return;
            }
            if (string.IsNullOrEmpty(finance.Description))
            {
                return;
            }
            if (string.IsNullOrEmpty(finance.Association))
            {
                return;
            }
            bool HasError = false;
            List<FinDetails> details = new List<FinDetails>();

            foreach (DataGridViewRow row in DetailView.Rows)
            {
                string desc = (string)row.Cells["DetailDescription"].Value;
                if (string.IsNullOrEmpty(desc))
                {
                    HasError = true;
                    row.Cells["DetailDescription"].ErrorText = "不能为空";
                }
                string orderNo = (string)row.Cells["DetailOrderNo"].Value;
                if (string.IsNullOrEmpty(orderNo))
                {
                    HasError = true;
                    row.Cells["DetailOrderNo"].ErrorText = "不能为空";
                }
                double amount = Convert.ToDouble(row.Cells["DetailAmount"].Value);
                if (amount == 0.00)
                {
                    HasError = true;
                    row.Cells["DetailAmount"].ErrorText = "不能为零";
                }
                string association = (string)row.Cells["DetailAssociation"].Value;
                if (string.IsNullOrEmpty(association))
                {
                    HasError = true;
                    row.Cells["DetailAssociation"].ErrorText = "不能为空";
                }
                string remark = (string)row.Cells["DetailRemark"].Value;
                FinDetails detail = new FinDetails();
                detail.FinId = finance.FinId;
                detail.FinDate = finance.FinDate;
                detail.ItemType = finance.ItemType;
                detail.EventType = finance.EventType;
                detail.Currency = finance.Currency;
                detail.Rate = finance.Rate;
                detail.Description = desc;
                detail.OrderNo = orderNo;
                detail.Amount = amount;
                detail.Association = association;
                detail.Remark = remark;
                details.Add(detail);
            }
            if (HasError)
            {
                return;
            }
            finance.Details = details;
            finOrderManager.InsertOrUpdateFinance(finance);
            this.Close();
        }