示例#1
0
        /// <summary>
        /// 获取房屋专业记载MODEL
        /// </summary>
        /// <param name="tSingleProjectID">工程ID</param>
        /// <returns></returns>
        public c_single_project_MDL GetModule(int tSingleProjectID)
        {
            c_single_project_BLL bll = new c_single_project_BLL();
            c_single_project_MDL mdl = new c_single_project_MDL();

            if (tSingleProjectID > 0)
            {
                List <c_single_project_MDL> projectmdl = bll.GetModelList("SingleProjectID=" + tSingleProjectID);
                if (projectmdl.Count > 0)
                {
                    mdl = bll.GetModel(projectmdl[0].SingleProjectID);
                }
            }
            object obj = Comm.GetValueToObject(mdl, tabledetail);

            return((c_single_project_MDL)obj);
        }
        private void DataBindEx()
        {
            T_SingleProject_MDL  projectmdl   = singleProjectBLL.GetModel(ConvertEx.ToInt(HSingleProjectID.Value));
            c_single_project_MDL a_projectmdl = csingleProjectBLL.GetModel(ConvertEx.ToInt(HSingleProjectID.Value));

            if (projectmdl != null && a_projectmdl != null)
            {
                projectmdl.fz = a_projectmdl.fz;

                StringBuilder singlePoint = new StringBuilder();
                StringBuilder ghxkz       = new StringBuilder();
                StringBuilder sgxkz       = new StringBuilder();
                StringBuilder other       = new StringBuilder();
                StringBuilder allStr      = new StringBuilder();

                #region 获取显示工程所有的坐标信息,按OrderIndex排序
                List <T_SingleProject_Point_MDL> ltPoint = new T_SingleProject_Point_BLL().GetModelList("SingleProjectID=" + projectmdl.SingleProjectID);
                if (ltPoint != null && ltPoint.Count > 0)
                {
                    singlePoint.Append("<table class=\"zpxxxj\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> ");
                    singlePoint.Append("<tr>");
                    singlePoint.Append("   <td colspan=\"4\" style=\"height: 10px\"><strong>工程坐标信息预览</strong></td>");
                    singlePoint.Append("</tr>");
                    int index = 0;
                    foreach (T_SingleProject_Point_MDL pintMDL in ltPoint)
                    {
                        index++;
                        singlePoint.Append(" <tr>");
                        singlePoint.Append("     <td class=\"ww\">X" + index + "坐标:</td>");
                        singlePoint.Append("     <td>");
                        singlePoint.Append("         <input type=\"text\" readonly=\"readonly\" value=\"" + pintMDL.X + "\" title=\"" + pintMDL.X + "\" class=\"dd\"  />");
                        singlePoint.Append("     </td>");
                        singlePoint.Append("     <td class=\"ww\">Y" + index + "坐标:</td>");
                        singlePoint.Append("     <td>");
                        singlePoint.Append("         <input  type=\"text\" readonly=\"readonly\" value=\"" + pintMDL.Y + "\" title=\"" + pintMDL.Y + "\" class=\"dd\"  />");
                        singlePoint.Append("     </td>");
                        singlePoint.Append(" </tr> ");
                    }
                    singlePoint.Append("</table>");
                    ltPointHtml.Text = singlePoint.ToString();
                }
                #endregion

                #region 获取工程对应的所有上传证件的附件
                List <T_FileAttach_MDL> lt_ftMdl = new T_FileAttach_BLL().GetModelList("PriKeyValue=" + projectmdl.SingleProjectID);
                foreach (T_FileAttach_MDL ftMdl in lt_ftMdl)
                {
                    if (ftMdl.AttachCode == "ghxkz")
                    {
                        ghxkz.Append("&nbsp;&nbsp;<a style=\"color:black;\" href=\"" + ftMdl.AttachPath + "\" title='点击查看' target=\"_blank\">" + ftMdl.AttachName + "</a>&nbsp;");
                    }
                    else if (ftMdl.AttachCode == "sgxkz")
                    {
                        sgxkz.Append("&nbsp;&nbsp;<a style=\"color:black;\" href=\"" + ftMdl.AttachPath + "\" title='点击查看' target=\"_blank\">" + ftMdl.AttachName + "</a>&nbsp;");
                    }
                    else if (ftMdl.AttachCode == "other")
                    {
                        other.Append("&nbsp;&nbsp;<a style=\"color:black;\" href=\"" + ftMdl.AttachPath + "\" title='点击查看' target=\"_blank\">" + ftMdl.AttachName + "</a>&nbsp;");
                    }
                }
                if (ghxkz.Length > 0 || sgxkz.Length > 0 || other.Length > 0)
                {
                    allStr.Append("<table class=\"zpxxxj\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                    allStr.Append("<tr>");
                    allStr.Append("<td colspan=\"4\" style=\"height: 10px\">");
                    allStr.Append("<strong>文号项扫描件预览</strong>");
                    allStr.Append("</td>");
                    allStr.Append("</tr>");
                }
                if (ghxkz.Length > 0 || sgxkz.Length > 0)
                {
                    allStr.Append("<tr>");
                    if (ghxkz.Length > 0)
                    {
                        allStr.Append("<td class=\"ww\">规划许可证号:</td>");
                        allStr.Append("<td>");
                        allStr.Append(ghxkz.ToString());
                        allStr.Append("</td>");
                    }
                    if (sgxkz.Length > 0)
                    {
                        allStr.Append("<td class=\"ww\">施工许可证号:</td>");
                        allStr.Append("<td>");
                        allStr.Append(sgxkz.ToString());
                        allStr.Append("</td>");
                    }
                    allStr.Append("</tr>");
                }
                if (other.Length > 0)
                {
                    allStr.Append("<tr>");
                    allStr.Append("  <td class=\"ww\">其它证件附件:");
                    allStr.Append("</td>");
                    allStr.Append(" <td colspan=\"3\" style=\"word-break: break-all;\">");
                    allStr.Append(other.ToString());
                    allStr.Append("  </td>");
                    allStr.Append("</tr>");
                }
                allStr.Append("</table>");
                ltImage.Text = allStr.ToString();
                #endregion
            }
            Comm.SetValueToPage(projectmdl, tablemain);
            if (jsdw.Text == "")
            {
                jsdw.Text = Common.Session.GetSession("CompanyName");
            }
        }
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            T_SingleProject_MDL spModel = new T_SingleProject_MDL();

            spModel = ctrlCompanyRegBaseInfo3_33.GetModule(ConvertEx.ToInt(SingleProjectID));

            c_single_project_MDL c_Single_Mdl = new c_single_project_MDL();

            c_Single_Mdl    = ctrlCompanyRegBaseInfo3_3Ext1.GetModule(ConvertEx.ToInt(SingleProjectID));
            c_Single_Mdl.fz = spModel.fz;

            if (spModel != null)
            {
                if (spModel.SingleProjectID <= 0 || (CommonEnum.PageState)ViewState["ps"] == CommonEnum.PageState.ADD)
                {
                    #region 添加工程信息
                    spModel.ConstructionProjectID = ConvertEx.ToInt(ctrlDropDownConstructionProject1.SelectValue);
                    spModel.ProjectType           = ctrlArchiveFormType1.SelectValue;
                    spModel.AREA_CODE             = AREA_CODE.SelectValue;
                    spModel.gcbm = "";

                    string UserID = "";
                    if (Common.Session.GetSession("tUserID") != "")
                    {
                        UserID = Common.Session.GetSession("tUserID");
                    }
                    else if (Common.Session.GetSession("UserID") != "")
                    {
                        UserID = Common.Session.GetSession("UserID");
                    }
                    spModel.CompanyUserID = Common.ConvertEx.ToInt(UserID);
                    spModel.CreateDate    = DateTime.Now;
                    spModel.Status        = 0;
                    int tmpSingleProjectID = singleProjectBLL.Add(spModel);
                    #endregion

                    #region 添加工程流程环节
                    new T_WorkFlowDefine_BLL().AddWorkFlowDefine(tmpSingleProjectID, spModel.AREA_CODE);
                    #endregion

                    #region 更新当前用户为本工程管理员
                    T_UsersInfo_BLL userBll = new T_UsersInfo_BLL();
                    T_UsersInfo_MDL userMdl = userBll.GetModel(Common.ConvertEx.ToInt(UserID));
                    userMdl.IsLeader = true;
                    userBll.Update(userMdl);
                    #endregion

                    #region 把此用户加入到这个工程用户中去
                    SingleProjectUser projectRole = new SingleProjectUser();
                    projectRole.Update(tmpSingleProjectID, userMdl.RoleID, userMdl.UserID);
                    #endregion

                    #region 加入到工程->公司表中去
                    T_SingleProjectCompany_MDL spcMDL = new T_SingleProjectCompany_MDL();
                    spcMDL.SingleProjectID = tmpSingleProjectID;
                    spcMDL.CompanyID       = Common.Session.GetSessionInt("CompanyID");
                    T_SingleProjectCompany_BLL spcBLL = new T_SingleProjectCompany_BLL();
                    spcBLL.Add(spcMDL);
                    #endregion

                    #region 房屋专业记载
                    c_Single_Mdl.SingleProjectID = tmpSingleProjectID;
                    if (csingleProjectBLL.Exists(tmpSingleProjectID))
                    {
                        csingleProjectBLL.Update(c_Single_Mdl);
                    }
                    else
                    {
                        csingleProjectBLL.Add(c_Single_Mdl);
                    }
                    #endregion

                    #region 日志
                    PublicModel.writeLog(SystemSet.EumLogType.AddData.ToString(), string.Concat("T_SingleProject;key=", tmpSingleProjectID,
                                                                                                ";ProjectType=", spModel.ProjectType, ";gcbm=", spModel.gcbm, ";gcmc=", spModel.gcmc));
                    #endregion
                }
                else
                {
                    #region 更新工程信息
                    singleProjectBLL.Update(spModel);
                    #endregion

                    #region 判断工程,如果没有专业记载,则新增,否则修改
                    if (ConvertEx.ToInt(c_Single_Mdl.SingleProjectID) > 0)
                    {
                        csingleProjectBLL.Update(c_Single_Mdl);
                    }
                    else
                    {
                        c_Single_Mdl.SingleProjectID = spModel.SingleProjectID;
                        csingleProjectBLL.Add(c_Single_Mdl);
                    }
                    #endregion

                    #region 日志
                    PublicModel.writeLog(SystemSet.EumLogType.UpdData.ToString(), string.Concat("T_SingleProject;key=", spModel.SingleProjectID,
                                                                                                ";ProjectType=", spModel.ProjectType, ";gcbm=", spModel.gcbm, ";gcmc=", spModel.gcmc));
                    #endregion
                }
            }
            Common.MessageBox.CloseLayerOpenWeb(this.Page);
        }