Пример #1
0
 public string GetCompanyID()
 {
     MasterDataBLL mdBLL = new MasterDataBLL();
     OUTreeBLL otBLL = new OUTreeBLL();
     AuthorizationDS.PositionRow rowPosition = (AuthorizationDS.PositionRow)Session["Position"];
     AuthorizationDS.OrganizationUnitRow rowOU = GetNearestCostCenter(rowPosition.OrganizationUnitId);
     MasterData.CostCenterRow rowCostCenter = mdBLL.GetCostCenterById(rowOU.CostCenterID);
     return rowCostCenter.CompanyID.ToString();
 }
Пример #2
0
 public AuthorizationDS.OrganizationUnitRow GetNearestCostCenter(int OUID)
 {
     OUTreeBLL otBLL = new OUTreeBLL();
     AuthorizationDS.OrganizationUnitRow rowOU = otBLL.GetOrganizationUnitById(OUID);
     if (rowOU.IsCostCenterIDNull()) {
         return GetNearestCostCenter(rowOU.ParentOrganizationUnitId);
     } else {
         return rowOU;
     }
 }
Пример #3
0
        /// <summary>
        /// 设置职务的系统角色
        /// </summary>
        /// <param name="positionId"></param>
        /// <param name="systemRoleIds"></param>
        public void SetPositionSystemRole(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int positionId, int[] systemRoleIds)
        {
            StringBuilder oldContent = new StringBuilder();
            StringBuilder newContent = new StringBuilder();

            BusinessObjects.AuthorizationDS.PositionAndSystemRoleDataTable table = this.PositionAndSystemRoleTA.GetDataByPositionId(positionId);
            List <int> roleIds = new List <int>(systemRoleIds);

            foreach (BusinessObjects.AuthorizationDS.PositionAndSystemRoleRow positionAndSystemRole in table)
            {
                if (roleIds.Contains(positionAndSystemRole.SystemRoleId))
                {
                    roleIds.Remove(positionAndSystemRole.SystemRoleId);
                }
                else
                {
                    oldContent.Append("[").Append(this.SystemRoleTA.GetSystemRoleName(positionAndSystemRole.SystemRoleId)).Append("] ");
                    positionAndSystemRole.Delete();
                }
            }
            foreach (int roleId in roleIds)
            {
                BusinessObjects.AuthorizationDS.PositionAndSystemRoleRow newRow = table.NewPositionAndSystemRoleRow();
                newRow.PositionId   = positionId;
                newRow.SystemRoleId = roleId;
                newContent.Append("[").Append(this.SystemRoleTA.GetSystemRoleName(roleId)).Append("] ");
                table.AddPositionAndSystemRoleRow(newRow);
            }

            this.PositionAndSystemRoleTA.Update(table);

            if (oldContent.Length > 0 || newContent.Length > 0)
            {
                AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
                authorizationConfigure.StuffId         = stuffUser.StuffId;
                authorizationConfigure.StuffName       = stuffUser.StuffName;
                authorizationConfigure.ConfigureTarget = "职务权限设置";
                authorizationConfigure.ConfigureTime   = DateTime.Now;
                authorizationConfigure.ConfigureType   = "更新";
                string positionName = new OUTreeBLL().GetPositionById(positionId).PositionName;
                if (oldContent.Length > 0)
                {
                    oldContent.Insert(0, "撤销职务[" + positionName + "]的系统角色:");
                    authorizationConfigure.OldContent = oldContent.ToString();
                }
                if (newContent.Length > 0)
                {
                    newContent.Insert(0, "新增职务[" + positionName + "]的系统角色:");
                    authorizationConfigure.NewContent = newContent.ToString();
                }
                SysLog.LogAuthorizationConfigure(authorizationConfigure);
            }
        }
Пример #4
0
    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));
        }
    }
 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;
         }
     }
 }
Пример #6
0
    public XmlDocument GetApprovalInfoByFormID(int FormID)
    {
        MasterData myDS = new MasterData();
        MasterData.ApprovalInfoDataTable tbApprovalInfo = myDS.ApprovalInfo;
        AuthorizationDS.PositionDataTable tbPosition = null;
        int index = 1;

        AuthorizationBLL authBLL = new AuthorizationBLL();
        OUTreeBLL ouBLL = new OUTreeBLL();

        MasterData.ApprovalInfoRow rowApprovalInfo = tbApprovalInfo.NewApprovalInfoRow();

        FormDS.FormRow rowForm = new FormSaleBLL().GetFormByID(FormID)[0];
        rowApprovalInfo.ApprovalInfoID = index++;
        rowApprovalInfo.StuffName = authBLL.GetStuffUserById(rowForm.UserID).StuffName;
        rowApprovalInfo.ApprovalDate = rowForm.SubmitDate.ToString("yyyy-MM-dd HH:mm");
        rowApprovalInfo.Position = ouBLL.GetPositionById(rowForm.PositionID).PositionName;
        rowApprovalInfo.Comment = "";
        rowApprovalInfo.Status = "Submit";
        tbApprovalInfo.AddApprovalInfoRow(rowApprovalInfo);

        if (!rowForm.IsProcIDNull()) {
            APWorkFlow.NodeStatusDataTable nodeTable = new APHelper().getApprovalStatus(rowForm.ProcID);
            foreach (APWorkFlow.NodeStatusRow item in nodeTable) {
                if ((!item.IsSTATUSNull()) && item.STATUS != "ASSIGNED") {
                    rowApprovalInfo = tbApprovalInfo.NewApprovalInfoRow();
                    item.PARTICIPANT = item.PARTICIPANT.Replace("PP", "P");
                    rowApprovalInfo.ApprovalInfoID = index++;
                    int i = 0;
                    foreach (var userid in item.PARTICIPANT.Split('$')[0].Split('P')) {

                        if ((!string.IsNullOrEmpty(userid)) && authBLL.GetStuffUserById(int.Parse(userid)).StuffName.Trim().Equals(item.APPROVED_BY)) {
                            tbPosition = ouBLL.GetPositionsByID(int.Parse(item.PARTICIPANT.Split('$')[1].Split('P')[i]));
                            rowApprovalInfo.Position = tbPosition.Count > 0 ? tbPosition[0].PositionName : "";
                            break;
                        }
                        i++;
                    }
                    rowApprovalInfo.StuffName = item.APPROVED_BY;
                    rowApprovalInfo.ApprovalDate = item.IsCOMPLETED_DATENull() ? "" : item.COMPLETED_DATE;

                    rowApprovalInfo.Comment = item.IsCOMMENTSNull() ? "" : item.COMMENTS;
                    rowApprovalInfo.Status = item.IsSTATUSNull() ? "" : item.STATUS;
                    tbApprovalInfo.AddApprovalInfoRow(rowApprovalInfo);
                }
            }
        }

        return new XmlDataDocument(myDS);
    }
Пример #7
0
    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();
        }
    }
Пример #8
0
        //启动流程
        public APResult CreateProcess(APParameter app)
        {
            APResult result = new APResult();
            string email = string.Empty;
            string l_strtitle = "";
            StuffUserBLL stuffuserbll = new StuffUserBLL();
            StringBuilder l_strbody = new StringBuilder();
            OUTreeBLL outreebll = new OUTreeBLL();
            string Deptment = outreebll.GetFlowParameter(app.OrganizationUnitID);
            Dictionary<string, object> Dictionary = app.Dic;
            Dictionary["Department"] = Deptment;
            AuthorizationDS.PositionRow position = outreebll.GetPositionById(app.PositionID);
            if (position.IsFlowLevelNull()) {
                Dictionary["FlowLevel"] = "";
            } else {
                Dictionary["FlowLevel"] = position.FlowLevel;
            }
            string ProcID = AP.createProcess(app.FormNo + ":" + DateTime.Now.ToString(), new AuthorizationBLL().GetFlowTemplateNameByFormTypeAndUserID(app.FormTypeID, app.UserID), Dictionary);
            result.ProcID = ProcID;

            string[] InTurn = AP.startProcess(ProcID, app.OrganizationUnitID, ref email).Split('&');//不同流程角色下的人员和职位
            string ids = "";
            string pids = "";
            for (int a = 0; a < InTurn.Length; a++) {
                ids += InTurn[a].Split('$')[0].ToString();///人员
                pids += InTurn[a].Split('$')[1].ToString();//职位
            }
            result.ApprovedDate = DateTime.Now;
            result.InTurnUserIds = ids;//下一步的人员
            result.InTurnPositionIds = pids;//下一步的人员职位
            result.StatusID = (int)SystemEnums.FormStatus.Awaiting;
            //自动审批下一个节点是自己的
            if (!(ids.IndexOf("27") >= 0)) {
                if (ids.IndexOf(app.UserID.ToString()) > 0) {
                    APResult approveresult = ApproveForm(app, app.FormID, app.UserID, stuffuserbll.GetStuffUserById(app.UserID)[0].StuffName, true, "", "", ProcID);
                    result.InTurnUserIds = approveresult.InTurnUserIds;
                    result.InTurnPositionIds = approveresult.InTurnPositionIds;
                }
            }

            try {
                if (!string.IsNullOrEmpty(email)) {
                    //QueryDS.FormViewRow l_drformView = new FormQueryBLL().GetFormViewByID(app.FormID);
                    l_strtitle = "有一份单据编号为:" + app.FormNo + ",等待您的审批!";
                    l_strbody.Append("您好,<br>");
                    l_strbody.Append("&nbsp;&nbsp;您有一份" + new StuffUserBLL().GetStuffUserById(app.UserID)[0].StuffName + "提交的单据,编号为:" + app.FormNo + ",等待您的审批!");

                    l_strbody.Append("<br>此邮件请勿回复!");
                    mailBody = string.Format(mailBody, l_strbody.ToString());
                    sendMail(email, "", l_strtitle, mailBody);
                    //AP.sendMail(emailTo, "", l_strtitle, mailBody);
                }
            } catch {
            }
            return result;
        }
Пример #9
0
 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;
     }
 }
Пример #10
0
        private bool ExportPO(int formid, int logId)
        {
            string BakPath = ConfigurationManager.AppSettings["ExportService.BakPath"];
            AuthorizationBLL authorizationbll = new AuthorizationBLL();
            MasterDataBLL masterdatabll = new MasterDataBLL();
            FormQueryBLL formQueryBLL = new FormQueryBLL();
            FormPurchaseBLL formPurchaseBLL = new FormPurchaseBLL();
            OUTreeBLL outreebll = new OUTreeBLL();
            PurchaseDS.FormDataTable l_dtform = new PurchaseDS.FormDataTable();
            PurchaseDS.FormRow form = l_dtform.NewFormRow();
            try {
                PurchaseDS.FormPORow formPO = formPurchaseBLL.GetFormPOByID(formid);

                PurchaseDS.FormPODetailDataTable formPODetail = formPurchaseBLL.GetPODetailByFormPOID(formPO.FormPOID);
                form = formPurchaseBLL.GetFormByID(formPO.FormPOID)[0];
                string POFileName = ConfigurationManager.AppSettings["ExportService.POFileName"];
                string POLineFileName = ConfigurationManager.AppSettings["ExportService.POLineFileName"];
                string spit = "\t";
                string CompanyCode = masterdatabll.GetCompanyById(masterdatabll.GetVendorTypeById(masterdatabll.GetVendorByID(formPO.VendorID).VendorTypeID).CompanyID).CompanyCode;
                string VendorCode = masterdatabll.GetVendorByID(formPO.VendorID).VendorCode;
                string POcontent = (
                   "PH" + spit +
                    "" + spit +
                   formPO.BPCSPONo + spit +
                    "0" + spit +
                    "" + spit +
                    "0" + spit +
                     CompanyCode + spit +
                    "" + spit +
                     CompanyCode + spit +
                    VendorCode + spit +
                    "0" + spit +
                    "4" + spit +
                    "" + spit +
                    masterdatabll.GetCompanyById(formPO.CompanyID).CompanyName + spit +
                    authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                    bSubstring(formPO.DeliveryAddress, 30) + spit +
                    SpitAddress(formPO.DeliveryAddress, 60) + spit +
                    SpitAddress(formPO.DeliveryAddress, 90) + spit +
                    "" + spit +
                    "" + spit +
                    "" + spit +
                    form.SubmitDate.ToString("yyyyMMdd") + spit +
                    "0" + spit +
                    "0" + spit +
                    "0" + spit +
                    formPODetail[0].DeliveryDate.ToString("yyyyMMdd") + spit +
                    "0" + spit +
                    "0" + spit +
                    bSubstring(formPO.Remark, 30) + spit +
                    masterdatabll.GetPaymentTermById(masterdatabll.GetVendorByID(formPO.VendorID).PaymentTermID)[0].PaymentTermName + spit +
                    "1" + spit +
                    "" + spit +
                    outreebll.GetOrganizationUnitById(form.OrganizationUnitID).OrganizationUnitCode + spit +
                    masterdatabll.GetShippingTermById(formPO.ShippingTermID).ShippingTermCode + spit +
                    "" + spit +
                    masterdatabll.GetCurrencyByID(formPO.CurrencyID).CurrencyShortName + spit +
                    formPO.ExchangeRate + spit +
                    formPO.ExchangeRate + spit +
                    formPODetail.Rows.Count + spit +
                    formPO.ExchangeRate + spit +
                    authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                    "" + spit +
                     authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                   form.ApprovedDate.ToString("yyyyMMdd") + spit +
                    "" + spit +
                    "0" + spit +
                    "" + spit +
                    "0" + spit +
                    "" + spit +
                    "" + spit +
                    "" + spit +
                    "" + spit +
                    "").Replace("\r", "").Replace("\n", "");
                int order = 0;
                string[] PODetailcontent = new string[formPODetail.Rows.Count];
                foreach (PurchaseDS.FormPODetailRow l_drformPODetail in formPODetail) {
                    order++;
                    PODetailcontent[order - 1] = (
                        "PO" + spit +
                         formPO.BPCSPONo + spit +
                         order + spit +
                         l_drformPODetail.ItemCode.ToUpper() + spit +
                         VendorCode + spit +
                         l_drformPODetail.Quantity + spit +
                         l_drformPODetail.Quantity + spit +
                         l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                         "" + spit +
                         "0" + spit +
                         l_drformPODetail.AmountRMB.ToString() + spit +
                         "0" + spit +
                         "0" + spit +
                         "EA" + spit +
                         "0" + spit +
                         "" + spit +
                         "0" + spit +
                         "0" + spit +
                         "" + spit +
                         "" + spit +
                         "" + spit +
                         DateTime.Now.ToString("yyyyMMdd") + spit +
                         masterdatabll.GetPaymentTermById(masterdatabll.GetVendorByID(formPO.VendorID).PaymentTermID)[0].PaymentTermName + spit +
                         "" + spit +
                         "0" + spit +
                         "1" + spit +
                         "1" + spit +
                         "" + spit +
                         CompanyCode + spit +
                         "0" + spit +
                         "0" + spit +
                         "0" + spit +
                         "0" + spit +
                         l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                         "" + spit +
                         "0" + spit +
                         "0" + spit +
                         "" + spit +
                         masterdatabll.GetCurrencyByID(formPO.CurrencyID).CurrencyShortName + spit +
                         formPO.ExchangeRate + spit +
                         formPO.ExchangeRate + spit +
                         "0" + spit +
                         l_drformPODetail.AmountRMB.ToString() + spit +
                         "0" + spit +
                         "1" + spit +
                         "" + spit +
                          "0" + spit +
                         "0" + spit +
                         "0" + spit +
                        "" + spit +
                        "" + spit +
                        "" + spit +
                        "01" + spit +
                        "4" + spit +
                       masterdatabll.GetCompanyById(formPO.CompanyID).CompanyName + spit +//Ship To Company
                       authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                        bSubstring(formPO.DeliveryAddress, 30) + spit +
                    SpitAddress(formPO.DeliveryAddress, 60) + spit +
                    SpitAddress(formPO.DeliveryAddress, 90) + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "0" + spit +
                       "0" + spit +
                       l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                       "0" + spit +
                       l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                       l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                       "" + spit +
                       outreebll.GetOrganizationUnitById(form.OrganizationUnitID).OrganizationUnitCode + spit +
                       "" + spit +
                       "" + spit +
                       masterdatabll.GetCostCenterById(form.CostCenterID).CostCenterCode + spit +
                       l_drformPODetail.ItemCode.ToUpper() + spit +
                       l_drformPODetail.ItemDescription + spit +
                       "1" + spit +
                       "0" + spit +
                       "0" + spit +
                       "3" + spit +
                       "0" + spit +
                       "0" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       l_drformPODetail.Quantity).Replace("\r", "").Replace("\n", ""); ;
                }

                File.AppendAllLines(path + POLineFileName, PODetailcontent, Encoding.Default);
                File.AppendAllLines(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + POLineFileName, PODetailcontent, Encoding.Default);

                File.AppendAllText(path + POFileName, POcontent + "\r\n", Encoding.Default);
                File.AppendAllText(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + POFileName, POcontent, Encoding.Default);

            } catch (Exception e) {
                logbll.InsertExportLogDetail(logId, "单据编号:" + form.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(form.UserID)[0].StuffName + ",错误信息:" + e.Message);
                return false;
            }
            return true;
        }
Пример #11
0
 public string GetTreePathByOUID(int OUID)
 {
     String TreePath = string.Empty;
     AuthorizationDS.OrganizationUnitRow OU = new OUTreeBLL().GetOrganizationUnitById(OUID);
     if (!OU.IsOrganizationTreePathNull()) {
         TreePath = OU.OrganizationTreePath + "P" + OUID + "P ";
     } else {
         TreePath = "P" + OUID + "P ";
     }
     return TreePath;
 }
Пример #12
0
    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) + "���д��ϵͳ���ҵ���������ƵIJ��š�" + 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();
            }
        }
    }
Пример #13
0
        /// <summary>
        /// 批量设置职务的业务操作范围
        /// </summary>
        /// <param name="positionId">职务ID</param>
        /// <param name="operateIds">批量业务操作ID数组</param>
        /// <param name="scopeOUIds">操作范围覆盖的组织机构ID数组</param>
        /// <param name="scopePOIds">操作范围覆盖的职务ID数组</param>
        public void SetOperateScope(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int positionId, int[] operateIds, int[] scopeOUIds, int[] scopePOIds)
        {
            StringBuilder deleteContent = new StringBuilder();
            StringBuilder addContent    = new StringBuilder();

            foreach (int operateId in operateIds)
            {
                string        operateName = (string)this.BusinessOperateTA.GetBusinessOperateName(operateId);
                StringBuilder addStr      = new StringBuilder();
                StringBuilder deleteStr   = new StringBuilder();
                List <int>    sOUIds      = new List <int>(scopeOUIds);
                List <int>    sPOIds      = new List <int>(scopePOIds);
                BusinessObjects.AuthorizationDS.OperateScopeDataTable table = this.OperateScopeTA.GetDataByOperateAndPosition(operateId, positionId);
                foreach (BusinessObjects.AuthorizationDS.OperateScopeRow operateScope in table)
                {
                    if (operateScope.IsScopeOrganziationUnitIdNull())
                    {
                        if (sPOIds.Contains(operateScope.ScopePositionId))
                        {
                            sPOIds.Remove(operateScope.ScopePositionId);
                        }
                        else
                        {
                            deleteStr.Append("职务[" +
                                             new OUTreeBLL().GetPositionById(operateScope.ScopePositionId).PositionName + "] ");
                            operateScope.Delete();
                        }
                    }
                    else
                    {
                        if (sOUIds.Contains(operateScope.ScopeOrganziationUnitId))
                        {
                            sOUIds.Remove(operateScope.ScopeOrganziationUnitId);
                        }
                        else
                        {
                            deleteStr.Append("机构[" +
                                             new OUTreeBLL().GetOrganizationUnitById(operateScope.ScopeOrganziationUnitId).OrganizationUnitName + "] ");

                            operateScope.Delete();
                        }
                    }
                }

                if (deleteStr.Length > 0)
                {
                    deleteStr.Insert(0, "撤销业务操作[" + operateName + "]包含数据范围:");
                    deleteContent.Append(deleteStr.ToString());
                }

                foreach (int ouId in sOUIds)
                {
                    BusinessObjects.AuthorizationDS.OperateScopeRow newRow = table.NewOperateScopeRow();
                    newRow.PositionId              = positionId;
                    newRow.BusinessOperateId       = operateId;
                    newRow.ScopeOrganziationUnitId = ouId;
                    table.AddOperateScopeRow(newRow);
                    addStr.Append("机构[" + new OUTreeBLL().GetOrganizationUnitById(ouId).OrganizationUnitName + "] ");
                }
                foreach (int poId in sPOIds)
                {
                    BusinessObjects.AuthorizationDS.OperateScopeRow newRow = table.NewOperateScopeRow();
                    newRow.PositionId        = positionId;
                    newRow.BusinessOperateId = operateId;
                    newRow.ScopePositionId   = poId;
                    table.AddOperateScopeRow(newRow);
                    addStr.Append("职务[" + new OUTreeBLL().GetPositionById(poId).PositionName + "] ");
                }

                if (addStr.Length > 0)
                {
                    addStr.Insert(0, "新增业务操作[" + operateName + "]包含数据范围:");
                    addContent.Append(addStr.ToString());
                }

                this.OperateScopeTA.Update(table);
            }
            if (deleteContent.Length > 0 || addContent.Length > 0)
            {
                AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
                authorizationConfigure.StuffId         = stuffUser.StuffId;
                authorizationConfigure.StuffName       = stuffUser.StuffName;
                authorizationConfigure.ConfigureType   = "更新";
                authorizationConfigure.ConfigureTarget = "业务操作范围";
                authorizationConfigure.ConfigureTime   = DateTime.Now;
                string positionName = new OUTreeBLL().GetPositionById(positionId).PositionName;
                if (deleteContent.Length > 0)
                {
                    deleteContent.Insert(0, "职务[" + positionName + "]:");
                    authorizationConfigure.OldContent = deleteContent.ToString();
                }
                if (addContent.Length > 0)
                {
                    addContent.Insert(0, "职务[" + positionName + "]:");
                    authorizationConfigure.NewContent = addContent.ToString();
                }
                SysLog.LogAuthorizationConfigure(authorizationConfigure);
            }
        }
Пример #14
0
    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();
    }
Пример #15
0
 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");
 }
Пример #16
0
        /// <summary>
        /// ��������ְ���ҵ�������Χ
        /// </summary>
        /// <param name="positionId">ְ��ID</param>
        /// <param name="operateIds">����ҵ�����ID����</param>
        /// <param name="scopeOUIds">������Χ���ǵ���֯����ID����</param>
        /// <param name="scopePOIds">������Χ���ǵ�ְ��ID����</param>
        public void SetOperateScope(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int positionId, int[] operateIds, int[] scopeOUIds, int[] scopePOIds)
        {
            StringBuilder deleteContent = new StringBuilder();
            StringBuilder addContent = new StringBuilder();

            foreach (int operateId in operateIds) {
                string operateName = (string)this.BusinessOperateTA.GetBusinessOperateName(operateId);
                StringBuilder addStr = new StringBuilder();
                StringBuilder deleteStr = new StringBuilder();
                List<int> sOUIds = new List<int>(scopeOUIds);
                List<int> sPOIds = new List<int>(scopePOIds);
                BusinessObjects.AuthorizationDS.OperateScopeDataTable table = this.OperateScopeTA.GetDataByOperateAndPosition(operateId, positionId);
                foreach (BusinessObjects.AuthorizationDS.OperateScopeRow operateScope in table) {
                    if (operateScope.IsScopeOrganziationUnitIdNull()) {
                        if (sPOIds.Contains(operateScope.ScopePositionId)) {
                            sPOIds.Remove(operateScope.ScopePositionId);
                        } else {
                            deleteStr.Append("ְ��[" +
                            new OUTreeBLL().GetPositionById(operateScope.ScopePositionId).PositionName + "] ");
                            operateScope.Delete();
                        }
                    } else {
                        if (sOUIds.Contains(operateScope.ScopeOrganziationUnitId)) {
                            sOUIds.Remove(operateScope.ScopeOrganziationUnitId);
                        } else {
                            deleteStr.Append("����[" +
                            new OUTreeBLL().GetOrganizationUnitById(operateScope.ScopeOrganziationUnitId).OrganizationUnitName + "] ");

                            operateScope.Delete();
                        }
                    }
                }

                if (deleteStr.Length > 0) {
                    deleteStr.Insert(0, "����ҵ�����[" + operateName + "]�������ݷ�Χ��");
                    deleteContent.Append(deleteStr.ToString());
                }

                foreach (int ouId in sOUIds) {
                    BusinessObjects.AuthorizationDS.OperateScopeRow newRow = table.NewOperateScopeRow();
                    newRow.PositionId = positionId;
                    newRow.BusinessOperateId = operateId;
                    newRow.ScopeOrganziationUnitId = ouId;
                    table.AddOperateScopeRow(newRow);
                    addStr.Append("����[" + new OUTreeBLL().GetOrganizationUnitById(ouId).OrganizationUnitName + "] ");
                }
                foreach (int poId in sPOIds) {
                    BusinessObjects.AuthorizationDS.OperateScopeRow newRow = table.NewOperateScopeRow();
                    newRow.PositionId = positionId;
                    newRow.BusinessOperateId = operateId;
                    newRow.ScopePositionId = poId;
                    table.AddOperateScopeRow(newRow);
                    addStr.Append("ְ��[" + new OUTreeBLL().GetPositionById(poId).PositionName + "] ");
                }

                if (addStr.Length > 0) {
                    addStr.Insert(0, "����ҵ�����[" + operateName + "]�������ݷ�Χ��");
                    addContent.Append(addStr.ToString());
                }

                this.OperateScopeTA.Update(table);
            }
            if (deleteContent.Length > 0 || addContent.Length > 0) {
                AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
                authorizationConfigure.StuffId = stuffUser.StuffId;
                authorizationConfigure.StuffName = stuffUser.StuffName;
                authorizationConfigure.ConfigureType = "����";
                authorizationConfigure.ConfigureTarget = "ҵ�������Χ";
                authorizationConfigure.ConfigureTime = DateTime.Now;
                string positionName = new OUTreeBLL().GetPositionById(positionId).PositionName;
                if (deleteContent.Length > 0) {
                    deleteContent.Insert(0, "ְ��[" + positionName + "]��");
                    authorizationConfigure.OldContent = deleteContent.ToString();
                }
                if (addContent.Length > 0) {
                    addContent.Insert(0, "ְ��[" + positionName + "]��");
                    authorizationConfigure.NewContent = addContent.ToString();
                }
                SysLog.LogAuthorizationConfigure(authorizationConfigure);
            }
        }
Пример #17
0
        /// <summary>
        /// ����ְ���ϵͳ��ɫ
        /// </summary>
        /// <param name="positionId"></param>
        /// <param name="systemRoleIds"></param>
        public void SetPositionSystemRole(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int positionId, int[] systemRoleIds)
        {
            StringBuilder oldContent = new StringBuilder();
            StringBuilder newContent = new StringBuilder();

            BusinessObjects.AuthorizationDS.PositionAndSystemRoleDataTable table = this.PositionAndSystemRoleTA.GetDataByPositionId(positionId);
            List<int> roleIds = new List<int>(systemRoleIds);
            foreach (BusinessObjects.AuthorizationDS.PositionAndSystemRoleRow positionAndSystemRole in table) {
                if (roleIds.Contains(positionAndSystemRole.SystemRoleId)) {
                    roleIds.Remove(positionAndSystemRole.SystemRoleId);
                } else {
                    oldContent.Append("[").Append(this.SystemRoleTA.GetSystemRoleName(positionAndSystemRole.SystemRoleId)).Append("] ");
                    positionAndSystemRole.Delete();
                }
            }
            foreach (int roleId in roleIds) {
                BusinessObjects.AuthorizationDS.PositionAndSystemRoleRow newRow = table.NewPositionAndSystemRoleRow();
                newRow.PositionId = positionId;
                newRow.SystemRoleId = roleId;
                newContent.Append("[").Append(this.SystemRoleTA.GetSystemRoleName(roleId)).Append("] ");
                table.AddPositionAndSystemRoleRow(newRow);
            }

            this.PositionAndSystemRoleTA.Update(table);

            if (oldContent.Length > 0 || newContent.Length > 0) {
                AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
                authorizationConfigure.StuffId = stuffUser.StuffId;
                authorizationConfigure.StuffName = stuffUser.StuffName;
                authorizationConfigure.ConfigureTarget = "ְ��Ȩ������";
                authorizationConfigure.ConfigureTime = DateTime.Now;
                authorizationConfigure.ConfigureType = "����";
                string positionName = new OUTreeBLL().GetPositionById(positionId).PositionName;
                if (oldContent.Length > 0) {
                    oldContent.Insert(0, "����ְ��[" + positionName + "]��ϵͳ��ɫ��");
                    authorizationConfigure.OldContent = oldContent.ToString();
                }
                if (newContent.Length > 0) {
                    newContent.Insert(0, "����ְ��[" + positionName + "]��ϵͳ��ɫ��");
                    authorizationConfigure.NewContent = newContent.ToString();
                }
                SysLog.LogAuthorizationConfigure(authorizationConfigure);
            }
        }
Пример #18
0
    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) + "���д��ϵͳ���ҵ���������ƵIJ��š�" + 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) + "���д��ϵͳ���ҵ���������ƵIJ��š�" + 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();
            }
        }
    }