示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack)
        {
            PageUtility.SetContentTitle(this.Page, "方案申请审批");
            this.Page.Title = "方案申请审批";

            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            FormDS.FormRow      rowForm      = this.SalesApplyBLL.GetFormByID(formID)[0];
            FormDS.FormApplyRow rowFormApply = this.SalesApplyBLL.GetFormApplyByID(formID)[0];
            if (rowForm.IsProcIDNull())
            {
                ViewState["ProcID"] = "";
            }
            else
            {
                ViewState["ProcID"] = rowForm.ProcID;
            }
            ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID;
            this.FormNoCtl.Text             = rowForm.FormNo;
            this.ApplyDateCtl.Text          = rowForm.SubmitDate.ToShortDateString();
            AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID);
            this.StuffNameCtl.Text    = applicant.StuffName;
            this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName;
            if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null)
            {
                this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName;
            }
            this.AttendDateCtl.Text  = applicant.AttendDate.ToShortDateString();
            this.BeginPeriodCtl.Text = rowFormApply.BeginPeriod.ToString("yyyy-MM");
            this.EndPeriodCtl.Text   = rowFormApply.EndPeriod.ToString("yyyy-MM");
            MasterDataBLL masterBll = new MasterDataBLL();
            this.ExpenseSubCategoryCtl.Text = masterBll.GetExpenseSubCateNameById(rowFormApply.ExpenseSubCategoryID);
            ERS.CustomerRow customer = masterBll.GetCustomerById(rowFormApply.CustomerID);
            this.CustomerNameCtl.Text = customer.CustomerName;
            //this.CustomerTypeCtl.Text = masterBll.GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName;
            this.ShopNameCtl.Text    = masterBll.GetShopByID(rowFormApply.ShopID).ShopName;
            this.PaymentTypeCtl.Text = masterBll.GetPaymentTypeById(rowFormApply.PaymentTypeID).PaymentTypeName;
            if (!rowFormApply.IsContractNoNull())
            {
                this.ContractNoCtl.Text = rowFormApply.ContractNo;
            }
            this.AmountCtl.Text = rowFormApply.Amount.ToString("N");
            if (!rowFormApply.IsRemarkNull())
            {
                this.RemarkCtl.Text = rowFormApply.Remark;
            }
            if (!rowFormApply.IsAttachedFileNameNull())
            {
                this.UCFileUpload.AttachmentFileName = rowFormApply.AttachedFileName;
            }
            if (!rowFormApply.IsRealAttachedFileNameNull())
            {
                this.UCFileUpload.RealAttachmentFileName = rowFormApply.RealAttachedFileName;
            }

            if (!rowFormApply.IsPromotionBeginDateNull())
            {
                this.PromotionBeginCtl.Text = rowFormApply.PromotionBeginDate.ToString("yyyy-MM-dd");
            }
            if (!rowFormApply.IsPromotionEndDateNull())
            {
                this.PromotionEndCtl.Text = rowFormApply.PromotionEndDate.ToString("yyyy-MM-dd");
            }
            if (!rowFormApply.IsDeliveryBeginDateNull())
            {
                this.DeliveryBeginCtl.Text = rowFormApply.DeliveryBeginDate.ToString("yyyy-MM-dd");
            }
            if (!rowFormApply.IsDeliveryEndDateNull())
            {
                this.DeliveryEndCtl.Text = rowFormApply.DeliveryEndDate.ToString("yyyy-MM-dd");
            }
            if (!rowFormApply.IsFormApplyNameNull())
            {
                this.txtFormApplyName.Text = rowFormApply.FormApplyName;
            }
            this.PromotionScopeCtl.Text = masterBll.GetPromotionScopeById(rowFormApply.PromotionScopeID).PromotionScopeName;
            this.PromotionTypeCtl.Text  = masterBll.GetPromotionTypeById(rowFormApply.PromotionTypeID).PromotionTypeName;
            if (!rowFormApply.IsPromotionDescNull())
            {
                this.PromotionDescCtl.Text = rowFormApply.PromotionDesc;
            }
            this.ShelfTypeCtl.Text = masterBll.GetShelfTypeById(rowFormApply.ShelfTypeID).ShelfTypeName;
            if (!rowFormApply.IsFirstVolumeNull())
            {
                this.FirstVolumeCtl.Text = rowFormApply.FirstVolume.ToString();
            }
            if (!rowFormApply.IsSecondVolumeNull())
            {
                this.SecondVolumeCtl.Text = rowFormApply.SecondVolume.ToString();
            }
            if (!rowFormApply.IsThirdVolumeNull())
            {
                this.ThirdVolumeCtl.Text = rowFormApply.ThirdVolume.ToString();
            }
            if (!rowFormApply.IsAverageVolumeNull())
            {
                this.AverageVolumeCtl.Text = rowFormApply.AverageVolume.ToString();
            }

            if (!rowFormApply.IsReimburseRequirementsNull())
            {
                int ReimburseRequirement = rowFormApply.ReimburseRequirements;
                if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Picture) == (int)SystemEnums.ReimburseRequirements.Picture)
                {
                    chkListReimburseRequirements.Items[0].Selected = true;
                }
                if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Agreement) == (int)SystemEnums.ReimburseRequirements.Agreement)
                {
                    chkListReimburseRequirements.Items[1].Selected = true;
                }
                if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.DeliveryOrder) == (int)SystemEnums.ReimburseRequirements.DeliveryOrder)
                {
                    chkListReimburseRequirements.Items[2].Selected = true;
                }
                if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Contract) == (int)SystemEnums.ReimburseRequirements.Contract)
                {
                    chkListReimburseRequirements.Items[3].Selected = true;
                }
                if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.DM) == (int)SystemEnums.ReimburseRequirements.DM)
                {
                    chkListReimburseRequirements.Items[4].Selected = true;
                }
                if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Other) == (int)SystemEnums.ReimburseRequirements.Other)
                {
                    chkListReimburseRequirements.Items[5].Selected = true;
                }
            }

            //历史单据
            if (rowForm.IsRejectedFormIDNull())
            {
                lblRejectFormNo.Text = "无";
            }
            else
            {
                FormDS.FormRow rejectedForm = new SalesApplyBLL().GetFormByID(rowForm.RejectedFormID)[0];
                this.lblRejectFormNo.Text        = rejectedForm.FormNo;
                this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/SalesForm/SalesGeneralApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }

            //查看预算信息按钮
            this.btnViewBudget.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/ReportManage/SalesBudgetByPosition.aspx?ShowDialog=1','', 'dialogWidth:918px;dialogHeight:660px;resizable:yes;')";

            //预算信息
            this.CustomerBudgetCtl.Text       = rowFormApply.CustomerBudget.ToString("N");
            this.CustomerBudgetRemainCtl.Text = rowFormApply.CustomerBudgetRemain.ToString("N");
            this.OUBudgetCtl.Text             = rowFormApply.OUBudget.ToString("N");
            this.OUApprovedAmountCtl.Text     = rowFormApply.OUAppovedAmount.ToString("N");
            this.OUApprovingAmountCtl.Text    = rowFormApply.OUApprovingAmount.ToString("N");
            this.OUCompletedAmountCtl.Text    = rowFormApply.OUCompletedAmount.ToString("N");
            this.OUReimbursedAmountCtl.Text   = rowFormApply.OUReimbursedAmount.ToString("N");
            this.OUBudgetRemainCtl.Text       = rowFormApply.OUBudgetRemain.ToString("N");
            this.OUBudgetRateCtl.Text         = ((decimal)(rowFormApply.OUBudgetRate * 100)).ToString("N") + "%";

            this.odsSKU.SelectParameters["FormApplyID"].DefaultValue = rowFormApply.FormApplyID.ToString();

            //审批页面处理&按钮处理
            AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            this.ViewState["StuffUserID"] = stuffUser.StuffUserId;
            if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P"))
            {
                this.SubmitBtn.Visible   = true;
                this.cwfAppCheck.IsView  = false;
                this.ViewState["IsView"] = false;
            }
            else
            {
                this.SubmitBtn.Visible   = false;
                this.cwfAppCheck.IsView  = true;
                this.ViewState["IsView"] = true;
            }

            if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && stuffUser.StuffUserId == rowForm.UserID)
            {
                this.EditBtn.Visible  = true;
                this.ScrapBtn.Visible = true;
            }
            else
            {
                this.EditBtn.Visible  = false;
                this.ScrapBtn.Visible = false;
            }

            //是否显示复制按钮
            if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted && stuffUser.StuffUserId == rowForm.UserID)
            {
                this.UCBeginPeriod.Visible = true;
                this.UCEndPeriod.Visible   = true;
                this.lblSignal.Visible     = true;
                this.CopyBtn.Visible       = true;
            }
            else
            {
                this.UCBeginPeriod.Visible = false;
                this.UCEndPeriod.Visible   = false;
                this.lblSignal.Visible     = false;
                this.CopyBtn.Visible       = false;
            }
            //是否显示打印信息
            if (((stuffUser.StuffUserId == rowForm.UserID || base.IsBusinessProxy(rowForm.UserID, rowForm.SubmitDate) && (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted) || rowForm.StatusID == (int)SystemEnums.FormStatus.Scrap && rowFormApply.IsAutoSplit)))
            {
                this.PrintBtn.Visible = true;
            }
            else
            {
                this.PrintBtn.Visible = false;
            }

            if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted || (rowForm.StatusID == (int)SystemEnums.FormStatus.Scrap && rowFormApply.IsAutoSplit))
            {
                this.PrintInfor.Visible = true;
                int printCount = rowFormApply.IsPrintCountNull() ? 0 : rowFormApply.PrintCount;
                this.PrintInfor.Text = "该方案已经被打印" + printCount + "次";
            }
            else
            {
                this.PrintInfor.Visible = false;
            }

            //如果是弹出,取消按钮不可见
            if (this.Request["ShowDialog"] != null)
            {
                if (this.Request["ShowDialog"].ToString() == "1")
                {
                    this.upButton.Visible = false;
                    this.Master.FindControl("divMenu").Visible       = false;
                    this.Master.FindControl("tbCurrentPage").Visible = false;
                    this.PrintInfor.Visible = false;
                    this.PrintBtn.Visible   = false;
                }
            }
            //如果是申请人则隐藏预算信息
            if (stuffUser.StuffUserId == rowForm.UserID)
            {
                this.OUBudgetCtl.Text           = "";
                this.OUApprovedAmountCtl.Text   = "";
                this.OUApprovingAmountCtl.Text  = "";
                this.OUCompletedAmountCtl.Text  = "";
                this.OUReimbursedAmountCtl.Text = "";
                this.OUBudgetRemainCtl.Text     = "";
                this.OUBudgetRateCtl.Text       = "";
                this.btnViewBudget.Visible      = false;
            }
            //分摊比例
            new FormApplySplitRateTableAdapter().FillByApplyID(InnerDS.FormApplySplitRate, formID);
            if (InnerDS.FormApplySplitRate != null && InnerDS.FormApplySplitRate.Count > 0)
            {
                this.divSplitRate.Visible   = true;
                this.gvSplitRate.Visible    = true;
                this.gvSplitRate.DataSource = InnerDS.FormApplySplitRate;
                this.gvSplitRate.DataBind();
            }
        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack)
        {
            PageUtility.SetContentTitle(this.Page, "方案报销审批");
            this.Page.Title = "方案报销审批";

            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            FormDS.FormRow          rowForm          = this.SalesReimburseBLL.GetFormByID(formID)[0];
            FormDS.FormReimburseRow rowFormReimburse = this.SalesReimburseBLL.GetFormReimburseByID(formID)[0];
            if (rowForm.IsProcIDNull())
            {
                ViewState["ProcID"] = "";
            }
            else
            {
                ViewState["ProcID"] = rowForm.ProcID;
            }

            ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID;
            this.FormNoCtl.Text             = rowForm.FormNo;
            this.ApplyDateCtl.Text          = rowForm.SubmitDate.ToShortDateString();
            AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID);
            this.StuffNameCtl.Text    = applicant.StuffName;
            this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName;
            if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null)
            {
                this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName;
            }
            this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString();
            MasterDataBLL   masterBll = new MasterDataBLL();
            ERS.CustomerRow customer  = masterBll.GetCustomerById(rowFormReimburse.CustomerID);
            this.CustomerNameCtl.Text = customer.CustomerName;
            this.CustomerTypeCtl.Text = masterBll.GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName;
            this.PaymentTypeCtl.Text  = masterBll.GetPaymentTypeById(rowFormReimburse.PaymentTypeID).PaymentTypeName;
            if (!rowFormReimburse.IsRemarkNull())
            {
                this.RemarkCtl.Text = rowFormReimburse.Remark;
            }
            if (!rowFormReimburse.IsAttachedFileNameNull())
            {
                this.UCFileUpload.AttachmentFileName = rowFormReimburse.AttachedFileName;
            }
            if (!rowFormReimburse.IsRealAttachedFileNameNull())
            {
                this.UCFileUpload.RealAttachmentFileName = rowFormReimburse.RealAttachedFileName;
            }

            this.odsInvoice.SelectParameters["FormReimburseID"].DefaultValue          = rowFormReimburse.FormReimburseID.ToString();
            this.odsReimburseDetails.SelectParameters["FormReimburseID"].DefaultValue = rowFormReimburse.FormReimburseID.ToString();
            //审批页面处理&按钮处理
            AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            this.ViewState["StuffUserID"] = stuffUser.StuffUserId;
            if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P"))
            {
                this.SubmitBtn.Visible   = true;
                this.cwfAppCheck.IsView  = false;
                this.ViewState["IsView"] = false;
            }
            else
            {
                this.SubmitBtn.Visible   = false;
                this.cwfAppCheck.IsView  = true;
                this.ViewState["IsView"] = true;
            }

            if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && stuffUser.StuffUserId == rowForm.UserID)
            {
                this.EditBtn.Visible  = true;
                this.ScrapBtn.Visible = true;
            }
            else
            {
                this.EditBtn.Visible  = false;
                this.ScrapBtn.Visible = false;
            }

            if (!rowFormReimburse.IsPaymentDateNull())
            {
                this.txtPaymentDate.Text        = rowFormReimburse.PaymentDate.ToString("yyyy-MM-dd");
                this.ucPaymentDate.SelectedDate = rowFormReimburse.PaymentDate.ToString("yyyy-MM-dd");
            }


            AuthorizationDS.PositionRow position         = (AuthorizationDS.PositionRow) this.Session["Position"];
            PositionRightBLL            positionRightBLL = new PositionRightBLL();
            if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted && positionRightBLL.CheckPositionRight(position.PositionId, (int)SystemEnums.OperateEnum.Other + (int)SystemEnums.BusinessUseCase.FormReimburse))
            {
                this.txtPaymentDate.Visible     = false;
                this.ucPaymentDate.Visible      = true;
                this.btnSavePaymentInfo.Visible = true;
            }

            //历史单据
            if (rowForm.IsRejectedFormIDNull())
            {
                lblRejectFormNo.Text = "无";
            }
            else
            {
                FormDS.FormRow rejectedForm = this.SalesReimburseBLL.GetFormByID(rowForm.RejectedFormID)[0];
                this.lblRejectFormNo.Text        = rejectedForm.FormNo;
                this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/SalesForm/ReimburseMoneyApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }

            //如果是弹出,取消按钮不可见
            if (this.Request["ShowDialog"] != null)
            {
                if (this.Request["ShowDialog"].ToString() == "1")
                {
                    this.upButton.Visible = false;
                    this.Master.FindControl("divMenu").Visible       = false;
                    this.Master.FindControl("tbCurrentPage").Visible = false;
                }
            }
        }

        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack)
        {
            PageUtility.SetContentTitle(this.Page, "方案执行确认");
            this.Page.Title = "方案执行确认";

            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            FormDS.FormRow      rowForm      = this.SalesApplyBLL.GetFormByID(formID)[0];
            FormDS.FormApplyRow rowFormApply = this.SalesApplyBLL.GetFormApplyByID(formID)[0];
            if (rowForm.IsProcIDNull())
            {
                ViewState["ProcID"] = "";
            }
            else
            {
                ViewState["ProcID"] = rowForm.ProcID;
            }

            ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID;
            this.FormNoCtl.Text             = rowForm.FormNo;
            this.ApplyDateCtl.Text          = rowForm.SubmitDate.ToShortDateString();
            AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID);
            this.StuffNameCtl.Text    = applicant.StuffName;
            this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName;
            if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null)
            {
                this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName;
            }
            this.AttendDateCtl.Text  = applicant.AttendDate.ToShortDateString();
            this.BeginPeriodCtl.Text = rowFormApply.BeginPeriod.ToString("yyyy-MM");
            this.EndPeriodCtl.Text   = rowFormApply.EndPeriod.ToString("yyyy-MM");
            MasterDataBLL masterBll = new MasterDataBLL();
            this.ExpenseSubCategoryCtl.Text = masterBll.GetExpenseSubCateNameById(rowFormApply.ExpenseSubCategoryID);
            ERS.CustomerRow customer = masterBll.GetCustomerById(rowFormApply.CustomerID);
            this.CustomerNameCtl.Text = customer.CustomerName;
            //this.CustomerTypeCtl.Text = masterBll.GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName;
            this.ShopNameCtl.Text    = masterBll.GetShopByID(rowFormApply.ShopID).ShopName;
            this.PaymentTypeCtl.Text = masterBll.GetPaymentTypeById(rowFormApply.PaymentTypeID).PaymentTypeName;
            if (!rowFormApply.IsContractNoNull())
            {
                this.ContractNoCtl.Text = rowFormApply.ContractNo;
            }
            this.AmountCtl.Text = rowFormApply.Amount.ToString("N");
            if (!rowFormApply.IsRemarkNull())
            {
                this.RemarkCtl.Text = rowFormApply.Remark;
            }
            if (!rowFormApply.IsAttachedFileNameNull())
            {
                this.UCFileUpload.AttachmentFileName = rowFormApply.AttachedFileName;
            }
            if (!rowFormApply.IsRealAttachedFileNameNull())
            {
                this.UCFileUpload.RealAttachmentFileName = rowFormApply.RealAttachedFileName;
            }

            if (!rowFormApply.IsPromotionBeginDateNull())
            {
                this.PromotionBeginCtl.Text = rowFormApply.PromotionBeginDate.ToString("yyyy-MM-dd");
            }
            if (!rowFormApply.IsPromotionEndDateNull())
            {
                this.PromotionEndCtl.Text = rowFormApply.PromotionEndDate.ToString("yyyy-MM-dd");
            }
            this.PromotionScopeCtl.Text = masterBll.GetPromotionScopeById(rowFormApply.PromotionScopeID).PromotionScopeName;
            this.PromotionTypeCtl.Text  = masterBll.GetPromotionTypeById(rowFormApply.PromotionTypeID).PromotionTypeName;
            if (!rowFormApply.IsPromotionDescNull())
            {
                this.PromotionDescCtl.Text = rowFormApply.PromotionDesc;
            }
            this.ShelfTypeCtl.Text = masterBll.GetShelfTypeById(rowFormApply.ShelfTypeID).ShelfTypeName;
            if (!rowFormApply.IsFirstVolumeNull())
            {
                this.FirstVolumeCtl.Text = rowFormApply.FirstVolume.ToString();
            }
            if (!rowFormApply.IsSecondVolumeNull())
            {
                this.SecondVolumeCtl.Text = rowFormApply.SecondVolume.ToString();
            }
            if (!rowFormApply.IsThirdVolumeNull())
            {
                this.ThirdVolumeCtl.Text = rowFormApply.ThirdVolume.ToString();
            }
            if (!rowFormApply.IsAverageVolumeNull())
            {
                this.AverageVolumeCtl.Text = rowFormApply.AverageVolume.ToString();
            }
            if (!rowFormApply.IsEstimatedSaleVolumeNull())
            {
                this.txtEstimatedSaleVolume.Text = rowFormApply.EstimatedSaleVolume.ToString();
            }
            if (!rowFormApply.IsPackageUnitPriceNull())
            {
                this.txtPackageUnitPrice.Text = rowFormApply.PackageUnitPrice.ToString("N");
            }
            if (!rowFormApply.IsFormApplyNameNull())
            {
                this.txtFormApplyName.Text = rowFormApply.FormApplyName;
            }

            //查看预算信息按钮
            this.btnViewBudget.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/ReportManage/SalesBudgetByPosition.aspx?ShowDialog=1','', 'dialogWidth:1035px;dialogHeight:660px;resizable:yes;')";

            //预算信息
            this.CustomerBudgetCtl.Text       = rowFormApply.CustomerBudget.ToString("N");
            this.CustomerBudgetRemainCtl.Text = rowFormApply.CustomerBudgetRemain.ToString("N");
            this.OUBudgetCtl.Text             = rowFormApply.OUBudget.ToString("N");
            this.OUApprovedAmountCtl.Text     = rowFormApply.OUAppovedAmount.ToString("N");
            this.OUApprovingAmountCtl.Text    = rowFormApply.OUApprovingAmount.ToString("N");
            this.OUCompletedAmountCtl.Text    = rowFormApply.OUCompletedAmount.ToString("N");
            this.OUReimbursedAmountCtl.Text   = rowFormApply.OUReimbursedAmount.ToString("N");
            this.OUBudgetRemainCtl.Text       = rowFormApply.OUBudgetRemain.ToString("N");
            this.OUBudgetRateCtl.Text         = ((decimal)(rowFormApply.OUBudgetRate * 100)).ToString("N") + "%";

            AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            this.ViewState["StuffUserID"] = stuffUser.StuffUserId;

            //是否显示关闭按钮,如果没有执行完成的话那么不能关闭
            this.CloseBtn.Visible = false;
            if ((!rowFormApply.IsClose) && rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted)
            {
                if (stuffUser.StuffUserId == rowForm.UserID || new MasterDataBLL().GetProxyReimburseByParameter(rowForm.UserID, stuffUser.StuffUserId, rowForm.SubmitDate).Count > 0)
                {
                    if (!rowFormApply.IsIsCompleteNull())
                    {
                        if (rowFormApply.IsComplete)
                        {
                            this.CloseBtn.Visible = true;
                        }
                    }
                }
            }

            //是否显示复制按钮
            if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted && stuffUser.StuffUserId == rowForm.UserID)
            {
                this.UCBeginPeriod.Visible = true;
                this.UCEndPeriod.Visible   = true;
                this.lblSignal.Visible     = true;
                this.CopyBtn.Visible       = true;
            }
            else
            {
                this.UCBeginPeriod.Visible = false;
                this.UCEndPeriod.Visible   = false;
                this.lblSignal.Visible     = false;
                this.CopyBtn.Visible       = false;
            }
            //是否显示打印信息
            if (((stuffUser.StuffUserId == rowForm.UserID || base.IsBusinessProxy(rowForm.UserID, rowForm.SubmitDate) && rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted) || (rowForm.StatusID == (int)SystemEnums.FormStatus.Scrap && rowFormApply.IsAutoSplit)))
            {
                this.PrintBtn.Visible = true;
            }
            else
            {
                this.PrintBtn.Visible = false;
            }

            if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted || (rowForm.StatusID == (int)SystemEnums.FormStatus.Scrap && rowFormApply.IsAutoSplit))
            {
                this.PrintInfor.Visible = true;
                int printCount = rowFormApply.IsPrintCountNull() ? 0 : rowFormApply.PrintCount;
                this.PrintInfor.Text = "该方案已经被打印" + printCount + "次";
            }
            else
            {
                this.PrintInfor.Visible = false;
            }


            //如果是弹出,取消按钮不可见
            if (this.Request["ShowDialog"] != null)
            {
                if (this.Request["ShowDialog"].ToString() == "1")
                {
                    this.upButton.Visible   = false;
                    this.PrintInfor.Visible = false;
                    this.PrintBtn.Visible   = false;
                    this.Master.FindControl("divMenu").Visible       = false;
                    this.Master.FindControl("tbCurrentPage").Visible = false;
                }
            }
            //如果是申请人则隐藏预算信息
            if (stuffUser.StuffUserId == rowForm.UserID)
            {
                this.OUBudgetCtl.Text           = "";
                this.OUApprovedAmountCtl.Text   = "";
                this.OUApprovingAmountCtl.Text  = "";
                this.OUCompletedAmountCtl.Text  = "";
                this.OUReimbursedAmountCtl.Text = "";
                this.OUBudgetRemainCtl.Text     = "";
                this.OUBudgetRateCtl.Text       = "";
                this.btnViewBudget.Visible      = false;
            }

            //处理执行确认内容
            if (!rowFormApply.IsConfirmCompleteDateNull())
            {
                ConfirmCompleteDateCtl.Text = rowFormApply.ConfirmCompleteDate.ToString("yyyy-MM-dd");
            }
            if (!rowFormApply.IsAccruedPeriodNull())
            {
                AccruedPeriodCtl.Text = rowFormApply.AccruedPeriod.ToString("yyyy-MM");
            }
            //如果是申请人并且没有执行确认,实际费用才可以编辑
            this.ViewState["ExecuteReadOnly"] = true;
            if (!rowFormApply.IsIsCompleteNull())
            {
                if (!rowFormApply.IsComplete && rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted)
                {
                    if (rowForm.UserID == stuffUser.StuffUserId || new MasterDataBLL().GetProxyReimburseByParameter(rowForm.UserID, stuffUser.StuffUserId, rowForm.SubmitDate).Count > 0)
                    {
                        this.ViewState["ExecuteReadOnly"] = false;
                        this.AccrudePeriodSignal.Visible  = true;
                        this.PeriodDDL.Visible            = true;
                        this.ExecuteConfirmBtn.Visible    = true;
                        this.ExecuteCancelBtn.Visible     = true;
                    }
                }
            }
            //分摊比例
            new FormApplySplitRateTableAdapter().FillByApplyID(InnerDS.FormApplySplitRate, formID);
            if (InnerDS.FormApplySplitRate != null && InnerDS.FormApplySplitRate.Count > 0)
            {
                this.divSplitRate.Visible   = true;
                this.gvSplitRate.Visible    = true;
                this.gvSplitRate.DataSource = InnerDS.FormApplySplitRate;
                this.gvSplitRate.DataBind();
            }
        }

        //明细信息
        FormApplyDetailViewTableAdapter taDetail = new FormApplyDetailViewTableAdapter();

        taDetail.FillByFormID(this.InnerDS.FormApplyDetailView, (int)this.ViewState["ObjectId"]);
        FormApplyExpenseDetailTableAdapter taExpense = new FormApplyExpenseDetailTableAdapter();

        taExpense.FillByFormApplyID(this.InnerDS.FormApplyExpenseDetail, (int)this.ViewState["ObjectId"]);

        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack)
        {
            PageUtility.SetContentTitle(this.Page, "方案申请审批");
            this.Page.Title = "方案申请审批";

            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            FormDS.FormRow      rowForm      = this.SalesApplyBLL.GetFormByID(formID)[0];
            FormDS.FormApplyRow rowFormApply = this.SalesApplyBLL.GetFormApplyByID(formID)[0];
            if (rowForm.IsProcIDNull())
            {
                ViewState["ProcID"] = "";
            }
            else
            {
                ViewState["ProcID"] = rowForm.ProcID;
            }
            ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID;
            this.FormNoCtl.Text             = rowForm.FormNo;
            this.ApplyDateCtl.Text          = rowForm.SubmitDate.ToShortDateString();
            AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID);
            this.StuffNameCtl.Text    = applicant.StuffName;
            this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName;
            if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null)
            {
                this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName;
            }
            this.AttendDateCtl.Text  = applicant.AttendDate.ToShortDateString();
            this.BeginPeriodCtl.Text = rowFormApply.BeginPeriod.ToShortDateString();
            this.EndPeriodCtl.Text   = rowFormApply.EndPeriod.ToShortDateString();
            MasterDataBLL masterBll = new MasterDataBLL();
            this.ExpenseSubCategoryCtl.Text = masterBll.GetExpenseSubCateNameById(rowFormApply.ExpenseSubCategoryID);
            ERS.CustomerRow customer = masterBll.GetCustomerById(rowFormApply.CustomerID);
            this.CustomerNameCtl.Text = customer.CustomerName;
            this.CustomerTypeCtl.Text = masterBll.GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName;
            this.ShopNameCtl.Text     = masterBll.GetShopByID(rowFormApply.ShopID).ShopName;
            this.PaymentTypeCtl.Text  = masterBll.GetPaymentTypeById(rowFormApply.PaymentTypeID).PaymentTypeName;
            if (!rowFormApply.IsContractNoNull())
            {
                this.ContractNoCtl.Text = rowFormApply.ContractNo;
            }
            this.AmountCtl.Text = rowFormApply.Amount.ToString("N");
            if (!rowFormApply.IsRemarkNull())
            {
                this.RemarkCtl.Text = rowFormApply.Remark;
            }
            if (!rowFormApply.IsAttachedFileNameNull())
            {
                this.UCFileUpload.AttachmentFileName = rowFormApply.AttachedFileName;
            }
            if (!rowFormApply.IsRealAttachedFileNameNull())
            {
                this.UCFileUpload.RealAttachmentFileName = rowFormApply.RealAttachedFileName;
            }

            //历史单据
            if (rowForm.IsRejectedFormIDNull())
            {
                lblRejectFormNo.Text = "无";
            }
            else
            {
                FormDS.FormRow rejectedForm = new SalesApplyBLL().GetFormByID(rowForm.RejectedFormID)[0];
                this.lblRejectFormNo.Text        = rejectedForm.FormNo;
                this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/SalesForm/SalesRebateApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }

            //查看预算信息按钮
            this.btnViewBudget.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/ReportManage/SalesFeeByPosition.aspx?ShowDialog=1','', 'dialogWidth:918px;dialogHeight:660px;resizable:yes;')";

            //预算信息
            this.CustomerBudgetCtl.Text       = rowFormApply.CustomerBudget.ToString("N");
            this.CustomerBudgetRemainCtl.Text = rowFormApply.CustomerBudgetRemain.ToString("N");
            this.OUBudgetCtl.Text             = rowFormApply.OUBudget.ToString("N");
            this.OUApprovedAmountCtl.Text     = rowFormApply.OUAppovedAmount.ToString("N");
            this.OUApprovingAmountCtl.Text    = rowFormApply.OUApprovingAmount.ToString("N");
            this.OUCompletedAmountCtl.Text    = rowFormApply.OUCompletedAmount.ToString("N");
            this.OUReimbursedAmountCtl.Text   = rowFormApply.OUReimbursedAmount.ToString("N");
            this.OUBudgetRemainCtl.Text       = rowFormApply.OUBudgetRemain.ToString("N");
            this.OUBudgetRateCtl.Text         = ((decimal)(rowFormApply.OUBudgetRate * 100)).ToString("N") + "%";

            this.odsApplyDetails.SelectParameters["FormID"].DefaultValue = rowFormApply.FormApplyID.ToString();

            //审批页面处理&按钮处理
            AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            this.ViewState["StuffUserID"] = stuffUser.StuffUserId;
            if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P"))
            {
                this.SubmitBtn.Visible   = true;
                this.cwfAppCheck.IsView  = false;
                this.ViewState["IsView"] = false;
            }
            else
            {
                this.SubmitBtn.Visible   = false;
                this.cwfAppCheck.IsView  = true;
                this.ViewState["IsView"] = true;
            }

            if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && stuffUser.StuffUserId == rowForm.UserID)
            {
                this.EditBtn.Visible  = true;
                this.ScrapBtn.Visible = true;
            }
            else
            {
                this.EditBtn.Visible  = false;
                this.ScrapBtn.Visible = false;
            }

            //关闭按钮
            if ((!rowFormApply.IsClose) && rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted)
            {
                if (stuffUser.StuffUserId == rowForm.UserID || new MasterDataBLL().GetProxyReimburseByParameter(rowForm.UserID, stuffUser.StuffUserId, rowForm.SubmitDate).Count > 0)
                {
                    this.CloseBtn.Visible = true;
                }
                else
                {
                    this.CloseBtn.Visible = false;
                }
            }
            else
            {
                this.CloseBtn.Visible = false;
            }

            //如果是弹出,取消按钮不可见
            if (this.Request["ShowDialog"] != null)
            {
                if (this.Request["ShowDialog"].ToString() == "1")
                {
                    this.upButton.Visible = false;
                    this.Master.FindControl("divMenu").Visible       = false;
                    this.Master.FindControl("tbCurrentPage").Visible = false;
                }
            }
            //如果是申请人则隐藏预算信息
            if (stuffUser.StuffUserId == rowForm.UserID)
            {
                this.OUBudgetCtl.Text           = "";
                this.OUApprovedAmountCtl.Text   = "";
                this.OUApprovingAmountCtl.Text  = "";
                this.OUCompletedAmountCtl.Text  = "";
                this.OUReimbursedAmountCtl.Text = "";
                this.OUBudgetRemainCtl.Text     = "";
                this.OUBudgetRateCtl.Text       = "";
                this.btnViewBudget.Visible      = false;
            }
        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!this.IsPostBack)
        {
            PageUtility.SetContentTitle(this.Page, "方案报销审批");
            this.Page.Title = "方案报销审批";

            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            FormDS.FormRow          rowForm          = this.SalesReimburseBLL.GetFormByID(formID)[0];
            FormDS.FormReimburseRow rowFormReimburse = this.SalesReimburseBLL.GetFormReimburseByID(formID)[0];
            //如果单据没有审批完成的话,是不能录入或者查看发货信息的
            if (rowForm.StatusID != (int)SystemEnums.FormStatus.ApproveCompleted)
            {
                this.gvSKUDetails.Columns[6].Visible           = false;
                this.gvSKUDetails.Columns[5].HeaderStyle.Width = 400;
                this.DeliveryDIV.Visible = false;
                this.upDelivery.Visible  = false;
            }
            if (this.gvSKUDetails.SelectedIndex < 0)
            {
                this.fvDelievery.Visible = false;
            }
            //如果没有修改权限的话那么不能新增和删除
            int opManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.DeliveryInfo, SystemEnums.OperateEnum.Manage);
            AuthorizationDS.PositionRow position         = (AuthorizationDS.PositionRow) this.Session["Position"];
            PositionRightBLL            positionRightBLL = new PositionRightBLL();
            this.HasManageRight = positionRightBLL.CheckPositionRight(position.PositionId, opManageId);

            //流程ID
            if (rowForm.IsProcIDNull())
            {
                ViewState["ProcID"] = "";
            }
            else
            {
                ViewState["ProcID"] = rowForm.ProcID;
            }

            ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID;
            this.FormNoCtl.Text             = rowForm.FormNo;
            this.ApplyDateCtl.Text          = rowForm.SubmitDate.ToShortDateString();
            AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID);
            this.StuffNameCtl.Text    = applicant.StuffName;
            this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName;
            if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null)
            {
                this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName;
            }
            this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString();
            MasterDataBLL   masterBll = new MasterDataBLL();
            ERS.CustomerRow customer  = masterBll.GetCustomerById(rowFormReimburse.CustomerID);
            this.CustomerNameCtl.Text = customer.CustomerName;
            this.CustomerTypeCtl.Text = masterBll.GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName;
            this.PaymentTypeCtl.Text  = masterBll.GetPaymentTypeById(rowFormReimburse.PaymentTypeID).PaymentTypeName;
            if (!rowFormReimburse.IsRemarkNull())
            {
                this.RemarkCtl.Text = rowFormReimburse.Remark;
            }
            if (!rowFormReimburse.IsAttachedFileNameNull())
            {
                this.UCFileUpload.AttachmentFileName = rowFormReimburse.AttachedFileName;
            }
            if (!rowFormReimburse.IsRealAttachedFileNameNull())
            {
                this.UCFileUpload.RealAttachmentFileName = rowFormReimburse.RealAttachedFileName;
            }

            this.odsSKUDetails.SelectParameters["FormReimburseID"].DefaultValue       = rowFormReimburse.FormReimburseID.ToString();
            this.odsReimburseDetails.SelectParameters["FormReimburseID"].DefaultValue = rowFormReimburse.FormReimburseID.ToString();
            //审批页面处理&按钮处理
            AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            this.ViewState["StuffUserID"] = stuffUser.StuffUserId;
            if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P"))
            {
                this.SubmitBtn.Visible   = true;
                this.cwfAppCheck.IsView  = false;
                this.ViewState["IsView"] = false;
            }
            else
            {
                this.SubmitBtn.Visible   = false;
                this.cwfAppCheck.IsView  = true;
                this.ViewState["IsView"] = true;
            }

            if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && stuffUser.StuffUserId == rowForm.UserID)
            {
                this.EditBtn.Visible  = true;
                this.ScrapBtn.Visible = true;
            }
            else
            {
                this.EditBtn.Visible  = false;
                this.ScrapBtn.Visible = false;
            }

            //历史单据
            if (rowForm.IsRejectedFormIDNull())
            {
                lblRejectFormNo.Text = "无";
            }
            else
            {
                FormDS.FormRow rejectedForm = this.SalesReimburseBLL.GetFormByID(rowForm.RejectedFormID)[0];
                this.lblRejectFormNo.Text        = rejectedForm.FormNo;
                this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/OtherForm/ReimburseGoodsApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }

            //如果是弹出,按钮不可见
            if (this.Request["ShowDialog"] != null)
            {
                if (this.Request["ShowDialog"].ToString() == "1")
                {
                    this.upButton.Visible = false;
                    this.gvSKUDetails.Columns[6].Visible             = false;
                    this.gvSKUDetails.Columns[5].HeaderStyle.Width   = 400;
                    this.Master.FindControl("divMenu").Visible       = false;
                    this.Master.FindControl("tbCurrentPage").Visible = false;
                }
            }

            //发货完成按钮权限
            opManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.DeliveryComplete, SystemEnums.OperateEnum.Other);
            position   = (AuthorizationDS.PositionRow) this.Session["Position"];
            if (positionRightBLL.CheckPositionRight(position.PositionId, opManageId) && (rowFormReimburse.IsIsDeliveryCompleteNull() || rowFormReimburse.IsDeliveryComplete == false))
            {
                this.btnDeliveryComplete.Visible = true;
            }
            else
            {
                this.btnDeliveryComplete.Visible = false;
                //this.gvDelivery.Visible = false;
                //this.gvSKUDetails.Columns[6].Visible=false;
                //this.gvSKUDetails.Columns[5].ItemStyle.Width = 400;
            }
        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
示例#6
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) + "行有错:系统中找到多个此名称的部门《" + 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();
            }
        }
    }