protected void PositionSelectCtl_SelectedIndexChanged(object sender, EventArgs e) { int currentPositionId = int.Parse(this.PositionSelectCtl.SelectedValue); Session["SelectedPosition"] = new OUTreeBLL().GetPositionById(currentPositionId); //Response.Redirect("~/MainPage.aspx"); Response.Redirect("~/Home.aspx"); }
protected void OUTree_SelectedNodeChanged(object sender, EventArgs e) { this.OUIdCtl.Value = ""; this.OUCodeCtl.Value = ""; this.OUNameCtl.Value = ""; if (this.OUTree.SelectedNode != null) { if (this.OUTree.SelectedNode.Value.StartsWith("OU")) { this.OUIdCtl.Value = this.OUTree.SelectedNode.Value.Substring(2); AuthorizationDS.OrganizationUnitRow ou = new OUTreeBLL().GetOrganizationUnitById(int.Parse(this.OUIdCtl.Value)); this.OUCodeCtl.Value = ou.IsOrganizationUnitCodeNull() ? "" : ou.OrganizationUnitCode; this.OUNameCtl.Value = this.OUTree.SelectedNode.Text; } } }
protected void StuffUserPositionGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView drv = (DataRowView)e.Row.DataItem; BusinessObjects.AuthorizationDS.PositionRow position = (BusinessObjects.AuthorizationDS.PositionRow)drv.Row; List <AuthorizationDS.OrganizationUnitRow> ous = new OUTreeBLL().GetParentOUsOfPosition(position.PositionId); StringBuilder ouNames = new StringBuilder(); foreach (BusinessObjects.AuthorizationDS.OrganizationUnitRow ou in ous) { ouNames.Append(ou.OrganizationUnitName + "-"); } Label label = (Label)e.Row.FindControl("ParentOUNamesCtl"); label.Text = ouNames.ToString(); } }
public static void InitOUTree(TreeView treeView, bool showPosition, bool checkOU, bool checkPosition, bool selectOU, bool selectPosition, bool showActiveOU) { treeView.Nodes.Clear(); AuthorizationDS.OrganizationUnitRow[] rootOU; if (showActiveOU) { rootOU = new OUTreeBLL().GetActiveRootOrganizationUnits(); } else { rootOU = new OUTreeBLL().GetRootOrganizationUnits(); } foreach (AuthorizationDS.OrganizationUnitRow organizationUnit in rootOU) { treeView.Nodes.Add(CreateOUTreeNode(organizationUnit, showPosition, checkOU, checkPosition, selectOU, selectPosition, showActiveOU)); } }
private string GetApproveName(int stuffuserID, int positionID, bool isApprove) { AuthorizationBLL authorizationBLL = new AuthorizationBLL(); AuthorizationDS.StuffUserRow stuffuserDr = authorizationBLL.GetStuffUserById(stuffuserID); string stuffUserName = stuffuserDr.StuffName; AuthorizationDS.PositionRow PositionRow = new OUTreeBLL().GetPositionById(positionID); string positionName = PositionRow.PositionName; if (isApprove) { return(positionName + "[" + stuffUserName + "]"); } else { return(stuffUserName); } }
public void SaveDataToDB(string FullPath, string FileName, string excelFileExtension) { SqlTransaction transaction = null; try { DataTable dt = null; dt = this.GetDataSet(FullPath, excelFileExtension).Tables[0]; if (dt.Rows.Count <= 1) { PageUtility.ShowModelDlg(this.Page, "文件中没有任何记录,请重新选择"); return; } BudgetManageFeeTableAdapter TABudgetManageFee = new BudgetManageFeeTableAdapter(); ImportLogTableAdapter TAImportLog = new ImportLogTableAdapter(); ImportLogDetailTableAdapter TAImportLogDetail = new ImportLogDetailTableAdapter(); transaction = TableAdapterHelper.BeginTransaction(TABudgetManageFee); TableAdapterHelper.SetTransaction(TAImportLog, transaction); TableAdapterHelper.SetTransaction(TAImportLogDetail, transaction); //存储log信息 ImportDS.ImportLogDataTable logTable = new ImportDS.ImportLogDataTable(); ImportDS.ImportLogRow logRow = logTable.NewImportLogRow(); int stuffUserID = ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId; string fullname = this.fileUpLoad.PostedFile.FileName.ToString(); string tmpFile = fullname.Remove(0, fullname.LastIndexOf("\\") + 1); logRow.FileName = tmpFile; logRow.ImportDate = DateTime.Now; logRow.ImportUserID = stuffUserID; logRow.ImportType = 1; logRow.TotalCount = dt.Rows.Count - 1; logRow.SuccessCount = dt.Rows.Count - 1; logRow.FailCount = 0; logTable.AddImportLogRow(logRow); TAImportLog.Update(logTable); //处理每条明细 BudgetDS.BudgetManageFeeDataTable BudgetManageTable = new BudgetDS.BudgetManageFeeDataTable(); ImportDS.ImportLogDetailDataTable ImportLogDetailTable = new ImportDS.ImportLogDetailDataTable(); int row_count = dt.Rows.Count; string errorInfor = string.Empty; // int expenseTypeID = int.Parse(ExpenseTypeDDL.SelectedValue); //开始处理每条明细 for (int i = 1; i <= row_count - 1; i++) { if (CheckData(dt.Rows[i]) != null) { errorInfor = "第" + (i + 1) + "行有错:" + CheckData(dt.Rows[i]); ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else { DataRow row = dt.Rows[i]; string DepartmentName = row[0].ToString().Trim(); string Period_Year = row[1].ToString().Trim(); string Period_Month = row[2].ToString().Trim(); string AccountingCode = row[3].ToString().Trim(); string ExpenseManageType = row[4].ToString().Trim(); string OriginalBudget = row[5].ToString().Trim(); string NormalBudget = row[6].ToString().Trim(); string AdjustBudget = row[7].ToString().Trim(); string Remark = row[9].ToString().Trim(); AuthorizationDS.OrganizationUnitDataTable ouTable = new OUTreeBLL().GetDataByOrganizationUnitName(DepartmentName); if (ouTable == null || ouTable.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:系统中找不到此部门《" + DepartmentName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else if (ouTable.Count > 1) { errorInfor = "第" + (i + 1) + "行有错:系统中找到多个此名称的部门《" + DepartmentName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else { ERS.ExpenseManageTypeDataTable emtTable = new MasterDataBLL().GetExpenseManageTypePaged(0, 20, string.Format("AccountingCode = '{0}'", AccountingCode), null); if (emtTable == null || emtTable.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:系统中找不到此费用类别《" + AccountingCode + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else if (emtTable.Count > 1) { errorInfor = "第" + (i + 1) + "行有错:系统中找到多个此费用类别《" + AccountingCode + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else { string temp = Period_Year + "-" + Period_Month + "-01"; string filter = string.Format("OrganizationUnitID = {0} and ExpenseManageTypeID= {1} and Period = '{2}'", ouTable[0].OrganizationUnitId, emtTable[0].ExpenseManageTypeID, DateTime.Parse(Period_Year + "-" + Period_Month + "-01")); if (new BudgetBLL().GetPagedBudgetManageFee(filter, 0, 20, null).Count > 0) { errorInfor = "第" + (i + 1) + "行有错:系统中已经存在本年月的预算信息,请在系统中直接更新"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else { BudgetDS.BudgetManageFeeRow BudgetManageRow = BudgetManageTable.NewBudgetManageFeeRow(); BudgetManageRow.OrganizationUnitID = ouTable[0].OrganizationUnitId; BudgetManageRow.Period = DateTime.Parse(Period_Year + "-" + Period_Month + "-01"); BudgetManageRow.ExpenseManageTypeID = emtTable[0].ExpenseManageTypeID; BudgetManageRow.OriginalBudget = decimal.Parse(OriginalBudget); BudgetManageRow.NormalBudget = decimal.Parse(NormalBudget); BudgetManageRow.AdjustBudget = decimal.Parse(AdjustBudget); BudgetManageRow.TotalBudget = decimal.Round(BudgetManageRow.NormalBudget + BudgetManageRow.AdjustBudget, 2); BudgetManageRow.ModifyReason = Remark; BudgetManageTable.AddBudgetManageFeeRow(BudgetManageRow); } } } } } TAImportLog.Update(logRow); TAImportLogDetail.Update(ImportLogDetailTable); TABudgetManageFee.Update(BudgetManageTable); transaction.Commit(); string returnString = "成功导入" + logRow.SuccessCount.ToString() + "条信息"; PageUtility.ShowModelDlg(this.Page, returnString); } catch (Exception ex) { if (transaction != null) { transaction.Rollback(); } PageUtility.ShowModelDlg(this.Page, "Save Fail!" + ex.ToString()); } finally { if (transaction != null) { transaction.Dispose(); } } }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); //lwy, migrate from mainpage if (Session["StuffUser"] == null) { this.NavigateMenu.Visible = false; return; } if (!IsPostBack) { AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; if (Session["ProxyStuffUserId"] != null) { this.Session["Position"] = new OUTreeBLL().GetPositionById((int)Session["PositionId"]); this.Session["StuffUser"] = new StuffUserBLL().GetStuffUserById((int)Session["StuffUserId"])[0]; List <string> useRootItems = new List <string>(); useRootItems.Add(" 申请与报销"); //useRootItems.Add("个人费用报销申请"); //useRootItems.Add("出差申请"); //useRootItems.Add("出差报销申请"); this.CustomizeNavigateMenu(); List <MenuItem> noUseRootItems = new List <MenuItem>(); foreach (MenuItem rootItem in this.NavigateMenu.Items) { if (!useRootItems.Contains(rootItem.Text)) { noUseRootItems.Add(rootItem); } } foreach (MenuItem noUseRootItem in noUseRootItems) { this.NavigateMenu.Items.Remove(noUseRootItem); } this.CustomizeNavigateMenu(); } else { AuthorizationBLL bll = new AuthorizationBLL(); AuthorizationDS.PositionDataTable positions = bll.GetPositionByStuffUser(stuffUser.StuffUserId); if (positions.Count == 0) { PageUtility.ShowModelDlg(this.Page, "没有设置职务,请联系系统管理员"); this.Response.Redirect("~/ErrorPage/NoPositionErrorPage.aspx"); return; } this.PositionSelectCtl.Items.Clear(); foreach (AuthorizationDS.PositionRow position in positions) { this.PositionSelectCtl.Items.Add(new ListItem(position.PositionName, position.PositionId.ToString())); } if (positions.Count > 0) { this.PositionSelectCtl.Visible = true; this.PositionSelectLabel.Visible = true; } if (this.Session["SelectedPosition"] == null) { int currentPositionId = int.Parse(this.PositionSelectCtl.SelectedValue); Session["Position"] = new OUTreeBLL().GetPositionById(currentPositionId); } else { Session["Position"] = Session["SelectedPosition"]; this.PositionSelectCtl.SelectedValue = ((AuthorizationDS.PositionRow)Session["Position"]).PositionId.ToString(); } if (Session["Position"] == null) { int currentPositionId = int.Parse(this.PositionSelectCtl.SelectedValue); Session["Position"] = new OUTreeBLL().GetPositionById(currentPositionId); } else { this.PositionSelectCtl.SelectedValue = ((AuthorizationDS.PositionRow)Session["Position"]).PositionId.ToString(); } } AuthorizationDS.StuffUserRow user = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; this.StuffNameCtl.Text = user.StuffName; this.LastLogInTimeCtl.Text = user.IsLaterLogInTimeNull() ? "" : user.LaterLogInTime.ToShortDateString(); } this.CustomizeNavigateMenu(); }
public void SaveDataToDB(string FullPath, string FileName, string excelFileExtension) { SqlTransaction transaction = null; try { DataTable dt = null; dt = this.GetDataSet(FullPath, excelFileExtension).Tables[0]; if (dt.Rows.Count <= 1) { PageUtility.ShowModelDlg(this.Page, "文件中没有任何记录,请重新选择"); return; } CustomerTableAdapter TACustomer = new CustomerTableAdapter(); ImportLogTableAdapter TAImportLog = new ImportLogTableAdapter(); ImportLogDetailTableAdapter TAImportLogDetail = new ImportLogDetailTableAdapter(); MasterDataBLL mdBLL = new MasterDataBLL(); transaction = TableAdapterHelper.BeginTransaction(TACustomer); TableAdapterHelper.SetTransaction(TAImportLog, transaction); TableAdapterHelper.SetTransaction(TAImportLogDetail, transaction); //存储log信息 ImportDS.ImportLogDataTable logTable = new ImportDS.ImportLogDataTable(); ImportDS.ImportLogRow logRow = logTable.NewImportLogRow(); int stuffUserID = ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId; string fullname = this.fileUpLoad.PostedFile.FileName.ToString(); string tmpFile = fullname.Remove(0, fullname.LastIndexOf("\\") + 1); logRow.FileName = tmpFile; logRow.ImportDate = DateTime.Now; logRow.ImportUserID = stuffUserID; logRow.ImportType = 3; logRow.TotalCount = dt.Rows.Count - 1; logRow.SuccessCount = dt.Rows.Count - 1; logRow.FailCount = 0; logTable.AddImportLogRow(logRow); TAImportLog.Update(logTable); //处理每条明细 ERS.CustomerDataTable tbCustomer = new ERS.CustomerDataTable(); ImportDS.ImportLogDetailDataTable ImportLogDetailTable = new ImportDS.ImportLogDetailDataTable(); int row_count = dt.Rows.Count; string errorInfor = string.Empty; // int expenseTypeID = int.Parse(ExpenseTypeDDL.SelectedValue); //开始处理每条明细 for (int i = 1; i <= row_count - 1; i++) { if (CheckData(dt.Rows[i]) != null) { errorInfor = "第" + (i + 1) + "行有错:" + CheckData(dt.Rows[i]); ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else { DataRow row = dt.Rows[i]; string CustomerNo = row[0].ToString().Trim(); string CustomerName = row[1].ToString().Trim(); string ProvinceName = row[2].ToString().Trim(); string CityName = row[3].ToString().Trim(); string CustomerTypeName = row[4].ToString().Trim(); string ChannelTypeName = row[5].ToString().Trim(); string OUName = row[6].ToString().Trim(); string BudgetOUName = row[7].ToString().Trim(); ERS.CustomerDataTable tbCustomerTemp = mdBLL.GetCustomerByCustomerName(CustomerName); if (tbCustomerTemp != null && tbCustomerTemp.Count > 0) { errorInfor = "第" + (i + 1) + "行有错:已存在客户《" + CustomerName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } //ERS.ProvinceDataTable tbProvince = mdBLL.GetProvinceByProvinceName(ProvinceName); //if (tbProvince == null || tbProvince.Count == 0) { // errorInfor = "第" + (i + 1) + "行有错:找不到省份《" + ProvinceName + "》"; // ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); // ImportDetailRow.LogID = logRow.LogID; // ImportDetailRow.Line = i + 1; // ImportDetailRow.Error = errorInfor; // ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); // logRow.FailCount = logRow.FailCount + 1; // logRow.SuccessCount = logRow.SuccessCount - 1; // TAImportLog.Update(logRow); // continue; //} ERS.CityDataTable tbCity = mdBLL.GetCityByCityName(CityName); if (tbCity == null || tbCity.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:找不到城市《" + CityName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } ERS.CustomerTypeDataTable tbCustomerType = mdBLL.GetCustomerTypeByCustomerTypeName(CustomerTypeName); if (tbCustomerType == null || tbCustomerType.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:找不到客户类型《" + CustomerTypeName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } ERS.ChannelTypeDataTable tbChannelType = mdBLL.GetChannelTypeByChannelTypeName(ChannelTypeName); if (tbChannelType == null || tbChannelType.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:找不到客户渠道《" + ChannelTypeName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } AuthorizationDS.OrganizationUnitDataTable ouTable = new OUTreeBLL().GetDataByOrganizationUnitName(OUName); if (ouTable == null || ouTable.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:系统中找不到此部门《" + OUName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } if (ouTable.Count > 1) { errorInfor = "第" + (i + 1) + "行有错:系统中找到多个此名称的部门《" + OUName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } AuthorizationDS.OrganizationUnitDataTable BudgetOUTable = new OUTreeBLL().GetDataByOrganizationUnitName(BudgetOUName); if (BudgetOUTable == null || BudgetOUTable.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:系统中找不到此部门《" + BudgetOUName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } if (BudgetOUTable.Count > 1) { errorInfor = "第" + (i + 1) + "行有错:系统中找到多个此名称的部门《" + BudgetOUName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } ERS.CustomerRow rowCustomer = tbCustomer.NewCustomerRow(); rowCustomer.CustomerNo = CustomerNo; rowCustomer.CustomerName = CustomerName; rowCustomer.CityID = tbCity[0].CityID; rowCustomer.CustomerTypeID = tbCustomerType[0].CustomerTypeID; rowCustomer.ChannelTypeID = tbChannelType[0].ChannelTypeID; rowCustomer.OrganizationUnitID = ouTable[0].OrganizationUnitId; rowCustomer.ApplyOrganizationUnitID = BudgetOUTable[0].OrganizationUnitId; rowCustomer.IsActive = true; tbCustomer.AddCustomerRow(rowCustomer); TACustomer.Update(rowCustomer); } } TAImportLog.Update(logRow); TAImportLogDetail.Update(ImportLogDetailTable); transaction.Commit(); string returnString = "成功导入" + logRow.SuccessCount.ToString() + "条信息"; PageUtility.ShowModelDlg(this.Page, returnString); } catch (Exception ex) { if (transaction != null) { transaction.Rollback(); } PageUtility.ShowModelDlg(this.Page, "Save Fail!" + ex.ToString()); } finally { if (transaction != null) { transaction.Dispose(); } } }