Exemplo n.º 1
0
        private void LoadData()
        {
            try
            {
                //基本信息

                string SupplierCode = Request["SupplierCode"] + "";
                string projectCode  = Request["projectCode"] + "";

                EntityData entity = ProjectDAO.GetStandard_SupplierByCode(SupplierCode);
                if (entity.HasRecord())
                {
                    this.lblSupplierName.Text = entity.GetString("SupplierName");
                    this.lblAbbreviation.Text = entity.GetString("Abbreviation");
                    this.lblAreaCode.Text     = entity.GetString("AreaCode");

                    this.lblProduct.Text      = entity.GetString("Product").Replace("\n", "<br>");
                    this.lblQuality.Text      = entity.GetString("Quality").Replace("\n", "<br>");
                    this.lblAchievement.Text  = entity.GetString("Achievement").Replace("\n", "<br>");
                    this.lblCheckOpinion.Text = entity.GetString("CheckOpinion").Replace("\n", "<br>");

                    this.lblContractPerson.Text = entity.GetString("ContractPerson");
                    this.lblCreditLevel.Text    = entity.GetString("CreditLevel");
                    this.lblIndustrySort.Text   = entity.GetString("IndustrySort");
                    this.lblIndustryType.Text   = entity.GetString("IndustryType");
                    this.lblLicenseID.Text      = entity.GetString("LicenseID");

                    this.lblOfficePhone.Text = entity.GetString("OfficePhone");
                    this.lblMobile.Text      = entity.GetString("Mobile");
                    this.lblFax.Text         = entity.GetString("Fax");
                    this.lblPostCode.Text    = entity.GetString("PostCode");
                    this.lblEmail.Text       = entity.GetString("EMail");
                    this.lblWebAddress.Text  = entity.GetString("WebAddress");

                    this.lblRegisteredAddress.Text = entity.GetString("RegisteredAddress");
                    this.lblRegisteredCapital.Text = entity.GetString("RegisteredCapital");
                    this.lblSJHG.Text             = entity.GetString("SJHG");
                    this.lblTaxID.Text            = entity.GetString("TaxID");
                    this.lblTaxNo.Text            = entity.GetString("TaxNo");
                    this.lblWorkAddress.Text      = entity.GetString("WorkAddress");
                    this.lblWorkTimeLimit.Text    = entity.GetString("WorkTimeLimit");
                    this.lblArtificialPerson.Text = entity.GetString("ArtificialPerson");
                    this.lblWorkScope.Text        = entity.GetString("WorkScope");
                    this.lblStructure.Text        = entity.GetString("Structure");
                    this.lblRemark.Text           = entity.GetString("Remark");
                    this.lblTypeName.Text         = BLL.ProjectRule.GetSupplierTypeName(entity.GetString("SupplierTypeCode"));

                    this.lblSaleType.Text      = entity.GetString("saleType");
                    this.lblCharacterType.Text = entity.GetString("characterType");
                    this.lblCCC.Text           = RmsPM.BLL.SupplierRule.GetTypeName(entity.GetString("IsCCC"));
                    this.lblISO.Text           = RmsPM.BLL.SupplierRule.GetTypeName(entity.GetString("IsISO"));
                    this.lblQualityGrade.Text  = entity.GetString("QualityGrade") == "" ? "未定" : entity.GetString("QualityGrade");
                    this.lblOpenBank.Text      = entity.GetString("OpenBank");
                    this.lblReciver.Text       = entity.GetString("Reciver");
                    this.lblAccount.Text       = entity.GetString("Account");
                }

                switch (this.up_sPMName.ToLower())
                {
                case "shidaipm":
                    this.isAuditted.Visible       = true;
                    this.TdisAuditted.Visible     = true;
                    this.isAuditted.Text          = RmsPM.BLL.SupplierRule.GetIsAuditted(entity.GetInt("Status"));
                    this.PreWorkFlowPoint.ColSpan = 4;
                    break;


                case "shimaopm":
                    this.btnGradeAdd.Visible             = this.user.HasRight("2701");
                    this.btnPursveWorkflow.Visible       = this.user.HasRight("2709");
                    this.DataGrid_supplierRecord.Visible = false;
                    this.DataGrid_supplierGrade.Visible  = true;
                    RmsPM.BLL.GradeMessage cgradeMessage = new GradeMessage();
                    cgradeMessage.SupplierCode = SupplierCode;
                    //cgradeMessage.State = "0";
                    System.Data.DataTable dtGradeMessage = cgradeMessage.GetGradeMessages();
                    RmsPM.DAL.QueryStrategy.WorkFlowHistory sbGradeMessage = new RmsPM.DAL.QueryStrategy.WorkFlowHistory();
                    sbGradeMessage.AddStrategy(new Strategy(WorkFlowHistoryStrategyName.ProcedureNameAndApplicationCodein, this.GetWorkFlowListString(dtGradeMessage)));



                    if (!((User)Session["User"]).HasOperationRight("090102"))
                    {
                        sbGradeMessage.AddStrategy(new Strategy(WorkFlowHistoryStrategyName.ActUserCode, ((User)Session["User"]).UserCode));
                    }
                    sbGradeMessage.AddOrder("CreateDate", false);



                    string sqlGradeMessage = sbGradeMessage.BuildMainQueryString();

                    QueryAgent qaGradeMessage = new QueryAgent();
                    DataSet    dsGradeMessage = qaGradeMessage.ExecSqlForDataSet(sqlGradeMessage);
                    qaGradeMessage.Dispose();
                    if (dsGradeMessage != null)
                    {
                        DataTable dttempgradeMessage = dsGradeMessage.Tables[0];
                        dttempgradeMessage.Columns.Add("ProjectManage", System.Type.GetType("System.String"));
                        dttempgradeMessage.Columns.Add("State", System.Type.GetType("System.String"));
                        dttempgradeMessage.Columns.Add("SupplierCode", System.Type.GetType("System.String"));

                        foreach (DataRow dr in dttempgradeMessage.Select())
                        {
                            if (dtGradeMessage.Select("GradeMessageCode='" + dr["ApplicationCode"] + "'").Length != 0)
                            {
                                dr["ProjectManage"] = dtGradeMessage.Select("GradeMessageCode='" + dr["ApplicationCode"] + "'")[0]["ProjectManage"].ToString();
                                dr["State"]         = dtGradeMessage.Select("GradeMessageCode='" + dr["ApplicationCode"] + "'")[0]["State"].ToString();
                                dr["SupplierCode"]  = dtGradeMessage.Select("GradeMessageCode='" + dr["ApplicationCode"] + "'")[0]["SupplierCode"].ToString();
                            }
                        }

                        this.DataGrid_supplierGrade.DataSource = dttempgradeMessage;

                        this.WorkFlowPoint.Visible = true;
                        this.lblGradePoint.Visible = true;
                        if (dtGradeMessage.Select("state='0'").Length != 0)
                        {
                            this.lblGradePoint.Text = RmsPM.BLL.GradeList.GetSumGradePoint(dtGradeMessage.Select("state='0'")[0]["GradeMessageCode"].ToString());
                        }
                        this.DataGrid_supplierGrade.DataBind();
                    }
                    this.PreAuditted.ColSpan = 4;
                    break;


                default:
                    this.btnPG.Visible = true;
                    this.DataGrid_supplierRecord.Visible = true;
                    this.DataGrid_supplierGrade.Visible  = false;
                    this.isAuditted.Visible            = false;
                    this.TdisAuditted.Visible          = false;
                    this.PreAuditted.ColSpan           = 4;
                    this.PreWorkFlowPoint.ColSpan      = 4;
                    DataGrid_supplierRecord.DataSource = new DataView(entity.Tables["SupplierOpinion"], "", "OpinionDate DESC", DataViewRowState.CurrentRows);
                    DataGrid_supplierRecord.DataBind();
                    break;
                }

                ContractStrategyBuilder sb = new ContractStrategyBuilder();
                sb.AddStrategy(new Strategy(ContractStrategyName.SupplierCode, SupplierCode));
                sb.AddStrategy(new Strategy(ContractStrategyName.Status, "0,1,2"));
                if (projectCode != "")
                {
                    sb.AddStrategy(new Strategy(ContractStrategyName.ProjectCode, projectCode));
                }
                ArrayList arAccess = new ArrayList();
                arAccess.Add("050101");
                arAccess.Add(user.UserCode);
                arAccess.Add(user.BuildStationCodes());
                sb.AddStrategy(new Strategy(ContractStrategyName.AccessRange, arAccess));
                string     sql      = sb.BuildMainQueryString();
                QueryAgent qa       = new QueryAgent();
                EntityData contract = qa.FillEntityData("Contract", sql);
                qa.Dispose();

                contract.CurrentTable.Columns.Add("TypeName");
                contract.CurrentTable.Columns.Add("StatusName");
                contract.CurrentTable.Columns.Add("CheckDisplay");                      //是否有权限审核,控制按钮的显示隐藏
                contract.CurrentTable.Columns.Add("AHMoney", System.Type.GetType("System.Decimal"));
                contract.CurrentTable.Columns.Add("PHMoney", System.Type.GetType("System.Decimal"));
                int iCount = contract.CurrentTable.Rows.Count;
                for (int i = 0; i < iCount; i++)
                {
                    contract.SetCurrentRow(i);
                    contract.CurrentRow["TypeName"]   = BLL.ContractRule.GetContractTypeName(contract.GetString("Type"));
                    contract.CurrentRow["StatusName"] = BLL.ContractRule.GetContractStatusName(contract.GetInt("Status").ToString());
                    decimal ah         = BLL.ContractRule.GetContractPayment(contract.GetString("ContractCode"));
                    decimal totalMoney = contract.GetDecimal("TotalMoney");
                    contract.CurrentRow["AHMoney"] = ah;
                    contract.CurrentRow["PHMoney"] = totalMoney - ah;
                }
                this.dgContract.DataSource = contract;
                this.dgContract.DataBind();
                contract.Dispose();

                LoadDocument();

                // 当前厂商询价记录
                LoadEnquiry();

                //当前厂商联系人
                LoadLinkman();

                //厂商财务编码
                LoadSupplierSubjectSet(entity);

                //添加调查意见
                LoadSurvey();

                //加载公司主题
                LoadCompanyTitle();



                entity.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "载入页面出错");
                Response.Write(Rms.Web.JavaScript.Alert(true, "载入页面出错"));
            }
        }