private void txtCompanyCode_Leave(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtCompanyCode.Text.Trim())) { BaseCompanyTable Company = new BaseCompanyTable(); BCompany bCompany = new BCompany(); Company = bCompany.GetModel(this.txtCompanyCode.Text); if (Company == null || "".Equals(Company)) { txtCompanyCode.Focus(); txtCompanyCode.Text = ""; txtCompanyName.Text = ""; MessageBox.Show("公司编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { txtCompanyCode.Text = Company.CODE; txtCompanyName.Text = Company.NAME; } } else { txtCompanyName.Text = ""; } }
protected void Page_Load(object sender, EventArgs e) { // 获取用户易游通权限列表 if (Request["SystemUserId"] != null) { UserPermissions = BUser.CreateInstance().GetUserPermission(1, Convert.ToInt32(Request["SystemUserId"].ToString())); } // 获取公司基本信息业务实体 MCompanyInfos = BCompany.CreateInstance().GetCompanyList(0, (int)EyouSoft.OpenRelation.Model.SystemType.Platform, SiteUserInfo.CompanyID); // 系统公司编号 if (MCompanyInfos != null && MCompanyInfos.Count() > 0) { foreach (MCompanyInfo info in MCompanyInfos) { // 属于易游通 if (((int)EyouSoft.OpenRelation.Model.SystemType.YYT).Equals(info.SystemCompanyType)) { SystemCompanyId = info.SystemCompanyId; } } } // 取得域名 GetDomainName(); }
public void Delete() { bool result = false; BUserCompany bUserCompany = new BUserCompany(); EUserCompany eUserCompany = new EUserCompany(); EUserCompany insertedUserCompany = new EUserCompany(); EUserCompany deletedUserCompany = new EUserCompany(); BCorporation bCorporation = new BCorporation(); ECorporation eCorporation = new ECorporation(); BCompany bCompany = new BCompany(); ECompany eCompany = new ECompany(); BUser bUser = new BUser(); EUser eUser = new EUser(); TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew); eCorporation.CodeCorporation = Aleatory.GetString(2); eCorporation.Name = Aleatory.GetString(15); eCorporation.State = Aleatory.GetShort(); eCorporation.Audit.UserRegister = Aleatory.GetString(8); bCorporation.Insert(eCorporation); eCompany.CodeCompany = Aleatory.GetString(2); eCompany.CodeCorporation = eCorporation.CodeCorporation; eCompany.Ruc = Aleatory.GetString(11); eCompany.LongName = Aleatory.GetString(15); eCompany.State = Aleatory.GetShort(); eCompany.Audit.UserRegister = Aleatory.GetString(8); bCompany.Insert(eCompany); eUser.CodeUser = Aleatory.GetString(8); eUser.Name = Aleatory.GetString(8); eUser.Password = Aleatory.GetString(8); eUser.State = Aleatory.GetShort(); eUser.Audit.UserRegister = Aleatory.GetString(8); bUser.Insert(eUser); eUserCompany.CodeUser = eUser.CodeUser; eUserCompany.CodeCompany = eCompany.CodeCompany; bUserCompany.Insert(eUserCompany); insertedUserCompany = bUserCompany.Select(eUserCompany); if (insertedUserCompany != null) { bUserCompany.Delete(eUserCompany); } deletedUserCompany = bUserCompany.Select(eUserCompany); if (deletedUserCompany == null) { result = true; } Assert.IsTrue(result); }
public void Update() { short routes = 0; BAudit bAudit = new BAudit(); EAudit eAudit = null; BCompany bCompany = new BCompany(); ECompany eCompany = new ECompany(); ECompany updatedCompany = new ECompany(); BCorporation bCorporation = new BCorporation(); ECorporation eCorporation = new ECorporation(); TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew); eCorporation.CodeCorporation = Aleatory.GetString(2); eCorporation.Name = Aleatory.GetString(8); eCorporation.State = Aleatory.GetShort(); eCorporation.Audit.UserRegister = Aleatory.GetString(8); bCorporation.Insert(eCorporation); eCompany.CodeCompany = Aleatory.GetString(2); eCompany.Ruc = Aleatory.GetString(11); eCompany.CodeCorporation = eCorporation.CodeCorporation; eCompany.LongName = Aleatory.GetString(8); eCompany.State = Aleatory.GetShort(); eCompany.Audit.UserRegister = Aleatory.GetString(8); bCompany.Insert(eCompany); eCompany.LongName = Aleatory.GetString(8); eCompany.State = Aleatory.GetShort(); eCompany.Audit.UserRegister = Aleatory.GetString(8); bCompany.Update(eCompany); updatedCompany = bCompany.Select(eCompany); if (updatedCompany != null && updatedCompany.CodeCompany == eCompany.CodeCompany && updatedCompany.CodeCorporation == eCompany.CodeCorporation && updatedCompany.LongName != eCompany.LongName && updatedCompany.State == eCompany.State) { routes++; } eAudit = bAudit.Select(eCompany.Audit). Where(x => x.UserRegister == eCompany.Audit.UserRegister && x.Code == eCompany.Audit.Code && x.TypeEvent == "Update").FirstOrDefault(); if (eAudit != null) { routes++; } ts.Dispose(); }
public List <CompanyModel> List() { var companyBussines = new BCompany(); var companiesModel = new List <CompanyModel>(); var companiesEntity = companyBussines.List(); foreach (var companyEntity in companiesEntity) { var companyModel = helperSession.mapping.CreateMapper().Map <ECompany, CompanyModel>(companyEntity); companiesModel.Add(companyModel); } return(companiesModel); }
public bool BCommpanyInfoAddScreen() { Console.WriteLine("Lütfen Bilgilerinizi Giriniz."); Console.Write("Ad : "); string name = Console.ReadLine(); Console.Write("Soyad : "); string surname = Console.ReadLine(); Console.Write("Eğitim Durumu : "); string educationStatus = Console.ReadLine(); Console.Write("Telefon Numarası : "); string gsm = Console.ReadLine(); if (!string.IsNullOrEmpty(gsm)) { var generateRandomCode = _otpService.GenerateCode(); Console.WriteLine(string.Format("Lütfen Size İletilen Kodu Giriniz Kodunuz : {0}", generateRandomCode)); string otpCode = Console.ReadLine(); if (otpCode != generateRandomCode) { Console.Write("Doğrulama Başarısız.Lütfen Tekrar Deneyiniz."); return(false); } else { Console.WriteLine("Doğrulama Başarılı"); BCompany bCompany = new BCompany() { Name = name, Surname = surname, EducationStatus = educationStatus, GSM = gsm, IsVerification = true }; Add(bCompany); Console.WriteLine(string.Format("Ad : {0} - Soyad : {1} - Eğitim Durumu : {2} - GSM : {3}", name, surname, educationStatus, gsm)); return(true); } } else { Console.Write("Lütfen GSM Bilginizi Giriniz."); return(false); } }
public void Delete() { short routes = 0; BAudit bAudit = new BAudit(); EAudit eAudit = null; BCompany bCompany = new BCompany(); ECompany eCompany = new ECompany(); BCorporation bCorporation = new BCorporation(); ECorporation eCorporation = new ECorporation(); TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew); eCorporation.CodeCorporation = Aleatory.GetString(2); eCorporation.Name = Aleatory.GetString(8); eCorporation.State = 1; eCorporation.Audit.UserRegister = Aleatory.GetString(8); bCorporation.Insert(eCorporation); eCompany.CodeCompany = Aleatory.GetString(2); eCompany.Ruc = Aleatory.GetString(11); eCompany.CodeCorporation = eCorporation.CodeCorporation; eCompany.LongName = Aleatory.GetString(8); eCompany.State = Aleatory.GetShort(); eCompany.Audit.UserRegister = Aleatory.GetString(8); bCompany.Insert(eCompany); if (bCompany.Select(eCompany) != null) { routes++; } bCompany.Delete(eCompany); if (bCompany.Select(eCompany) == null) { routes++; } eAudit = bAudit.Select(eCompany.Audit). Where(x => x.UserRegister == eCompany.Audit.UserRegister && x.TypeEvent == "Delete" && x.Code == eCompany.Audit.Code).FirstOrDefault(); if (eAudit != null) { routes++; } ts.Dispose(); Assert.AreEqual(routes, 3); }
public void Select() { short routes = 0; BCompany bCompany = new BCompany(); ECompany eCompany = new ECompany(); BCorporation bCorporation = new BCorporation(); ECorporation eCorporation = new ECorporation(); ECompany selectCompany = new ECompany(); TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew); eCompany.CodeCompany = Aleatory.GetString(2); eCompany.Ruc = Aleatory.GetString(11); eCompany.LongName = Aleatory.GetString(8); eCompany.ShortName = Aleatory.GetString(8); eCompany.State = 1; eCompany.Audit.UserRegister = Aleatory.GetString(8); selectCompany = bCompany.Select(eCompany); if (selectCompany == null) { routes++; } eCorporation.CodeCorporation = Aleatory.GetString(2); eCorporation.Name = Aleatory.GetString(8); eCorporation.State = 1; eCorporation.Audit.UserRegister = "uni test"; bCorporation.Insert(eCorporation); eCompany.CodeCorporation = eCorporation.CodeCorporation; bCompany.Insert(eCompany); selectCompany = bCompany.Select(eCompany); if (selectCompany != null && selectCompany.LongName == eCompany.LongName && selectCompany.ShortName == eCompany.ShortName) { routes++; } ts.Dispose(); Assert.AreEqual(routes, 2); }
//#region SLIP_TYPE存在的Check //public string CheckSlipType(string typecode, string title) //{ // if (typecode == null || "".Equals(typecode)) // { // return title + ERROR_NULL; // } // if (_slipTypeTable[typecode.ToString()] != null) // { // return ""; // } // BSlipType bSlipType = new BSlipType(); // if (bSlipType.Exists("ORDER", typecode)) // { // _slipTypeTable.Add(typecode, typecode); // return ""; // } // return title + ERROR_EXIST; //} //#endregion #region 公司存在的Check public string CheckCompany(string company, string title) { if (company == null || "".Equals(company)) { return(title + ERROR_NULL); } if (_companyTable[company.ToString()] != null) { return(""); } BCompany bCompany = new BCompany(); if (bCompany.Exists(company)) { _companyTable.Add(company, company); return(""); } return(title + ERROR_EXIST); }
public void DeleteByUser() { bool result = false; List <ECompany> listECompanies = new List <ECompany>(); BUserCompany bUserCompany = new BUserCompany(); EUserCompany eUserCompany = new EUserCompany(); EUserCompany insertedOneUserCompany = new EUserCompany(); EUserCompany insertedTwoUserCompany = new EUserCompany(); BCorporation bCorporation = new BCorporation(); ECorporation eCorporation = new ECorporation(); BCompany bCompany = new BCompany(); ECompany eCompany = new ECompany(); BUser bUser = new BUser(); EUser eUser = new EUser(); TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew); eCorporation.CodeCorporation = Aleatory.GetString(2); eCorporation.Name = Aleatory.GetString(15); eCorporation.State = Aleatory.GetShort(); eCorporation.Audit.UserRegister = Aleatory.GetString(8); bCorporation.Insert(eCorporation); eCompany.CodeCompany = Aleatory.GetString(2); eCompany.CodeCorporation = eCorporation.CodeCorporation; eCompany.Ruc = Aleatory.GetString(11); eCompany.LongName = Aleatory.GetString(15); eCompany.State = Aleatory.GetShort(); eCompany.Audit.UserRegister = Aleatory.GetString(8); bCompany.Insert(eCompany); eUser.CodeUser = Aleatory.GetString(8); eUser.Name = Aleatory.GetString(8); eUser.Password = Aleatory.GetString(8); eUser.State = Aleatory.GetShort(); eUser.Audit.UserRegister = Aleatory.GetString(8); bUser.Insert(eUser); eUserCompany.CodeUser = eUser.CodeUser; eUserCompany.CodeCompany = eCompany.CodeCompany; bUserCompany.Insert(eUserCompany); insertedOneUserCompany = bUserCompany.Select(eUserCompany); eCompany.CodeCompany = Aleatory.GetString(2); eCompany.CodeCorporation = eCorporation.CodeCorporation; eCompany.LongName = Aleatory.GetString(15); eCompany.State = Aleatory.GetShort(); eCompany.Audit.UserRegister = Aleatory.GetString(8); bCompany.Insert(eCompany); eUserCompany.CodeUser = eUser.CodeUser; eUserCompany.CodeCompany = eCompany.CodeCompany; bUserCompany.Insert(eUserCompany); insertedTwoUserCompany = bUserCompany.Select(eUserCompany); listECompanies = bUserCompany.SelectByUser(eUser); if (listECompanies.Count == 2 && listECompanies.Exists(x => x.CodeCompany == insertedOneUserCompany.CodeCompany) && listECompanies.Exists(x => x.CodeCompany == insertedTwoUserCompany.CodeCompany)) { bUserCompany.DeleteByUser(eUser); } listECompanies = bUserCompany.SelectByUser(eUser); if (listECompanies.Count == 0) { result = true; } Assert.IsTrue(result); }
public void Update(BCompany model) { _bCompanyDal.Update(model); }
public void Delete(BCompany model) { _bCompanyDal.Delete(model); }
public void Add(BCompany model) { _bCompanyDal.Add(model); }
private void btnPurcahse_Click(object sender, EventArgs e) { if (dgvData.SelectedRows.Count > 0) { Hashtable ht = null; DataTable dt = null; DataGridViewRow row = dgvData.SelectedRows[0]; BaseCompanyTable company = new BCompany().GetModel(_userInfo.COMPANY_CODE); BllPurchaseOrderTable purchase = bPurchaseOrder.GetModel(CConvert.ToString(row.Cells["SLIP_NUMBER"].Value)); BllOrderHeaderTable order = new BOrderHeader().GetModel(purchase.ORDER_SLIP_NUMBER); BaseWarehouseTable warehouse = new BWarehouse().GetModel(purchase.RECEIPT_WAREHOUSE_CODE); if (company == null) { company = new BaseCompanyTable(); } if (warehouse == null) { warehouse = new BaseWarehouseTable(); } if (purchase == null) { purchase = new BllPurchaseOrderTable(); } BaseSupplierTable supplier = new BSupplier().GetModel(purchase.SUPPLIER_CODE); if (supplier.TYPE == 2) { #region 国内 ht = new Hashtable(); ht.Add("&COMPANY_NAME", company.NAME); ht.Add("&ADDRESS", company.ADDRESS_FIRST + company.ADDRESS_MIDDLE + company.ADDRESS_LAST); if (string.IsNullOrEmpty(company.PHONE_NUMBER.ToString())) { ht.Add("&PHONE", "TEL " + "FAX" + company.FAX_NUMBER); } else { ht.Add("&PHONE", "TEL" + company.PHONE_NUMBER.ToString() + "FAX" + company.FAX_NUMBER); } ht.Add("&SLIP_NUMBER", purchase.SLIP_NUMBER); ht.Add("&SLIP_DATE", purchase.SLIP_DATE.ToString("yyyy年MM月dd日")); ht.Add("&SUPPLIER", "厂商名称:" + supplier.NAME); // ht.Add("&NAME", company.NAME); ht.Add("&DUE_DATE", "1.交货日期:" + CConvert.ToDateTime(purchase.DUE_DATE).ToShortDateString()); ht.Add("&PACKING_METHOD", "2.包装方式:" + purchase.PACKING_METHOD); ht.Add("&WAREHOUSE_NAME", "3.交货地址:" + warehouse.ADDRESS_FIRST + warehouse.ADDRESS_MIDDLE + warehouse.ADDRESS_LAST); ht.Add("&PAYMENT_CONDITION", "4.支付方式:" + purchase.PAYMENT_CONDITION); dt = new DataTable(); dt.Columns.Add("NO"); dt.Columns.Add("MODEL_NUMBER"); dt.Columns.Add("PRODUCT_NAME"); dt.Columns.Add("SPEC"); dt.Columns.Add("QUANTITY"); dt.Columns.Add("PRICE"); dt.Columns.Add("AMOUNT_WITHOUT_TAX"); //dt.Columns.Add("AMOUNT_INCLUDED_TAX"); dt.Columns.Add("DUE_DATE"); decimal amount = 0; decimal taxAmount = 0; DataRow rows = null; foreach (BllPurchaseOrderLineTable OLModel in purchase.Items) { rows = dt.NewRow(); rows["NO"] = OLModel.LINE_NUMBER; if (OLModel.PRODUCT_CODE.Length >= 4 && OLModel.PRODUCT_CODE.Substring(0, 4) == "9999") { rows["PRODUCT_NAME"] = OLModel.PRODUCT_NAME; rows["SPEC"] = OLModel.PRODUCT_SPEC; rows["MODEL_NUMBER"] = ""; } else { BaseProductTable product = new BProduct().GetModel(OLModel.PRODUCT_CODE); if (product != null) { rows["PRODUCT_NAME"] = product.NAME; rows["SPEC"] = product.SPEC; rows["MODEL_NUMBER"] = product.MODEL_NUMBER; } } rows["QUANTITY"] = OLModel.QUANTITY; rows["PRICE"] = OLModel.PRICE; rows["AMOUNT_WITHOUT_TAX"] = Convert.ToDouble(CConvert.ToDecimal(rows["QUANTITY"]) * CConvert.ToDecimal(rows["PRICE"])).ToString("0.00"); //rows["AMOUNT_INCLUDED_TAX"] = OLModel.AMOUNT_INCLUDED_TAX; rows["DUE_DATE"] = CConvert.ToDateTime(purchase.DUE_DATE).ToString("yyyy/MM/dd"); amount += OLModel.AMOUNT_WITHOUT_TAX; taxAmount += OLModel.TAX_AMOUNT; dt.Rows.Add(rows); } ht.Add("&AMOUNT", amount); ht.Add("&TAX_AMOUNT", taxAmount); ht.Add("&TOTAL_AMOUNT", amount + taxAmount); SaveFileDialog sf = new SaveFileDialog(); sf.FileName = "LZ_PURCHASE_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; sf.Filter = "(文件)|*.xls;*.xlsx"; if (sf.ShowDialog(this) == DialogResult.OK) { if (dt.Rows.Count > 0) { int ret = CommonExport.ExportPurchase(@"rpt\purchase.xls", sf.FileName, dt, ht); if (CConstant.EXPORT_FAILURE.Equals(ret)) { MessageBox.Show("导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (CConstant.EXPORT_SUCCESS.Equals(ret)) { MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (CConstant.EXPORT_RUNNING.Equals(ret)) { MessageBox.Show("文件正在运行,重新生成文件失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (CConstant.EXPORT_TEMPLETE_FILE_NOT_EXIST.Equals(ret)) { MessageBox.Show("模版文件不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("明细信息不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } #endregion } else { decimal AMOUNT_WITHOUT_TAX = 0; decimal ORDER_AMOUNT = 0; #region 国外 ht = new Hashtable(); ht.Add("&SUPPLIER_NAME", supplier.NAME); ht.Add("&CONTACT_NAME", supplier.CONTACT_NAME); ht.Add("&PHONE", supplier.PHONE_NUMBER); ht.Add("&FAX", supplier.FAX_NUMBER); // ht.Add("&ORDER_NUMBER", purchase.ORDER_SLIP_NUMBER); ht.Add("&SLIP_NUMBER", purchase.SLIP_NUMBER); ht.Add("&SUPPLIER_ORDER_CODE", purchase.SUPPLIER_ORDER_NUMBER); ht.Add("&PURCHASE_QUOTATION_NUMBER", purchase.PURCHASE_QUOTATION_NUMBER); if (order != null) { ht.Add("&CUSTOMER_PO_NUMBER", order.CUSTOMER_PO_NUMBER); string customerCode = ""; //if (!string.IsNullOrEmpty(order.CUSTOMER_NAME)) //{ // customerCode = order.CUSTOMER_CODE; // ht.Add("&CUSTOMER_NAME", order.CUSTOMER_NAME); //} //else //{ customerCode = order.ENDER_CUSTOMER_CODE; ht.Add("&CUSTOMER_NAME", order.ENDER_CUSTOMER_NAME); //} ht.Add("&DELIVERY_DATE", order.DUE_DATE); ht.Add("&SERIAL_NUMBER", order.SERIAL_NUMBER); ht.Add("&AIRCRAFT", order.SERIAL_TYPE); BaseCustomerTable customer = new BCustomer().GetModel(customerCode); ht.Add("&CUSTOMER_CONTACT_NAME", customer.CONTACT_NAME); ht.Add("&CUSTOMER_PHONE", customer.PHONE_NUMBER); //ht.Add("&ORDER_AMOUNT", order.AMOUNT_INCLUDED_TAX); } else { ht.Add("&CUSTOMER_PO_NUMBER", ""); ht.Add("&DELIVERY_DATE", ""); ht.Add("&SERIAL_NUMBER", ""); //ht.Add("&ORDER_AMOUNT", ""); ht.Add("&AIRCRAFT", ""); ht.Add("&CUSTOMER_NAME", company.NAME_SHORT); ht.Add("&CUSTOMER_CONTACT_NAME", ""); ht.Add("&CUSTOMER_PHONE", company.PHONE_NUMBER); } ht.Add("&MEMO", purchase.MEMO); ht.Add("&TOTAL_AMOUNT", purchase.TOTAL_AMOUNT); ht.Add("&PAYMENT", purchase.PAYMENT_CONDITION); ht.Add("&SLIP_DATE", purchase.SLIP_DATE); ht.Add("&DUE_DATE", purchase.DUE_DATE); dt = new DataTable(); dt.Columns.Add("NO"); dt.Columns.Add("PRODUCT_CODE"); dt.Columns.Add("X_1", Type.GetType("System.String")); dt.Columns.Add("PRODUCT_NAME"); dt.Columns.Add("X_2", Type.GetType("System.String")); dt.Columns.Add("MODEL_NUMBER"); dt.Columns.Add("X_3", Type.GetType("System.String")); dt.Columns.Add("QUANTITY"); dt.Columns.Add("PRICE"); dt.Columns.Add("AMOUNT_WITHOUT_TAX"); DataRow rows = null; foreach (BllPurchaseOrderLineTable OLModel in purchase.Items) { AMOUNT_WITHOUT_TAX += OLModel.AMOUNT_INCLUDED_TAX; if (order != null) { foreach (BllOrderLineTable line in order.Items) { if (line.PRODUCT_CODE == OLModel.PRODUCT_CODE) { ORDER_AMOUNT += CConvert.ToDecimal(line.AMOUNT); break; } } } else { ORDER_AMOUNT += 0; } rows = dt.NewRow(); rows["NO"] = OLModel.LINE_NUMBER; rows["PRODUCT_CODE"] = OLModel.PRODUCT_CODE; if (OLModel.PRODUCT_CODE.Length >= 4 && OLModel.PRODUCT_CODE.Substring(0, 4) == "9999") { rows["PRODUCT_NAME"] = OLModel.PRODUCT_NAME; rows["MODEL_NUMBER"] = OLModel.PRODUCT_SPEC; } else { BaseProductTable product = new BProduct().GetModel(OLModel.PRODUCT_CODE); if (product != null) { if (!string.IsNullOrEmpty(product.NAME_JP)) { rows["PRODUCT_NAME"] = product.NAME_JP; } else { rows["PRODUCT_NAME"] = product.NAME; } rows["MODEL_NUMBER"] = product.SPEC + " " + product.MODEL_NUMBER; } } rows["QUANTITY"] = OLModel.QUANTITY; rows["PRICE"] = OLModel.PRICE; rows["AMOUNT_WITHOUT_TAX"] = OLModel.AMOUNT_INCLUDED_TAX; dt.Rows.Add(rows); } ht.Add("&AMOUNT_WITHOUT_TAX", AMOUNT_WITHOUT_TAX); ht.Add("&ORDER_AMOUNT", ORDER_AMOUNT); SaveFileDialog sf = new SaveFileDialog(); sf.FileName = "LZ_PURCHASE_OVERSEAS_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; sf.Filter = "(文件)|*.xls;*.xlsx"; if (sf.ShowDialog(this) == DialogResult.OK) { if (dt.Rows.Count > 0) { int ret = CommonExport.ExportPurchaseOverseas(@"rpt\purchase_overseas.xls", sf.FileName, dt, ht); if (CConstant.EXPORT_FAILURE.Equals(ret)) { MessageBox.Show("导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (CConstant.EXPORT_SUCCESS.Equals(ret)) { MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (CConstant.EXPORT_RUNNING.Equals(ret)) { MessageBox.Show("文件正在运行,重新生成文件失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (CConstant.EXPORT_TEMPLETE_FILE_NOT_EXIST.Equals(ret)) { MessageBox.Show("模版文件不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("明细信息不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } #endregion } } else { MessageBox.Show("请选择一行!"); } }
public void Delete() { short routes = 0; BAudit bAudit = new BAudit(); EAudit eAudit = null; BCorporation bCorporation = new BCorporation(); ECorporation eCorporation = new ECorporation(); ECorporation insertedCorporation = new ECorporation(); BCompany bCompany = new BCompany(); ECompany eCompany = new ECompany(); ECompany insertedCompany = new ECompany(); TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew); eCorporation.CodeCorporation = Aleatory.GetString(2); eCorporation.Name = Aleatory.GetString(8); eCorporation.State = Aleatory.GetShort(); eCorporation.Audit.UserRegister = Aleatory.GetString(8); bCorporation.Insert(eCorporation); insertedCorporation = bCorporation.Select(eCorporation); if (insertedCorporation != null) { routes++; } insertedCorporation.Audit.UserRegister = eCorporation.Audit.UserRegister; bCorporation.Delete(insertedCorporation); if (bCorporation.Select(insertedCorporation) == null) { routes++; } eAudit = bAudit.Select(eCorporation.Audit). Where(x => x.UserRegister == eCorporation.Audit.UserRegister && x.Code == eCorporation.Audit.Code && x.TypeEvent == "Delete").FirstOrDefault(); if (eAudit != null) { routes++; } bCorporation.Insert(eCorporation); eCompany.CodeCorporation = eCorporation.CodeCorporation; eCompany.Ruc = Aleatory.GetString(11); eCompany.CodeCompany = Aleatory.GetString(2); eCompany.LongName = Aleatory.GetString(8); eCompany.State = Aleatory.GetShort(); eCompany.Audit.UserRegister = eCorporation.Audit.UserRegister; bCompany.Insert(eCompany); insertedCompany = bCompany.Select(eCompany); if (insertedCompany != null) { try { eCorporation.Audit.UserRegister = Aleatory.GetString(9); bCorporation.Delete(eCorporation); } catch { } if (bCorporation.Message.Contains("La Corporación") && bCorporation.Message.Contains("tiene referencias en el Sistema, no se puede eliminar el registro.")) { routes++; } eAudit = bAudit.Select(eCorporation.Audit). Where(x => x.UserRegister == eCorporation.Audit.UserRegister && x.Code == eCorporation.Audit.Code && x.TypeEvent == "Delete").FirstOrDefault(); if (eAudit == null) { routes++; } } ts.Dispose(); Assert.AreEqual(routes, 5); }