コード例 #1
0
        private void GridDelete_Click(object sender, RoutedEventArgs e)
        {
            if (grdLoanInsurance.SelectedValue == null)
            {
                //throw new Exception(Localize.ex_no_record_selected);
                throw new Exception();
            }

            //var msgResult =  MessageBox.Show(Localize.DeleteRecordMessage, Localize.DeleteRecordCaption, MessageBoxButton.YesNo, MessageBoxImage.Question);
            var msgResult = MessageBox.Show("error", "delete", MessageBoxButton.YesNoCancel);

            if (msgResult != MessageBoxResult.Yes)
            {
                return;
            }

            Guid ID = (grdLoanInsurance.SelectedValue as dynamic).Id;

            var DeletedItem = Business.GetPersonStructureDefineChildBusiness().GetByID(ID).FirstOrDefault();

            Business.GetPersonStructureDefineChildBusiness().Delete(DeletedItem);

            LoadGrid();
        }
コード例 #2
0
        /// <summary>
        /// فاکتور فروش
        /// </summary>
        /// <param name="storeOrder"></param>
        /// <param name="document"></param>
        public void SaveAutomaticForSaleReturnInvoice(StoreOrder storeOrder, AccountingDocument document)
        {
            try
            {
                var accountingArticles       = new List <Data.AccountingArticle>();
                var accountingTafsilArticles = new List <Data.AccountingTafsilArticle>();
                var dictionary = new Dictionary <Data.AccountingArticle, Data.AccountingTafsilArticle>();

                var company = Business.GetCompanyBusiness().GetById(storeOrder.IdCompany.Value);
                if (!company.IdAccountingTafsillevelsDetails.HasValue)
                {
                    throw new Exception(string.Format(Localize.ex_company_no_accountingtafsillevelsdetails, company.CName));
                }
                var storeOrderDetails = Business.GetStoreOrderDetailBusiness().GetByStoreOrderId(storeOrder.Id).ToList();

                var accountingArticle = new AccountingArticle()
                {
                    IDAccountingDocument = document.Id,
                    ADescription         = null,
                    ADebtor   = null,
                    ACreditor = storeOrder.OSumMoney,
                    ACount    = 1
                };
                accountingArticles.Add(accountingArticle);

                var companyTafsilLevelsDetail         = Business.GetAccountingTafsilLevelDetailBusiness().GetById(company.IdAccountingTafsillevelsDetails.Value);
                var companyTafsilLevel                = Business.GetAccountingTafsilLevelBusiness().GetById(companyTafsilLevelsDetail.IdAccountingTafsilLevels.Value);
                var companyAccountingMoeinTafsilLevel = Business.GetAccountingMoeinTafsilLevelBusiness().GetByIdAccountingTafsilLevels(companyTafsilLevel.Id);

                var accountingTafsilArticle = new AccountingTafsilArticle()
                {
                    IDAccountingMoein          = companyAccountingMoeinTafsilLevel.IdAccountingMoein,
                    IdAccountingTafsilLDetails = companyTafsilLevelsDetail.Id,
                    //IdAccountingTafsilLevels = tafsilLevel.Id
                };

                accountingTafsilArticles.Add(accountingTafsilArticle);

                dictionary.Add(accountingArticle, accountingTafsilArticle);

                var commodities = Business.GetGoodiesBusiness().GetByIds(storeOrderDetails.Select(r => r.IdCommodity).ToList()).ToList();
                if (commodities.Any(r => !r.IdAccountingTafsillevelsDetails.HasValue))
                {
                    throw new Exception(string.Format(Localize.ex_commodity_no_accountingtafsillevelsdetails, commodities.First(r => !r.IdAccountingTafsillevelsDetails.HasValue).CName));
                }
                var tafsilLevelsDetails         = Business.GetAccountingTafsilLevelDetailBusiness().GetByIds(commodities.Where(r => r.IdAccountingTafsillevelsDetails.HasValue).Select(r => r.IdAccountingTafsillevelsDetails.Value).ToList());
                var tafsilLevels                = Business.GetAccountingTafsilLevelBusiness().GetByIds(tafsilLevelsDetails.Where(r => r.IdAccountingTafsilLevels.HasValue).Select(r => r.IdAccountingTafsilLevels.Value).ToList());
                var accountingMoeinTafsilLevels = Business.GetAccountingMoeinTafsilLevelBusiness().GetByIdAccountingTafsilLevels(tafsilLevels.Select(r => r.Id).ToList()).ToList();

                foreach (var item in storeOrderDetails)
                {
                    accountingArticle = new AccountingArticle()
                    {
                        IDAccountingDocument = document.Id,
                        ADescription         = item.ODDescription,
                        ADebtor   = item.ODMoney,
                        ACreditor = null,
                        ACount    = item.ODCount
                    };
                    accountingArticles.Add(accountingArticle);

                    var commodity                  = commodities.Find(r => r.ID == item.IdCommodity);
                    var tafsilLevelDetail          = tafsilLevelsDetails.Find(r => r.Id == commodity.IdAccountingTafsillevelsDetails);
                    var tafsilLevel                = tafsilLevels.Find(r => r.Id == tafsilLevelDetail.IdAccountingTafsilLevels);
                    var accountingMoeinTafsilLevel = accountingMoeinTafsilLevels.Find(r => r.IdAccountingTafsilLevels == tafsilLevel.Id);

                    accountingTafsilArticle = new AccountingTafsilArticle()
                    {
                        IDAccountingMoein          = accountingMoeinTafsilLevel.IdAccountingMoein,
                        IdAccountingTafsilLDetails = tafsilLevelDetail.Id,
                        //IdAccountingTafsilLevels = tafsilLevel.Id
                    };
                    accountingTafsilArticles.Add(accountingTafsilArticle);

                    dictionary.Add(accountingArticle, accountingTafsilArticle);
                }
                this.Save(accountingArticles);

                foreach (var item in dictionary)
                {
                    item.Value.IdAccountingArticle = item.Key.ID;
                }

                Business.GetAccountingTafsilArticleBusiness().Save(accountingTafsilArticles);
            }
            catch
            {
                throw;
            }
        }
コード例 #3
0
 private bool HasChild(Data.GoodiesGroup entity)
 {
     try
     {
         return((entity.CodeTitleId == Common.Constants.CodeTitle.CommodityMainGroup && this.GetByParentId(entity.ID).Any()) ||
                (entity.CodeTitleId == Common.Constants.CodeTitle.CommoditySubsidiaryGroup && Business.GetGoodiesBusiness().GetByIdGoodiesGroup(entity.ID).Any()));
     }
     catch
     {
         throw;
     }
 }
コード例 #4
0
 public CompanyStructureDefineBusiness()
 {
     MainLen       = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.CompanyMainGroup).CodeLen;
     SubsidiaryLen = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.CompanySubsidiaryGroup).CodeLen;
 }
コード例 #5
0
 public Data.PayrollPersonSentence GetByID(Guid ID)
 {
     return(Business.GetPayrollPersonSentencesBusiness().GetAll().Where(r => r.ID == ID).FirstOrDefault());
 }
コード例 #6
0
 public IQueryable <Data.PayrollPersonSentence> GetByPersonID(Guid _personID)
 {
     return(Business.GetPayrollPersonSentencesBusiness().GetAll().Where(r => r.IDPayrollPerson == _personID));
 }
コード例 #7
0
 public TafsilStructureDefineBussiness()
 {
     TafsilGroupLen = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.TafsilGroup).CodeLen;
     AccountLen     = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.AccountGroup).CodeLen;
 }
コード例 #8
0
 private void FormLoad()
 {
     grdLoanInsurance.ItemsSource = Business.GetLoanInsuranceBusiness().GetAll();
 }
コード例 #9
0
 private void FormLoad()
 {
     grdLoanTax.ItemsSource = Business.GetLoanTaxBusiness().GetAll();
 }