Пример #1
0
        public bool Update(T_Projects model_Projects, T_Item model_Item, T_Project_Brige model_Brige)
        {
            BLL.T_Projects_BLL proj_bll = new T_Projects_BLL();
            bool flag = proj_bll.Update(model_Projects, model_Item);

            if (flag)
            {
                this.Update(model_Brige);
                return(true);
            }
            return(false);
        }
Пример #2
0
        public IList <MDL.T_GdList> FindByProjectNo(string ProjectNo)
        {
            String stmtId = "T_GdList.FindByProjectNo";

            MDL.T_GdList obj = new MDL.T_GdList();
            obj.ProjectNo = ProjectNo;

            T_Projects_BLL       BLL    = new T_Projects_BLL();
            IList <MDL.T_GdList> result = MyISqlMap.QueryForList <MDL.T_GdList>(stmtId, obj);

            return(result);
        }
Пример #3
0
        public bool Add(T_Projects model_Projects, T_Item model_Item, T_Project_RoadLamp model_RoadLamp)
        {
            BLL.T_Projects_BLL proj_bll = new T_Projects_BLL();
            bool flag = proj_bll.Add(model_Projects, model_Item);

            if (flag)
            {
                this.Insert(model_RoadLamp);
                return(true);
            }
            return(false);
        }
Пример #4
0
        public IList <T_FileListTemplate> FindByArchiveID2(String archiveID, string projectNO)
        {
            T_Projects_BLL bll = new T_Projects_BLL();
            //T_Projects projects = bll.Find(projectNO);

            String stmtId = "T_FileListTemplate.FindByArchiveID2";

            MDL.T_FileListTemplate obj = new T_FileListTemplate();

            //obj.ProjectCategory = projects.ProjectCategory;

            IList <T_FileListTemplate> result = MyISqlMap.QueryForList <T_FileListTemplate>(stmtId, obj);

            return(result);
        }
Пример #5
0
        /// <summary>
        /// 绑定所有工程方法
        /// </summary>
        /// <param name="SetStyle">是否设定表格样式</param>
        private void BindGridViewData()
        {
            ERM.BLL.T_Projects_BLL ProjectsDB = new ERM.BLL.T_Projects_BLL();
            IList <MDL.T_Projects> projList   = ProjectsDB.GetAll();//绑定数据

            DataTable tbl_proj = new DataTable();

            tbl_proj.Columns.Add(new DataColumn("projectname", typeof(string)));
            tbl_proj.Columns.Add(new DataColumn("ProjectNO", typeof(string)));

            DataTable tbl_proj2 = new DataTable();

            tbl_proj2.Columns.Add(new DataColumn("projectname", typeof(string)));
            tbl_proj2.Columns.Add(new DataColumn("ProjectNO", typeof(string)));

            DataRow row_1 = tbl_proj.NewRow();

            row_1["projectname"] = "--请选择";
            row_1["ProjectNO"]   = "--请选择";
            tbl_proj.Rows.Add(row_1);

            DataRow row_2 = tbl_proj2.NewRow();

            row_2["projectname"] = "--请选择";
            row_2["ProjectNO"]   = "--请选择";
            tbl_proj2.Rows.Add(row_2);

            foreach (MDL.T_Projects obj in projList)
            {
                DataRow row_temp = tbl_proj.NewRow();
                row_temp["projectname"] = obj.projectname;
                row_temp["ProjectNO"]   = obj.ProjectNO;
                tbl_proj.Rows.Add(row_temp);

                DataRow row_temp2 = tbl_proj2.NewRow();
                row_temp2["projectname"] = obj.projectname;
                row_temp2["ProjectNO"]   = obj.ProjectNO;
                tbl_proj2.Rows.Add(row_temp2);
            }
            cbx_Source.DataSource    = tbl_proj;
            cbx_Source.DisplayMember = "projectname";
            cbx_Source.ValueMember   = "ProjectNO";

            cbx_Trage.DataSource    = tbl_proj2;
            cbx_Trage.DisplayMember = "projectname";
            cbx_Trage.ValueMember   = "ProjectNO";
        }
Пример #6
0
        public bool Update(T_Projects model_Projects, T_Item model_Item, T_Traffic model_Traffic, IList <T_Traffic_Detail> detailMDL)
        {
            BLL.T_Projects_BLL proj_bll = new T_Projects_BLL();
            bool flag = proj_bll.Update(model_Projects, model_Item);

            if (flag)
            {
                BLL.T_Traffic_Detail_BLL detailBLL = new ERM.BLL.T_Traffic_Detail_BLL();
                for (int i = 0; i < detailMDL.Count; i++)
                {
                    detailBLL.Update(detailMDL[i]);
                }
                this.Update(model_Traffic);
                return(true);
            }
            return(false);
        }
Пример #7
0
        public bool Add(T_Projects model_Projects, T_Item model_Item, T_Traffic model_Traffic, IList <T_Traffic_Detail> detailMDL)
        {
            BLL.T_Projects_BLL proj_bll = new T_Projects_BLL();
            bool flag = proj_bll.Add(model_Projects, model_Item);

            if (flag)
            {
                this.Insert(model_Traffic);
                BLL.T_Traffic_Detail_BLL detailBLL = new ERM.BLL.T_Traffic_Detail_BLL();
                for (int i = 0; i < detailMDL.Count; i++)
                {
                    detailMDL[i].TrafficID = model_Traffic.ID.ToString();
                    detailBLL.Add(detailMDL[i]);
                }
                return(true);
            }
            return(false);
        }
Пример #8
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;
                }
            }
        }
Пример #9
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnProjectDelete_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = this.dgProject.SelectedRows;

            if (rows.Count == 0)
            {
                return;
            }
            else
            {   //询问是否删除
                if (TXMessageBoxExtensions.Question("确定要删除工程:" + rows[0].Cells["ProjectName"].Value.ToString() + "吗?  \n 【温馨提示:删除工程后信息将无法恢复!请慎重!!!】") == DialogResult.Cancel)
                {
                    return;
                }
                else//确定删除
                {
                    string ProjectNO = rows[0].Cells["ProjectNO"].Value.ToString();
                    ERM.BLL.T_Projects_BLL ProjectsDB = new ERM.BLL.T_Projects_BLL();
                    T_Item_BLL             item       = new T_Item_BLL();
                    item.Delete(ProjectsDB.Find(ProjectNO).ItemID);

                    ProjectsDB.Delete(ProjectNO);
                    BLL.BLLMore bllMore = new BLLMore();

                    bllMore.DeleteUnitByProjectNO(ProjectNO);
                    bllMore.DeleteFileListByProjectNO(ProjectNO);
                    bllMore.DeleteCellFileByProjectNO(ProjectNO);
                    bllMore.DeleteArchiveByProjectNO(ProjectNO);
                    bllMore.DeleteGdListByProjectNO(ProjectNO);

                    bllMore.DeleteBrigeByProjectNO(ProjectNO);
                    bllMore.DeleteRoadLampByProjectNO(ProjectNO);
                    bllMore.DeleteTrafficByProjectNO(ProjectNO);

                    bllMore.DeletePointByPorjectNo(ProjectNO);
                    bllMore.DeleteYW_CellAndEFileByPorjectNo(ProjectNO);
                    MyCommon.DeleteAndCreateEmptyDirectory(Globals.ProjectPathParent + ProjectNO, false);
                    BindGridViewData(false);//重新绑定数据
                }
            }
        }
Пример #10
0
        /// <summary>
        /// 复制
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Click(object sender, EventArgs e)
        {
            frm2PDFProgressMsg fmessage = new frm2PDFProgressMsg();

            fmessage.Text = "工程复制中...";
            try
            {
                string     sourceNO   = string.Empty;
                string     sourceName = string.Empty;
                string     targeNO    = string.Empty;
                string     targeName  = string.Empty;
                T_Projects sourcePorj;
                T_Projects targePorj;

                (cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString();

                if (cbx_Source.Items.Count == 1 || cbx_Trage.Items.Count == 1)
                {
                    TXMessageBoxExtensions.Info("提示:请选择需要复制的工程!");
                    cbx_Source.Focus();
                    return;
                }
                else if ((cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString() == "--请选择")
                {
                    TXMessageBoxExtensions.Info("提示:请选择复制的工程!");
                    cbx_Source.Focus();
                    return;
                }
                else if ((cbx_Trage.SelectedItem as System.Data.DataRowView)[0].ToString() == "--请选择")
                {
                    TXMessageBoxExtensions.Info("提示:请选择复制的目的工程!");
                    cbx_Trage.Focus();
                    return;
                }
                else
                {
                    sourceNO   = (cbx_Source.SelectedItem as System.Data.DataRowView)[1].ToString(); //要编辑的主键
                    sourceName = (cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString(); //要编辑的主键
                    targeNO    = (cbx_Trage.SelectedItem as System.Data.DataRowView)[1].ToString();  //要编辑的主键
                    targeName  = (cbx_Trage.SelectedItem as System.Data.DataRowView)[0].ToString();  //要编辑的主键

                    //根据工程编号查询工程类别
                    sourcePorj = projectBLL.Find(sourceNO);
                    targePorj  = projectBLL.Find(targeNO);
                    if (sourcePorj.ProjectCategory != targePorj.ProjectCategory)
                    {
                        TXMessageBoxExtensions.Info("复制的工程类别必须一致!");
                        return;
                    }
                    if (sourceNO == targeNO)
                    {
                        TXMessageBoxExtensions.Info("提示:同一工程不能复制!");
                        return;
                    }
                }
                if (TXMessageBoxExtensions.Question("提示:确定将工程\n编号:" + sourceNO + " 名称:" +
                                                    sourceName + "\n复制到工程\n编号:" + targeNO + " 名称:" + targeName
                                                    + "\n【温馨提示:复制之后工程信息将无法恢复!请慎重!!!】") == DialogResult.OK)
                {
                    status_flg        = true;
                    btn_Copy.Enabled  = false;
                    btn_Colse.Enabled = false;

                    fmessage      = new frm2PDFProgressMsg();
                    fmessage.Text = "工程复制中...";
                    fmessage.progressBar1.Maximum = 4;

                    fmessage.label2.Text        = "正在删除工程编号:" + targeNO + "信息...";
                    fmessage.progressBar1.Value = 1;
                    fmessage.Show();
                    Application.DoEvents();

                    //删除目的工程下信息
                    BLL.BLLMore bllMore = new BLL.BLLMore();
                    bllMore.DeleteUnitByProjectNO(targeNO);
                    bllMore.DeleteFileListByProjectNO(targeNO);
                    bllMore.DeleteCellFileByProjectNO(targeNO);
                    bllMore.DeleteArchiveByProjectNO(targeNO);
                    bllMore.DeleteGdFileByProjectNO(targeNO);//删除归档类别

                    #region add deleteProject
                    bllMore.DeleteTrafficByProjectNO(targeNO);
                    bllMore.DeleteRoadLampByProjectNO(targeNO);
                    bllMore.DeleteBrigeByProjectNO(targeNO);
                    bllMore.DeletePointByPorjectNo(targeNO);
                    #endregion

                    MyCommon.DeleteAndCreateEmptyDirectory(Globals.ProjectPathParent + targeNO);

                    //将源工程信息Copy到目的工程
                    fmessage.label2.Text        = "正在更新工程编号:" + targeNO + "信息...";
                    fmessage.progressBar1.Value = 2;
                    Application.DoEvents();

                    BLL.T_Projects_BLL Proj_bll        = new ERM.BLL.T_Projects_BLL();
                    ERM.MDL.T_Projects targe_proj_MDL  = Proj_bll.Find(targeNO);
                    ERM.MDL.T_Projects source_proj_MDL = Proj_bll.Find(sourceNO);
                    targe_proj_MDL.address     = source_proj_MDL.address;
                    targe_proj_MDL.area1       = source_proj_MDL.area1;
                    targe_proj_MDL.area2       = source_proj_MDL.area2;
                    targe_proj_MDL.begindate   = source_proj_MDL.begindate;
                    targe_proj_MDL.bgyfmj      = source_proj_MDL.bgyfmj;
                    targe_proj_MDL.bjdate      = source_proj_MDL.bjdate;
                    targe_proj_MDL.category    = source_proj_MDL.category;
                    targe_proj_MDL.cfmj        = source_proj_MDL.cfmj;
                    targe_proj_MDL.createdate  = source_proj_MDL.createdate;
                    targe_proj_MDL.district    = source_proj_MDL.district;
                    targe_proj_MDL.dxsmj       = source_proj_MDL.dxsmj;
                    targe_proj_MDL.enddate     = source_proj_MDL.enddate;
                    targe_proj_MDL.floors1     = source_proj_MDL.floors1;
                    targe_proj_MDL.floors2     = source_proj_MDL.floors2;
                    targe_proj_MDL.ghcode      = source_proj_MDL.ghcode;
                    targe_proj_MDL.high        = source_proj_MDL.high;
                    targe_proj_MDL.hjqk        = source_proj_MDL.hjqk;
                    targe_proj_MDL.jldwshr     = source_proj_MDL.jldwshr;
                    targe_proj_MDL.jsdwshr     = source_proj_MDL.jsdwshr;
                    targe_proj_MDL.passwd      = source_proj_MDL.passwd;
                    targe_proj_MDL.price1      = source_proj_MDL.price1;
                    targe_proj_MDL.price2      = source_proj_MDL.price2;
                    targe_proj_MDL.projecttype = source_proj_MDL.projecttype;
                    targe_proj_MDL.qtyfmj      = source_proj_MDL.qtyfmj;
                    targe_proj_MDL.sgbzz       = source_proj_MDL.sgbzz;
                    targe_proj_MDL.sgcode      = source_proj_MDL.sgcode;
                    targe_proj_MDL.stru        = source_proj_MDL.stru;
                    targe_proj_MDL.syyfmj      = source_proj_MDL.syyfmj;
                    targe_proj_MDL.tbr         = source_proj_MDL.tbr;
                    targe_proj_MDL.tempid      = source_proj_MDL.tempid;
                    targe_proj_MDL.ts1         = source_proj_MDL.ts1;
                    targe_proj_MDL.ts2         = source_proj_MDL.ts2;
                    targe_proj_MDL.ts3         = source_proj_MDL.ts3;
                    targe_proj_MDL.ts4         = source_proj_MDL.ts4;
                    targe_proj_MDL.tstotal     = source_proj_MDL.tstotal;
                    targe_proj_MDL.ydpzcode    = source_proj_MDL.ydpzcode;
                    targe_proj_MDL.ydxkcode    = source_proj_MDL.ydxkcode;
                    targe_proj_MDL.zjy         = source_proj_MDL.zjy;
                    targe_proj_MDL.zygz        = source_proj_MDL.zygz;
                    targe_proj_MDL.zzmj        = source_proj_MDL.zzmj;

                    targe_proj_MDL.ztcw   = source_proj_MDL.ztcw;
                    targe_proj_MDL.dstcw  = source_proj_MDL.dstcw;
                    targe_proj_MDL.dxtcw  = source_proj_MDL.dxtcw;
                    targe_proj_MDL.kzsfcd = source_proj_MDL.kzsfcd;
                    targe_proj_MDL.ts5    = source_proj_MDL.ts5;
                    targe_proj_MDL.XMJL   = source_proj_MDL.XMJL;
                    targe_proj_MDL.yjdw   = source_proj_MDL.yjdw;
                    targe_proj_MDL.XCJL   = source_proj_MDL.XCJL;

                    Proj_bll.Update(targe_proj_MDL);

                    //坐标信息
                    IList <T_Point> t_point_source = new T_Point_BLL().GetList(sourceNO);
                    foreach (var item in t_point_source)
                    {
                        item.ID        = Guid.NewGuid().ToString();
                        item.ProjectNo = targeNO;
                        new T_Point_BLL().Insert(item);
                    }

                    //电子文件
                    bllMore.CopyFileAndEFileList(sourceNO, targeNO);

                    BLL.T_Archive_BLL      archive_bll  = new ERM.BLL.T_Archive_BLL();      //案卷信息
                    BLL.T_FileList_BLL     filelist_bll = new ERM.BLL.T_FileList_BLL();     //文件表
                    BLL.T_CellAndEFile_BLL cellAndEfile = new ERM.BLL.T_CellAndEFile_BLL(); //电子文件
                    //单位
                    BLL.T_Units_BLL     units_bll = new ERM.BLL.T_Units_BLL();              //施工单位
                    IList <MDL.T_Units> IUnits    = units_bll.FindByProjectNO(sourceNO);
                    if (IUnits != null && IUnits.Count > 0)
                    {
                        foreach (MDL.T_Units units in IUnits)
                        {
                            units.UnitID    = Guid.NewGuid().ToString();
                            units.ProjectNO = targeNO;
                            units_bll.Add(units);//保存
                        }
                    }

                    //扩展信息
                    switch (sourcePorj.ProjectCategory)
                    {
                    case "Traffic":
                        T_Traffic_BLL trafficBll = new T_Traffic_BLL();
                        T_Traffic     traffic    = trafficBll.QueryTraffic_ByProjID(sourceNO);
                        if (traffic != null)
                        {
                            traffic.ID        = Guid.NewGuid().ToString();
                            traffic.ProjectID = targeNO;
                            trafficBll.Insert(traffic);
                        }
                        break;

                    case "RoadLamp":
                        T_Project_RoadLamp_BLL roadLampBll = new T_Project_RoadLamp_BLL();
                        T_Project_RoadLamp     roadLamp    = roadLampBll.QueryRoadLamp_ByProjID(sourceNO);
                        if (roadLamp != null)
                        {
                            roadLamp.ProjectID = targeNO;
                            roadLamp.ID        = Guid.NewGuid().ToString();
                            roadLampBll.Insert(roadLamp);
                        }
                        break;

                    case "Brige":
                        T_Project_Brige_BLL brigeBll = new T_Project_Brige_BLL();
                        T_Project_Brige     brige    = brigeBll.QueryBrige_ByProjID(sourceNO);
                        if (brige != null)
                        {
                            brige.ID        = Guid.NewGuid().ToString();
                            brige.ProjectID = targeNO;
                            brigeBll.Insert(brige);
                        }
                        break;
                    }

                    fmessage.progressBar1.Value = 3;
                    Application.DoEvents();

                    //迁移文件夹
                    string   mprojectPath  = Application.StartupPath + "\\Project\\" + sourceNO;
                    string   tprojectPath  = Application.StartupPath + "\\Project\\" + targeNO;
                    string[] DirectoryList = new string[] { "MPDF", "ODOC", "PDF" };

                    if (System.IO.Directory.Exists(tprojectPath))
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, false);
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, true);
                    }
                    else
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, true);
                    }
                    string tempText  = fmessage.label2.Text;
                    char[] tempChar  = tempText.ToCharArray();
                    int    tempIndex = 0;
                    foreach (string dic in DirectoryList)
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath + "\\" + dic, true);
                        fmessage.label2.Text = "";
                        if (System.IO.Directory.Exists(mprojectPath))
                        {
                            if (System.IO.Directory.Exists(mprojectPath + "\\" + dic))
                            {
                                string[] files = System.IO.Directory.GetFiles(mprojectPath + "\\" + dic);
                                foreach (string filename in files)
                                {
                                    fmessage.label2.Text += tempChar[tempIndex];
                                    Application.DoEvents();
                                    tempIndex++;
                                    if (tempIndex >= tempChar.Length)
                                    {
                                        tempIndex            = 0;
                                        fmessage.label2.Text = "";
                                    }
                                    System.IO.FileInfo fileinfo = new System.IO.FileInfo(filename);
                                    if (System.IO.File.Exists(filename))
                                    {
                                        System.IO.File.Copy(filename, tprojectPath + "\\" + dic + "\\" + fileinfo.Name, true);
                                    }
                                }
                            }
                        }
                    }

                    fmessage.progressBar1.Value = 4;
                    Application.DoEvents();
                    fmessage.Close();

                    btn_Copy.Enabled  = true;
                    btn_Colse.Enabled = true;

                    TXMessageBoxExtensions.Info("提示:复制成功!");
                    BindGridViewData();
                }
            }
            catch (Exception ex)
            {
                if (fmessage != null)
                {
                    fmessage.Close();
                }
                TXMessageBoxExtensions.Info("提示:复制失败!");
                MyCommon.WriteLog("复制工程错误:" + ex.Message);
                btn_Copy.Enabled  = true;
                btn_Colse.Enabled = true;
            }
        }
Пример #11
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        private bool SaveData()
        {
            if (string.IsNullOrEmpty(this.txtConStructionProjectName.Text))
            {
                TXMessageBoxExtensions.Info("提示:项目名称不能为空!");
                this.tabControl1.SelectedTab = tabPage4;
                txtConStructionProjectName.Focus();
                return(false);
            }


            if (string.IsNullOrEmpty(this.txtConstructionProjectAdd.Text))
            {
                TXMessageBoxExtensions.Info("提示:项目地址不能为空!");
                this.tabControl1.SelectedTab = tabPage4;
                txtConstructionProjectAdd.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtCreateUnit.Text))
            {
                TXMessageBoxExtensions.Info("提示:项目建设单位不能为空!");
                this.tabControl1.SelectedTab = tabPage4;
                txtCreateUnit.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.txtPZDW.Text))
            {
                TXMessageBoxExtensions.Info("提示:立项批准单位不能为空!");
                this.tabControl1.SelectedTab = tabPage4;
                txtPZDW.Focus();
                return(false);
            }

            if (this.cboProjectType.SelectedIndex == -1)
            {
                TXMessageBoxExtensions.Info("提示:工程类型必须选择!");
                this.tabControl1.SelectedTab = tabPage4;
                return(false);
            }
            if (txtProjectNo.Text.Trim() == "")
            {
                TXMessageBoxExtensions.Info("提示:工程编号必须填写!");
                this.tabControl1.SelectedTab = tabPage1;
                this.txtProjectNo.Focus();
                return(false);
            }
            if (!MyCommon.isYesProjectNo(txtProjectNo.Text.Trim()))
            {
                TXMessageBoxExtensions.Info("提示:工程编号格式错误!\n【温馨提示:工程编号只允许输入数字,字母,下划线,横线】");
                this.tabControl1.SelectedTab = tabPage1;
                txtProjectNo.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(txtProjectName.Text))
            {
                TXMessageBoxExtensions.Info("提示:工程名称不能为空!");
                this.tabControl1.SelectedTab = tabPage1;
                txtProjectName.Focus();
                return(false);
            }

            if (cboDistrict.SelectedValue.ToString() == "" || string.IsNullOrEmpty(this.txtAddress.Text))
            {
                TXMessageBoxExtensions.Info("提示:工程地址不能为空!");
                this.tabControl1.SelectedTab = tabPage1;
                txtAddress.Focus();
                return(false);
            }

            if (dtpBeginDate.TextEx == "")
            {
                TXMessageBoxExtensions.Info("提示:开工日期必须填写!\n");
                this.tabControl1.SelectedTab = tabPage1;
                dtpBeginDate.Focus();
                return(false);
            }

            if (dtpEndDate.TextEx == "")
            {
                TXMessageBoxExtensions.Info("提示:竣工日期必须填写!\n");
                this.tabControl1.SelectedTab = tabPage1;
                dtpEndDate.Focus();
                return(false);
            }

            //验证单位
            if (!isCheckUnit(new List <TXTextBoxEX>()
            {
                this.txtJsdw, this.txtLxpzdw, this.txtSjdw, this.txtKcdw, this.txtSgdw, this.txtJldw
            },
                             new string[] { "建设", "立项批准", "设计", "勘察", "施工", "监理" }))
            {
                return(false);
            }

            if (txtGhcode.Text == "")
            {
                TXMessageBoxExtensions.Info("提示:工程规划许可证号必须填写!\n");
                this.tabControl1.SelectedTab = tabPage1;
                txtGhcode.Focus();
                return(false);
            }

            if (ProjectNO == "")//不是编辑
            {
                ERM.BLL.T_Projects_BLL ProjectDB = new ERM.BLL.T_Projects_BLL();
                if (ProjectDB.Exists(txtProjectNo.Text.Trim()))
                {
                    TXMessageBoxExtensions.Info("提示:工程编号有重复的请重新填写!");
                    this.tabControl1.SelectedTab = tabPage1;
                    txtProjectNo.Focus();
                    return(false);
                }
                if (txtProjectName.Text.Trim() != "" &&
                    ProjectDB.ExistsName(txtProjectName.Text.Trim()))
                {
                    TXMessageBoxExtensions.Info("提示:工程名称有重复的请重新填写!");
                    this.tabControl1.SelectedTab = tabPage1;
                    txtProjectName.Focus();
                    return(false);
                }
            }

            if ((!String.IsNullOrEmpty(this.dtpBeginDate.TextEx)) && dtpBeginDate.TextEx != "")
            {
                if (this.dtpEndDate.TextEx != "" &&
                    (!this.dtpBeginDate.TextEx.Equals(this.dtpEndDate.TextEx)) &&
                    (MyCommon.ToDate(dtpBeginDate.TextEx) >
                     MyCommon.ToDate(dtpEndDate.TextEx)))
                {
                    TXMessageBoxExtensions.Info("提示:工程基本信息:开工日期 必须小于 竣工日期!");
                    this.tabControl1.SelectedTab = tabPage1;
                    this.dtpEndDate.Focus();
                    return(false);
                }
            }

            projectMDL = obj.GetInfo(ProjectNo, projectMDL, 1) as T_Projects;

            projectMDL.ProjectNO       = MyCommon.ToSqlString(txtProjectNo.Text);   //工程编号
            projectMDL.district        = MyCommon.ToSqlString(cboDistrict.Text);    //所属区域
            projectMDL.projectname     = MyCommon.ToSqlString(txtProjectName.Text); //工程名称
            projectMDL.address         = MyCommon.ToSqlString(txtAddress.Text);     //工程地址
            projectMDL.ajdh            = MyCommon.ToSqlString(txtysbah.Text);       //验收备案号
            projectMDL.ProjectCategory = cboProjectType.SelectedValue.ToString();
            projectMDL.begindate       = dtpBeginDate.TextEx;                       //开工时间
            projectMDL.enddate         = dtpEndDate.TextEx;                         //竣工时间
            projectMDL.ghcode          = MyCommon.ToSqlString(txtGhcode.Text);
            projectMDL.sgcode          = MyCommon.ToSqlString(txtSgcode.Text);
            projectMDL.tbr             = Globals.Fullname;

            //projectMDL.ydpzcode = MyCommon.ToSqlString(txtYdpzcode.Text);
            projectMDL.ydxkcode = MyCommon.ToSqlString(txtYdghxkCode.Text);
            SetItemInfo(itemMDL.ItemID, 1);

            if (this.ProjectNO == "")
            {
                projectMDL.createdate = DateTime.Now.ToString("yyyy.MM.dd");
                itemMDL.ItemID        = Guid.NewGuid().ToString();
                projectMDL.ItemID     = itemMDL.ItemID;
                SaveUnit();
                if (!obj.Add(projectMDL, itemMDL))
                {
                    TXMessageBoxExtensions.Info("保存失败!");
                    return(false);
                }
                this.ProjectNO       = txtProjectNo.Text;
                txtProjectNo.Enabled = false;
                try
                {
                    System.IO.Directory.CreateDirectory(Globals.ProjectPathParent + MyCommon.ToSqlString(txtProjectNo.Text));
                }
                catch
                {
                    TXMessageBoxExtensions.Info("发生错误,请检查存放电子文件的目录是否存在及可写!");
                }
            }
            else
            {
                SaveUnit();
                if (!obj.Updates(projectMDL, itemMDL))
                {
                    TXMessageBoxExtensions.Info("保存失败!");
                    return(false);
                }
            }
            return(true);
        }