コード例 #1
0
        private void Init()
        {
            ProjectBind();//页面绑定方法
            ERM.BLL.T_Dict_BLL dicData = new ERM.BLL.T_Dict_BLL();
            BLL.District       bll1    = new ERM.BLL.District();
            DataSet            ds      = bll1.GetAllList();

            cboDistrict.DisplayMember = "DistrictName";
            cboDistrict.ValueMember   = "DistrictName";
            cboDistrict.DataSource    = ds.Tables[0];
            if (cboDistrict.Items.Count > 0)
            {
                cboDistrict.SelectedIndex = 0;
            }

            ds3 = dicData.FindByKeyWord("ProjectCategory");
            cboProjectType.DisplayMember = "displayname";
            cboProjectType.ValueMember   = "valuename";
            cboProjectType.DataSource    = ds3;

            if (ProjectNo != "")                     //编辑模式
            {
                txtProjectNo.Enabled        = false; //修改时,不允许修改项目编号,保证唯一性
                this.cboProjectType.Enabled = false;

                //修改 判断是否有权限修改工程编号与名称
                if (!MyCommon.CheckProjectBind())
                {
                    txtProjectNo.Enabled   = false;
                    txtProjectName.Enabled = false;
                }

                projectMDL = (new BLL.T_Projects_BLL()).Find(ProjectNo);
                if (projectMDL != null)
                {
                    itemMDL = (new ERM.BLL.T_Item_BLL()).Find(projectMDL.ItemID);
                    loadItemInfo();
                    txtProjectNo.Text            = projectMDL.ProjectNO;                                   //工程代码
                    cboDistrict.Text             = projectMDL.district == null ? "" : projectMDL.district; //区域
                    txtProjectName.Text          = projectMDL.projectname;                                 //工程名称
                    txtAddress.Text              = projectMDL.address == null ? "" : projectMDL.address;   //工程地址
                    cboProjectType.SelectedValue = projectMDL.ProjectCategory;
                    //txtYdpzcode.Text = projectMDL.ydpzcode == null ? "" : projectMDL.ydpzcode; //工程用地批准书号
                    txtYdghxkCode.Text  = projectMDL.ydxkcode == null ? "" : projectMDL.ydxkcode;     //用地规划许可证号
                    txtGhcode.Text      = projectMDL.ghcode == null ? "" : projectMDL.ghcode;         //规划许可证号
                    txtSgcode.Text      = projectMDL.sgcode == null ? "" : projectMDL.sgcode;         //工程施工许可证号
                    txtysbah.Text       = projectMDL.ajdh == null?"":projectMDL.ajdh;                 //验收备案号
                    dtpBeginDate.TextEx = projectMDL.begindate == null ? "" : (projectMDL.begindate); //开工日期
                    dtpEndDate.TextEx   = projectMDL.enddate == null ? "" : projectMDL.enddate;

                    //this.txtajdh.Text = projectMDL.ajdh.ToString();
                    this.cboProjectType.SelectedValue = projectMDL.ProjectCategory;//根据工程类型显示扩展信息
                }
            }
            else
            {
                this.cboProjectType.SelectedIndex = 0;
                projectMDL = new ERM.MDL.T_Projects();
                itemMDL    = new ERM.MDL.T_Item();
            }
            LoadDataFromView("");
            BindUnit();
        }