protected void Button1_Click(object sender, EventArgs e)
 {
     VPBLL.Company.CompanyHelper help = new VPBLL.Company.CompanyHelper();
     VPBLL.Company.ABiCompany company = new VPBLL.Company.ABiCompany();
     company.ID = this.companyIDHid.Value;
     company.CompanyName = this.companyName.Value;
     company.CompanyCode = this.companyCode.Value;
     if (string.IsNullOrEmpty(company.ID) == false)
         help.updateCompany(company);
     else
         help.addCompany(company);
     ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('保存成功');</script>");
 }
Example #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            VPBLL.Company.CompanyHelper cHelper = new VPBLL.Company.CompanyHelper();
            VPBLL.Vendor.VenderHelper vHelper=new VPBLL.Vendor.VenderHelper();
            List<VPBLL.Company.ABiCompany> companyList = cHelper.getCompanyByCode(this.companyCode.Value);
            if (companyList != null && companyList.Count > 0)//判定是否有该公司
            {
                List<VPBLL.Vendor.ABiVendor> vendorList = vHelper.getABiVendorByCode(this.vendorCode.Value);
                if (vendorList == null || vendorList.Count == 0)
                {
                    VPBLL.Vendor.ABiVendor vendor = new VPBLL.Vendor.ABiVendor();
                    vendor.VendorCode = this.vendorCode.Value;
                    vendor.VendorName = this.vendorName.Value;
                    vendor.TaxNumber = this.taxNumber.Value;
                    vendor.IndustryCode = this.industryCode.Value;
                    vendor.DateCreated = Convert.ToDateTime(DateTime.Now);
                    vendor.DateModified = Convert.ToDateTime(DateTime.Now);
                    vendor.Blocking = "";
                    vendor.Deletion = "";
                    vHelper.addVendor(vendor);//保存vendor
                    vendorList = vHelper.getABiVendorByCode(this.vendorCode.Value);//获取到新的venderID
                    vendor = vendorList[0];
                    VPBLL.Vendor.AbiBankAccount bank = new VPBLL.Vendor.AbiBankAccount();
                    bank.ABi_Vendor_ID = vendor.ABi_Vendor_ID;
                    bank.BankCode = this.bankCode.Value;
                    bank.BankName = this.bankName.Value;
                    bank.BankAccount = this.bankAccount.Value;
                    bank.ReceiverName = this.receiverName.Value;
                    vHelper.addBankAccount(bank);
                    VPBLL.Company.ABiCompany company = companyList[0];
                    VPBLL.Vendor.ABiVendor_Company vendor_Company = new VPBLL.Vendor.ABiVendor_Company();
                    vendor_Company.ABi_Vendor_ID = vendor.ABi_Vendor_ID;
                    vendor_Company.ABi_Company_ID = Convert.ToInt32(company.ID);
                    vendor_Company.Blocking ="";
                    vendor_Company.Deletion = "";
                    vendor_Company.PaymentTerm = this.paymentTerm.Value;
                    vHelper.addVendorCompany(vendor_Company);
                    ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('保存成功');back();</script>");

                }
                else
                    ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('该供应商已存在')</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('该公司编号无效')</script>");
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["ID"] != null && string.IsNullOrEmpty(Request.QueryString["ID"]) == false)
         {
             VPBLL.Company.CompanyHelper help = new VPBLL.Company.CompanyHelper();
             List<VPBLL.Company.ABiCompany> list = help.getCompanyByID(Convert.ToInt32(Request.QueryString["ID"].ToString()));
             if (list != null && list.Count > 0)
             {
                 VPBLL.Company.ABiCompany company = list[0];
                 this.companyIDHid.Value = company.ID.ToString();
                 this.companyCode.Value = company.CompanyCode;
                 this.companyName.Value = company.CompanyName;
             }
             else
             {
                 ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('未找到该公司相关信息');</script>");
             }
         }
     }
 }
Example #4
0
 public string Bind()
 {
     //返回前台的信息
     string result = "";
     //获取到数据
     VPBLL.Company.CompanyHelper helper = new VPBLL.Company.CompanyHelper();
     List<VPBLL.Company.ABiCompany> list = helper.getCompanyByName(this.companyName);
     result += VPBLL.ListHalper.GetListHead("example");//调用统一表格样式
     //生成列
     result += "<thead>";
     result += "<tr><th>企业编号</th><th>企业名称</th></tr>";
     result += "</thead>";
     //样式
     string style = "odd gradeA";
     //生成行
     foreach (VPBLL.Company.ABiCompany company in list)
     {
         result += "<tr class='" + style + "'><td>" + company.CompanyCode + "</td><td>" + company.CompanyName + "</td></tr>";
         style = style == "odd gradeA" ? "even gradeA" : "odd gradeA";
     }
     result += VPBLL.ListHalper.GetFootHead();
     return result;
 }
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                int userId = -1;
                int roleId = -1;

                String strUId = context.Request.QueryString["apiuid"];
                String strRId = context.Request.QueryString["apirid"];
                if (!String.IsNullOrEmpty(strUId) && !String.IsNullOrEmpty(strRId))
                {
                    userId = int.Parse(strUId);
                    roleId = int.Parse(strRId);
                }
                else
                {
                    VPBLL.BasePage bp = new VPBLL.BasePage();

                    bp.CheckUser(HttpContext.Current.Request.Cookies["LastLogin"], context);

                    userId = bp.UserID;
                    roleId = bp.RoleID;
                }

                String act = context.Request.QueryString["act"];
                bool bExport = ("1" == context.Request.QueryString["be"]);

                VPBLL.DataTable.FormatedList fl = new VPBLL.DataTable.FormatedList();
                switch (act)
                {
                    case "1"://GRReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.GR.ABiGR>(context.Request);
                            var helper = new VPBLL.GR.GRHelper();
                            var list = helper.GetGR(new VPBLL.GR.GRHelper.QueryCondition()
                            {
                                GRNumber = context.Request.QueryString["gn"],
                                MoveType = context.Request.QueryString["mt"],
                                VendorCode = context.Request.QueryString["vc"],
                                PONumber = context.Request.QueryString["pn"],
                                DateStart = ToDateTime(context.Request.QueryString["sd"]),
                                DateEnd = ToDateTime(context.Request.QueryString["ed"]),
                                UserID = userId,
                                IsExport = bExport,
                                RoleID = roleId
                            });

                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "2": //GRIVReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.GR.ABiGRIV>(context.Request);
                            var helper = new VPBLL.GR.GRHelper();
                            var list = helper.GetGRIV(new VPBLL.GR.GRHelper.QueryCondition()
                            {
                                IVNumber = context.Request.QueryString["iv"],
                                VendorCode = context.Request.QueryString["vc"],
                                DateStart = ToDateTime(context.Request.QueryString["sd"]),
                                DateEnd = ToDateTime(context.Request.QueryString["ed"]),
                                PONumber = context.Request.QueryString["pn"],
                                UserID = userId,
                                IsExport = bExport
                            });

                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "3": //POReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.PO.ABiPO>(context.Request);
                            var helper = new VPBLL.PO.POHelper();
                            var list = helper.getPO(new VPBLL.PO.POHelper.QueryCondition()
                            {
                                CompanyCode = context.Request.QueryString["cc"],
                                CompanyName = context.Request.QueryString["cn"],
                                VendorCode = context.Request.QueryString["vc"],
                                MeterialNumber = context.Request.QueryString["mn"],
                                PONumber = context.Request.QueryString["pn"],
                                DateBegin = ToDateTime(context.Request.QueryString["sd"]),
                                DateEnd = ToDateTime(context.Request.QueryString["ed"]),
                                UserID = userId,
                                IsExport = bExport,
                                RoleID = roleId
                            });

                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "4":   //POIVReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.PO.ABiPOIV>(context.Request);
                            var helper = new VPBLL.PO.POHelper();
                            var list = helper.getPOIV(new VPBLL.PO.POHelper.QueryCondition()
                            {
                                CompanyCode = context.Request.QueryString["cc"],
                                CompanyName = context.Request.QueryString["cn"],
                                VendorCode = context.Request.QueryString["vc"],
                                MeterialNumber = context.Request.QueryString["mn"],
                                PONumber = context.Request.QueryString["pn"],
                                DateBegin = ToDateTime(context.Request.QueryString["sd"]),
                                DateEnd = ToDateTime(context.Request.QueryString["ed"]),
                                UserID = userId,
                                IsExport = bExport
                            });

                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "5":   //POStatusReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.PO.ABiPOStatus>(context.Request);
                            var helper = new VPBLL.PO.POHelper();
                            var list = helper.getPOStatus(new VPBLL.PO.POHelper.QueryCondition()
                            {
                                CompanyCode = context.Request.QueryString["cc"],
                                CompanyName = context.Request.QueryString["cn"],
                                VendorCode = context.Request.QueryString["vc"],
                                MeterialNumber = context.Request.QueryString["mn"],
                                PONumber = context.Request.QueryString["pn"],
                                DateBegin = ToDateTime(context.Request.QueryString["sd"]),
                                DateEnd = ToDateTime(context.Request.QueryString["ed"]),
                                UserID = userId,
                                IsExport = bExport
                            });

                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "6":   //IVReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.IV.ABiIV>(context.Request);
                            var helper = new VPBLL.IV.IVHelper();
                            var list = helper.getIV(new VPBLL.IV.IVHelper.QueryCondition()
                            {
                                CompanyCode = context.Request.QueryString["cc"],
                                VendcorName = context.Request.QueryString["vn"],
                                VendorCode = context.Request.QueryString["vc"],
                                InvoiceNumber = context.Request.QueryString["in"],
                                IsTolerance = context.Request.QueryString["it"],
                                DateBegin = ToDateTime(context.Request.QueryString["sd"]),
                                DateEnd = ToDateTime(context.Request.QueryString["ed"]),
                                PaymentStatus = context.Request.QueryString["ps"],
                                UserID = userId,
                                IsExport = bExport,
                                RoleID = roleId
                            });

                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "7":   //IVCompletedReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.IV.ABiIVCompleted>(context.Request);
                            var helper = new VPBLL.IV.IVHelper();
                            var list = helper.getIVCompleted(new VPBLL.IV.IVHelper.QueryCondition()
                            {
                                CompanyCode = context.Request.QueryString["cc"],
                                VendcorName = context.Request.QueryString["vn"],
                                VendorCode = context.Request.QueryString["vc"],
                                InvoiceNumber = context.Request.QueryString["in"],
                                IsTolerance = context.Request.QueryString["it"],
                                DateBegin = ToDateTime(context.Request.QueryString["sd"]),
                                DateEnd = ToDateTime(context.Request.QueryString["ed"]),
                                UserID = userId,
                                IsExport = bExport
                            });

                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "8":   //IVPendingReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.IV.ABiIVPending>(context.Request);
                            var helper = new VPBLL.IV.IVHelper();
                            var list = helper.getIVPending(new VPBLL.IV.IVHelper.QueryCondition()
                            {
                                CompanyCode = context.Request.QueryString["cc"],
                                VendcorName = context.Request.QueryString["vn"],
                                VendorCode = context.Request.QueryString["vc"],
                                InvoiceNumber = context.Request.QueryString["in"],
                                IsTolerance = context.Request.QueryString["it"],
                                DateBegin = ToDateTime(context.Request.QueryString["sd"]),
                                DateEnd = ToDateTime(context.Request.QueryString["ed"]),
                                Buys = context.Request.QueryString["b"],
                                UserID = userId,
                                IsExport = bExport
                            });

                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "9": //GR_NewIV.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.GR.ABiNewIV>(context.Request);
                            var helper = new VPBLL.GR.GRHelper();
                            var list = helper.getNewIV(new VPBLL.GR.GRHelper.QueryCondition() {
                                CompanyCode = context.Request.QueryString["cc"],
                                GRNumber = context.Request.QueryString["gn"],
                                PONumber = context.Request.QueryString["pn"],
                                DateStart = ToDateTime(context.Request.QueryString["ds"]),
                                DateEnd = ToDateTime(context.Request.QueryString["de"]),
                                PODateStart = ToDateTime(context.Request.QueryString["pds"]),
                                PODateEnd = ToDateTime(context.Request.QueryString["pde"]),
                                VendorCode = context.Request.QueryString["vc"],
                                UserID = userId,
                                IsExport = bExport,
                                RoleID = roleId
                            });

                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "10":  //IVRemark.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.IV.ABiIVRemark>(context.Request);
                            var helper = new VPBLL.IV.IVHelper();
                            int invoiceId;
                            if (int.TryParse(context.Request.QueryString["id"], out invoiceId))
                            {
                                var list = helper.getIVRemarkGR(invoiceId, userId);

                                fl = parser.Parse(list.AsQueryable(), bExport);
                            }
                        }
                        break;
                    case "11":  //IVDetail.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.IV.ABiIVDetail>(context.Request);
                            var helper = new VPBLL.IV.IVHelper();
                            int invoiceId;
                            if (int.TryParse(context.Request.QueryString["id"], out invoiceId))
                            {
                                var list = helper.getInvoiceDetail(invoiceId, userId);
                                fl = parser.Parse(list.AsQueryable(), bExport);
                            }
                        }
                        break;
                    case "21"://VendorCompanyReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Vendor.ABiVendorCompany>(context.Request);
                            var helper = new VPBLL.Vendor.VenderHelper();
                            string seachCode = context.Request.QueryString["vc"];
                            if (roleId == 4)
                            {
                                VPBLL.Users.UsersHelper uhelper = new VPBLL.Users.UsersHelper();
                                List<VPBLL.Users.ABiAdminUsers> uList = uhelper.getUsersByID(userId);
                                if (uList != null && uList.Count > 0)
                                {
                                    seachCode = uList[0].Username;
                                }
                            }

                            var list = helper.getABiVendorCompany(new VPBLL.Vendor.VenderHelper.QueryCondition()
                            {

                                VendorCode = seachCode,
                                VendorName = context.Request.QueryString["vn"],
                                TaxNumber = context.Request.QueryString["tn"],
                                CompanyCode = context.Request.QueryString["cc"],
                                DateBegin = ToDateTime(context.Request.QueryString["sd"]),
                                DateEnd = ToMaxDateTime(context.Request.QueryString["ed"]),
                                //DateBegin = Convert.ToDateTime("2001-01-01 00:00:00"),
                                //DateEnd = Convert.ToDateTime("2020-01-01 00:00:00"),
                                UserID=userId,
                                RoleID=roleId
                            });
                            list.AsQueryable();
                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;

                    case "22"://CompanyReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Company.ABiCompany>(context.Request);
                            var helper = new VPBLL.Company.CompanyHelper();
                            var list = helper.getABiCompany(new VPBLL.Company.CompanyHelper.QueryCondition()
                            {
                                CompanyCode = context.Request.QueryString["cc"],
                                CompanyName = context.Request.QueryString["cn"],
                            });
                            list.AsQueryable();
                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "23"://PlantReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Plant.ABiPlant>(context.Request);
                            var helper = new VPBLL.Plant.PlantHelper();
                            var list = helper.getABiPlant(new VPBLL.Plant.PlantHelper.QueryCondition()
                            {
                                PlantCode = context.Request.QueryString["pc"]
                            });
                            list.AsQueryable();
                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "24"://VendorActiveReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Vendor.ABiVendorReport>(context.Request);
                            var helper = new VPBLL.Vendor.VenderHelper();
                            var list = helper.getABiVendorActive(new VPBLL.Vendor.VenderHelper.QueryCondition()
                            {
                                VendorCode = context.Request.QueryString["vc"],
                                VendorName = context.Request.QueryString["vn"],
                                TaxNumber = context.Request.QueryString["tn"],
                                DateBegin = ToDateTime(context.Request.QueryString["sd"]),
                                DateEnd = ToMaxDateTime(context.Request.QueryString["ed"])
                                //DateBegin = Convert.ToDateTime("2001-01-01 00:00:00"),
                                //DateEnd = Convert.ToDateTime("2020-01-01 00:00:00")
                            });
                            list.AsQueryable();
                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "25"://UsersReport.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Users.ABiUsersRoles>(context.Request);
                            var helper = new VPBLL.Users.UsersHelper();
                            string UserName = context.Request.QueryString["un"];
                            var list = helper.getABiUsersRoles(new VPBLL.Users.UsersHelper.QueryCondition()
                            {
                                UserName = context.Request.QueryString["un"],
                                Name = context.Request.QueryString["nm"],
                                Status = context.Request.QueryString["st"],
                                ABi_Admin_Roles_ID = context.Request.QueryString["ro"]
                            });
                            list.AsQueryable();
                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "26"://UsersCompany.aspx
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Users.UsersCompany>(context.Request);
                            var helper = new VPBLL.Company.CompanyHelper();
                            var list = helper.getUsersCompany(new VPBLL.Company.CompanyHelper.QueryCondition()
                            {
                                CompanyCode = context.Request.QueryString["cc"],
                                CompanyName = context.Request.QueryString["cn"],
                                ABi_Admin_Users_ID = context.Request.QueryString["Admin_Users_ID"],
                                Type = context.Request.QueryString["type"]
                            });
                            list.AsQueryable();
                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                    case "30":
                        {
                            var parser = new VPBLL.DataTable.DataTableParser<VPBLL.Vendor.ABiVendor>(context.Request);
                            var helper = new VPBLL.Vendor.VenderHelper();
                            String cc = context.Request.QueryString["cc"];
                            String ia = context.Request.QueryString["ia"];
                            String hi = context.Request.QueryString["hi"];
                            var list = helper.getVenders(ia, cc, hi);
                            list.AsQueryable();
                            fl = parser.Parse(list.AsQueryable(), bExport);
                        }
                        break;
                }

                if (fl != null)
                {
                    if (!bExport)
                    {
                        context.Response.ContentType = "application/json";
                        context.Response.Write(fl.ToJSON());
                    }
                    else
                    {
                        context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
                        context.Response.ContentType = "application/ms-excel";
                        context.Response.Charset = "GB2312";
                        context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("export" + ".xls", System.Text.Encoding.GetEncoding("GB2312")).ToString());
                        context.Response.Write(fl.ToCVS());
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogError("", ex);
            }
        }
Example #6
0
        public override DataSet Import(System.Data.DataSet ds)
        {
            var failedRows = new DataSet();
            if (ds != null && ds.Tables.Count > 0)
            {
                DataTable dtFailed = new DataTable("Failed_Imported");
                DataColumn[] columns = new DataColumn[ds.Tables[0].Columns.Count + 1];
                for (int i = 0; i < ds.Tables[0].Columns.Count; ++i)
                {
                    columns[i] = new DataColumn(ds.Tables[0].Columns[i].ColumnName);
                }
                columns[ds.Tables[0].Columns.Count] = new DataColumn("错误原因");
                dtFailed.Columns.AddRange(columns);

                BuildHeader(ds.Tables[0].Columns);
                VPBLL.Vendor.VenderHelper vHelper = new VPBLL.Vendor.VenderHelper();
                VPBLL.Vendor.ABiVendor vendor = new VPBLL.Vendor.ABiVendor();
                VPBLL.Company.CompanyHelper cHelper = new VPBLL.Company.CompanyHelper();
                for (int i = 0; i < ds.Tables[0].Rows.Count; ++i)
                {
                    vendor.VendorCode = GetFieldValue(ds.Tables[0].Rows[i], "供应商代码").ToString();
                    vendor.VendorName = GetFieldValue(ds.Tables[0].Rows[i], "供应商名称").ToString();
                    List<VPBLL.Vendor.ABiVendor> vendorList = vHelper.getABiVendorByCode(vendor.VendorCode);
                    string companyCode = GetFieldValue(ds.Tables[0].Rows[i], "公司代码").ToString();
                    List<VPBLL.Company.ABiCompany> companyList = cHelper.getCompanyByCode(companyCode);
                    if (String.IsNullOrEmpty(vendor.VendorCode) || String.IsNullOrEmpty(vendor.VendorName))
                    {
                        List<object> row = new List<object>(ds.Tables[0].Rows[i].ItemArray);
                        row.Add(String.Format("供应商编号为空或供应商名称为空{0},{1}", vendor.VendorCode, vendor.VendorName));
                        dtFailed.Rows.Add(row.ToArray());
                    }
                    else if(string.IsNullOrEmpty(companyCode))
                    {
                         List<object> row = new List<object>(ds.Tables[0].Rows[i].ItemArray);
                         row.Add(String.Format("公司编号为空{0},{1}", companyCode));
                        dtFailed.Rows.Add(row.ToArray());
                    }
                    else if (companyList == null || companyList.Count == 0)
                    {
                        List<object> row = new List<object>(ds.Tables[0].Rows[i].ItemArray);
                        row.Add(String.Format("未找到该公司{0},{1}", companyCode));
                        dtFailed.Rows.Add(row.ToArray());
                    }
                    else
                    {
                        VPBLL.Company.ABiCompany company = companyList[0];

                        try
                        {
                            vendor.TaxNumber = GetFieldValue(ds.Tables[0].Rows[i], "纳税人识别号").ToString();
                            vendor.IndustryCode = GetFieldValue(ds.Tables[0].Rows[i], "所属行业").ToString();
                            vendor.DateCreated = Convert.ToDateTime(DateTime.Now);
                            vendor.DateModified = Convert.ToDateTime(DateTime.Now);
                            vendor.Blocking = "";
                            vendor.Deletion = "";
                            if (vendorList == null || vendorList.Count == 0)//新增vendor
                            {

                                vHelper.addVendor(vendor);//保存vendor
                                vendorList = vHelper.getABiVendorByCode(vendor.VendorCode);//获取到新的venderID
                                vendor = vendorList[0];
                                VPBLL.Vendor.AbiBankAccount bank = new VPBLL.Vendor.AbiBankAccount();
                                bank.ABi_Vendor_ID = vendor.ABi_Vendor_ID;
                                bank.BankCode = GetFieldValue(ds.Tables[0].Rows[i], "供应商开户行").ToString();
                                bank.BankName = GetFieldValue(ds.Tables[0].Rows[i], "供应商开户名称").ToString();
                                bank.BankAccount = GetFieldValue(ds.Tables[0].Rows[i], "供应商银行帐号").ToString();
                                bank.ReceiverName = GetFieldValue(ds.Tables[0].Rows[i], "收款人名称").ToString();
                                vHelper.addBankAccount(bank);

                                VPBLL.Vendor.ABiVendor_Company vendor_Company = new VPBLL.Vendor.ABiVendor_Company();
                                vendor_Company.ABi_Vendor_ID = vendor.ABi_Vendor_ID;
                                vendor_Company.ABi_Company_ID = Convert.ToInt32(company.ID);
                                vendor_Company.Blocking = "";
                                vendor_Company.Deletion = "";
                                vendor_Company.PaymentTerm = GetFieldValue(ds.Tables[0].Rows[i], "付款周期").ToString();
                                vHelper.addVendorCompany(vendor_Company);
                            }
                            else
                            {
                                vHelper.updateVendor(vendor);
                                VPBLL.Vendor.AbiBankAccount bank = new VPBLL.Vendor.AbiBankAccount();
                                vendorList = vHelper.getABiVendorByCode(vendor.VendorCode);//获取到新的venderID
                                vendor = vendorList[0];
                                bank.ABi_Vendor_ID = vendor.ABi_Vendor_ID;
                                bank.BankCode = GetFieldValue(ds.Tables[0].Rows[i], "供应商开户行").ToString();
                                bank.BankName = GetFieldValue(ds.Tables[0].Rows[i], "供应商开户名称").ToString();
                                bank.BankAccount = GetFieldValue(ds.Tables[0].Rows[i], "供应商银行帐号").ToString();
                                bank.ReceiverName = GetFieldValue(ds.Tables[0].Rows[i], "收款人名称").ToString();
                                List<AbiBankAccount> bankList = vHelper.getABiBankAccount(bank.ABi_Vendor_ID, bank.BankCode);
                                if (bankList == null || bankList.Count == 0)
                                    vHelper.addBankAccount(bank);
                                else
                                    vHelper.updateBankAccount(bank);
                                VPBLL.Vendor.ABiVendor_Company vendor_Company = new VPBLL.Vendor.ABiVendor_Company();
                                vendor_Company.ABi_Vendor_ID = vendor.ABi_Vendor_ID;
                                vendor_Company.ABi_Company_ID = Convert.ToInt32(company.ID);
                                vendor_Company.PaymentTerm = GetFieldValue(ds.Tables[0].Rows[i], "付款周期").ToString();
                                vHelper.addVendorCompany(vendor_Company);
                            }
                        }
                        catch (Exception ex)
                        {
                            var row = new List<object>(ds.Tables[0].Rows[i].ItemArray);
            #if DEBUG
                            row.Add(String.Format("出现异常错误:{0}", ex.Message));
            #else
                            row.Add(String.Format("出现异常错误"));
            #endif
                            dtFailed.Rows.Add(row.ToArray());
                            logger.LogError(String.Format("Failed VendorImport({0},{1})", vendor.VendorCode, vendor.VendorName), ex);
                        }

                    }
                }

                failedRows.Tables.Add(dtFailed);
            }
            return failedRows;
        }
Example #7
0
        protected void InitControls()
        {
            if (mvMainContent.ActiveViewIndex == 0)
            {
                VPBLL.Company.CompanyHelper helper = new VPBLL.Company.CompanyHelper();
                var companies = helper.getAllCompany();

                ddlCompanies.Items.Add(new ListItem("--", "-1"));
                foreach (var c in companies)
                {
                    ddlCompanies.Items.Add(new ListItem(String.Format("{0} {1}", c.CompanyCode, c.CompanyName), c.CompanyCode));
                }
            }
            else if (mvMainContent.ActiveViewIndex == 2)
            {
                btnDVDeactive.Enabled = false;
                lblDVErrorMessage.Visible = false;
                tabDVResult.Visible = false;
            }
            else if (mvMainContent.ActiveViewIndex == 3)
            {
                txtCOCompanies.Text = VPBLL.Config.getInstance().POFilterCompany;
            }
        }