コード例 #1
0
    /// <summary>
    /// 装载控件数据
    /// </summary>
    public void LoadData(bool flag)
    {
        try
        {
            if (this.ApplicationCode != "")
            {
                this.OperationCode = this.ApplicationCode;
            }
            else if (this.OperationCode != "")
            {
                this.ApplicationCode = this.OperationCode;
            }



            if (flag)
            {
                if (this.ApplicationCode != "")
                {
                    RmsPM.BLL.SupplierSurveyOpinion cSupplierSurveyOpinion = new RmsPM.BLL.SupplierSurveyOpinion();
                    cSupplierSurveyOpinion.SupplierSurveyOpinionCode = this.ApplicationCode;
                    DataTable dSupplierSurveyOpinion = cSupplierSurveyOpinion.GetSupplierSurveyOpinions();
                    if (dSupplierSurveyOpinion != null)
                    {
                        foreach (DataRow dr in dSupplierSurveyOpinion.Select())
                        {
                            DataTable dttype = RmsPM.BLL.SupplierSurveyOpinion.GetSupplierGradeType();
                            if (dttype != null)
                            {
                                if (dttype.Rows.Count != 0)
                                {
                                    this.selectGrade.DataSource     = dttype;
                                    this.selectGrade.DataTextField  = "TypeName";
                                    this.selectGrade.DataValueField = "TypeName";
                                    this.selectGrade.DataBind();



                                    this.selectAdviceGrade.DataSource     = dttype;
                                    this.selectAdviceGrade.DataTextField  = "TypeName";
                                    this.selectAdviceGrade.DataValueField = "TypeName";
                                    this.selectAdviceGrade.DataBind();

                                    for (int i = 0; i < dttype.Rows.Count; i++)
                                    {
                                        if (this.selectGrade.Items[i].Value == dr["Grade"].ToString())
                                        {
                                            this.selectGrade.SelectedIndex = i;
                                        }
                                        if (this.selectAdviceGrade.Items[i].Value == dr["AdviceGrade"].ToString())
                                        {
                                            this.selectAdviceGrade.SelectedIndex = i;
                                        }
                                    }
                                }
                            }


                            this.txtState.Text = RmsPM.BLL.SupplierSurveyOpinion.GetSupplierSurveyOpinionStatusName(dr["State"].ToString());

                            this.inputSystemGroup.Value = dr["WorkName"].ToString();

                            this.TxtPersonName.Value = dr["ZYName"].ToString();
                            this.TxtCompanyName.Text = RmsPM.BLL.SupplierRule.GetSupplierName(dr["SupplierCode"].ToString());
                            this.Txtdate.Text        = dr["SurveyDate"].ToString();
                            this.TxtRemark.Value     = dr["Remark"].ToString();
                            //this.TxtGrade.Value = dr["Grade"].ToString();
                            //this.TxtAdviceGrade.Value = dr["AdviceGrade"].ToString();
                        }
                    }
                }
                else
                {
                    DataTable dttype = RmsPM.BLL.SupplierSurveyOpinion.GetSupplierGradeType();
                    if (dttype != null)
                    {
                        if (dttype.Rows.Count != 0)
                        {
                            this.selectGrade.DataSource     = dttype;
                            this.selectGrade.DataTextField  = "TypeName";
                            this.selectGrade.DataValueField = "TypeName";
                            this.selectGrade.DataBind();

                            this.selectAdviceGrade.DataSource     = dttype;
                            this.selectAdviceGrade.DataTextField  = "TypeName";
                            this.selectAdviceGrade.DataValueField = "TypeName";
                            this.selectAdviceGrade.DataBind();
                        }
                    }


                    this.inputSystemGroup.ClassCode = "1401";

                    this.TxtCompanyName.Text = RmsPM.BLL.SupplierRule.GetSupplierName(this.SupplierCode);
                    this.Txtdate.ReadOnly    = false;
                }
            }
            else
            {
                RmsPM.BLL.SupplierSurveyOpinion cSupplierSurveyOpinion = new RmsPM.BLL.SupplierSurveyOpinion();
                cSupplierSurveyOpinion.SupplierSurveyOpinionCode = this.ApplicationCode;
                DataTable dSupplierSurveyOpinion = cSupplierSurveyOpinion.GetSupplierSurveyOpinions();
                if (dSupplierSurveyOpinion != null)
                {
                    foreach (DataRow dr in dSupplierSurveyOpinion.Select())
                    {
                        this.lblstate.Text             = RmsPM.BLL.SupplierSurveyOpinion.GetSupplierSurveyOpinionStatusName(dr["State"].ToString());
                        this.SpanlblTaskname.InnerHtml = RmsPM.BLL.ProjectRule.GetSupplierTypeName(dr["WorkName"].ToString());

                        this.lblPersonName.Text  = dr["ZYName"].ToString();
                        this.lblCompanyname.Text = RmsPM.BLL.SupplierRule.GetSupplierName(dr["SupplierCode"].ToString());
                        this.lblDate.Text        = dr["SurveyDate"].ToString();
                        this.lblRemark.InnerHtml = System.Convert.ToString(dr["Remark"]).Replace("\n", "<br>");
                        this.lblGrade.Text       = dr["Grade"].ToString();
                        this.lblAdviceGrade.Text = dr["AdviceGrade"].ToString();
                    }
                }
            }
        }
        catch (Exception ex)
        {
        }
    }