Ejemplo n.º 1
0
        /// <summary>
        /// 获取归档类别
        /// </summary>
        private void getType()
        {
            T_Dict_BLL     dict_bll = new T_Dict_BLL();
            IList <T_Dict> dictList = dict_bll.FindByKeyWord("ProjectCategory");

            this.cboType.DataSource    = dictList;
            this.cboType.DisplayMember = "DisplayName";
            this.cboType.ValueMember   = "ValueName";
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 绑定所有工程方法
        /// </summary>
        /// <param name="SetStyle">是否设定表格样式</param>
        private void BindGridViewData(bool SetStyle)
        {
            dgProject.AutoGenerateColumns = false;
            if (SetStyle)
            {
                SetGridStyle(); //设置样式
            }
            dgProject.Rows.Clear();
            ERM.BLL.T_Projects_BLL ProjectsDB = new ERM.BLL.T_Projects_BLL();
            IList <MDL.T_Projects> projList   = ProjectsDB.GetAll();//.GetList("").Tables[0].DefaultView;//绑定数据
            IList <T_Dict>         dict       = dictBll.FindByKeyWord("ProjectCategory");

            foreach (MDL.T_Projects obj in projList)
            {
                dgProject.Rows.Add();
                dgProject.Rows[dgProject.Rows.Count - 1].Cells["ProjectNO"].Value   = obj.ProjectNO;
                dgProject.Rows[dgProject.Rows.Count - 1].Cells["district"].Value    = obj.district;
                dgProject.Rows[dgProject.Rows.Count - 1].Cells["projectname"].Value = obj.projectname;
                dgProject.Rows[dgProject.Rows.Count - 1].Cells["address"].Value     = obj.address;
                dgProject.Rows[dgProject.Rows.Count - 1].Cells["begindate"].Value   = obj.begindate;

                foreach (var item in dict)
                {
                    if (item.ValueName == obj.ProjectCategory)
                    {
                        dgProject.Rows[dgProject.Rows.Count - 1].Cells["ProjectCategory"].Value = item.DisplayName;
                        break;
                    }
                }

                dgProject.Rows[dgProject.Rows.Count - 1].Cells["begindate"].Value =
                    string.IsNullOrWhiteSpace(obj.begindate) ? "" : MyCommon.ToDate(obj.begindate).ToString("yyyy-MM-dd");
                //dgProject.Rows[dgProject.Rows.Count - 1].Cells["bjdate"].Value = MyCommon.ToDate(obj.bjdate).ToString("yyyy-MM-dd");
                dgProject.Rows[dgProject.Rows.Count - 1].Cells["enddate"].Value =
                    string.IsNullOrWhiteSpace(obj.enddate) ? "" : MyCommon.ToDate(obj.enddate).ToString("yyyy-MM-dd");

                if (Globals.ProjectNO != null && Globals.ProjectNO != string.Empty && Globals.ProjectNO == obj.ProjectNO)
                {
                    dgProject.Rows[dgProject.Rows.Count - 1].Selected = true;
                }
            }
        }