Ejemplo n.º 1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            T_UsersInfo_MDL model = new T_UsersInfo_MDL();

            if (ViewState["model"] != null)
            {
                model = (Model.T_UsersInfo_MDL)ViewState["model"];
            }

            object obj = Comm.GetValueToObject(model, this.tbl);

            if (obj != null)
            {
                T_UsersInfo_MDL Newmodel = (T_UsersInfo_MDL)obj;
                Newmodel.Passwd     = DESEncrypt.Encrypt(Passwd.Text);                             //密码加密
                Newmodel.Createdate = System.DateTime.Now;                                         //创建时间或最后修改时间
                Newmodel.Createdby  = Common.Session.GetSession("UserName");                       //创建者或最后修改者
                Newmodel.UserType   = SystemSet.EumUserType.ArchiveUser.ToString();                //默认为档案馆用户

                switch ((CommonEnum.PageState)ViewState["ps"])
                {
                case CommonEnum.PageState.ADD:
                    int UserID = userBLL.Add(Newmodel);
                    PublicModel.writeLog(SystemSet.EumLogType.AddData.ToString(), string.Concat("T_UsersInfo;key=", UserID,
                                                                                                ";UserType=", Newmodel.UserType, ";CompanyID=", Newmodel.CompanyID, ";UserName="******";LoginName=", Newmodel.LoginName, ";UserType=", Newmodel.UserType));
                    break;

                case CommonEnum.PageState.EDIT:
                    T_UsersInfo_MDL tempObj = userBLL.GetModel(Newmodel.UserID);
                    userBLL.Update(Newmodel);
                    PublicModel.writeLog(SystemSet.EumLogType.UpdData.ToString(), string.Concat("T_UsersInfo;key=", tempObj.UserID,
                                                                                                ";UserType=", tempObj.UserType, ";CompanyID=", tempObj.CompanyID, ";UserName="******";LoginName=", tempObj.LoginName, ";UserType=", tempObj.UserType));
                    break;
                }
            }
            Common.MessageBox.CloseLayerOpenWeb(this.Page);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            T_Company_MDL model = new T_Company_MDL();

            if ((CommonEnum.PageState)ViewState["ps"] == CommonEnum.PageState.ADD)
            {
                model = ctrlCompanyBaseInfo1.GetModule(0);
                if (model != null)
                {
                    if (ConvertEx.ToInt(ctrlCompanyBaseInfo1.CompanyTypeID) == SystemSet._ARCHIVE)
                    {
                        model.IsCompany = false;                                    //这是档案馆,不是建设等单位
                    }
                    else
                    {
                        model.IsCompany = true;
                    }

                    model.CreateDate   = System.DateTime.Now;
                    model.CreateIP     = DNTRequest.GetIP();
                    model.CreateUserID = Common.Session.GetSessionInt("UserID"); //公司创建人

                    int CompanyID = companyBLL.Add(model);                       //单位ID

                    T_UsersInfo_MDL uiMdl = new T_UsersInfo_MDL();
                    uiMdl.UserName   = txtLogName.Text.Trim();
                    uiMdl.LoginName  = txtLogName.Text.Trim();
                    uiMdl.Passwd     = DESEncrypt.Encrypt(txtPwd.Text);
                    uiMdl.UserType   = SystemSet.EumUserType.SignatureUser.ToString();              //签章用户
                    uiMdl.TrainCount = 0;
                    uiMdl.Createdate = DateTime.Now;
                    uiMdl.Createdby  = "由" + Common.Session.GetSession("UserName") + "创建";
                    uiMdl.IsValid    = true;
                    uiMdl.RoleID     = ConvertEx.ToInt(ctrlSignatureRole.SelectValue);               //签章单位角色ID
                    uiMdl.CompanyID  = CompanyID;                                                    //所属单位
                    userBLL.Add(uiMdl);

                    PublicModel.writeLog(SystemSet.EumLogType.AddData.ToString(), string.Concat("T_Company;key=", model.CompanyID,
                                                                                                ";CompanyCode=", model.CompanyCode, ";CompanyType=", model.CompanyType, ";CompanyName=", model.CompanyName, ";签章单位"));
                    PublicModel.writeLog(SystemSet.EumLogType.AddData.ToString(), string.Concat("T_UsersInfo;key=", uiMdl.UserID,
                                                                                                ";CompanyID=", uiMdl.CompanyID, ";UserName="******";LoginName=", uiMdl.LoginName, ";UserType=", uiMdl.UserType));
                }
            }
            if ((CommonEnum.PageState)ViewState["ps"] == CommonEnum.PageState.EDIT)
            {
                model = ctrlCompanyBaseInfo1.GetModule(ConvertEx.ToInt(ID));

                if (ViewState["UserID"] != null)
                {
                    T_UsersInfo_MDL User = userBLL.GetModel(ConvertEx.ToInt(ViewState["UserID"]));
                    if (User != null)
                    {
                        User.RoleID    = ConvertEx.ToInt(ctrlSignatureRole.SelectValue);                //签章单位角色ID
                        User.LoginName = txtLogName.Text.Trim();
                        User.Passwd    = DESEncrypt.Encrypt(txtPwd.Text.Trim());
                        userBLL.Update(User);

                        PublicModel.writeLog(SystemSet.EumLogType.UpdData.ToString(), string.Concat("T_UsersInfo;key=", User.UserID,
                                                                                                    ";CompanyID=", User.CompanyID, ";UserName="******";LoginName=", User.LoginName, ";UserType=", User.UserType));
                    }
                }
                if (model != null)
                {
                    companyBLL.Update(model);
                    PublicModel.writeLog(SystemSet.EumLogType.UpdData.ToString(), string.Concat("T_Company;key=", model.CompanyID,
                                                                                                ";CompanyCode=", model.CompanyCode, ";CompanyType=", model.CompanyType, ";CompanyName=", model.CompanyName, ";签章单位"));
                }
            }
            Common.MessageBox.CloseLayerOpenWeb(this.Page);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try {
                #region 建设单位信息
                T_Company_MDL companyMDL = new T_Company_MDL();

                companyMDL              = Comm.GetValueToObject(companyMDL, table_Company) as T_Company_MDL;
                companyMDL.CreateDate   = DateTime.Now;
                companyMDL.IsCompany    = true;
                companyMDL.CreateIP     = Common.DNTRequest.GetIP();
                companyMDL.CreateUserID = 0;//公司创建人

                int companyID = companyBLL.Add(companyMDL);
                #endregion

                if (companyID > 0)
                {
                    #region 项目信息
                    T_Construction_Project_MDL cpModel = new T_Construction_Project_MDL();
                    T_Construction_Project_BLL cpBll   = new T_Construction_Project_BLL();

                    cpModel.CompanyID = companyID;                     //所属单位
                    cpModel.xmmc      = xmmc.Text;                     //项目名称
                    cpModel.xmh       = string.Empty;                  //项目号
                    if (jgsj.Text.Length > 0)
                    {
                        cpModel.jgrq = Common.ConvertEx.ToDate(jgsj.Text);  //开工时间
                    }
                    cpModel.jgsj        = jgsj.Text;
                    cpModel.ProjectType = ProjectType.SelectValue;
                    int constructionProjectID = cpBll.Add(cpModel);
                    #endregion

                    #region 工程信息
                    T_SingleProject_MDL singleProjectMDL = new T_SingleProject_MDL();

                    singleProjectMDL                       = Comm.GetValueToObject(singleProjectMDL, tablemain) as T_SingleProject_MDL;
                    singleProjectMDL.AREA_CODE             = AREA_CODE.SelectValue;
                    singleProjectMDL.ConstructionProjectID = constructionProjectID;
                    singleProjectMDL.CreateDate            = DateTime.Now;
                    singleProjectMDL.Status                = 0;                      //初始为0,未分配
                    singleProjectMDL.jsdw                  = companyMDL.CompanyName; //建设单位,是当前单位
                    singleProjectMDL.gcdd                  = gcdd.Text.Trim();
                    singleProjectMDL.WorkFlow_DoStatus     = 0;

                    int singleProjectID = singleProjectBLL.Add(singleProjectMDL); //工程ID
                    UploadFile(singleProjectID);                                  //上传证书

                    #endregion

                    #region 用户信息 ,角色默认给先前定义好的建设单位角色
                    T_UsersInfo_MDL userMDL = new T_UsersInfo_MDL();
                    userMDL               = (T_UsersInfo_MDL)Comm.GetValueToObject(userMDL, tLoginInfo);
                    userMDL.RoleID        = roleBLL.GetRoleIdByRoleCode(SystemSet._ROLECODE_JSCOMPANY, singleProjectMDL.AREA_CODE);
                    userMDL.Passwd        = DESEncrypt.Encrypt(Passwd.Text);
                    userMDL.UserType      = SystemSet.EumUserType.CompanyUser.ToString();
                    userMDL.UserName      = userMDL.LoginName;
                    userMDL.CompanyID     = companyID;
                    userMDL.Createdate    = DateTime.Now;
                    userMDL.LastLoginTime = DateTime.Now;
                    userMDL.IsLeader      = true;
                    userMDL.IsValid       = false;
                    userMDL.Createdby     = "工程报建产生";
                    int userID = userBLL.Add(userMDL);
                    #endregion

                    #region 添加工程用户关联信息
                    PublicModel.AddSingleProjectUser(singleProjectID, userMDL.RoleID, userID);
                    #endregion

                    #region 添加工程公司关联信息
                    PublicModel.AddSingleProjectCompany(singleProjectID, companyID);
                    #endregion

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

                    #region 更新工程表的 CompanyUserID为当前建设单位用户ID
                    singleProjectMDL = singleProjectBLL.GetModel(singleProjectID);
                    singleProjectMDL.CompanyUserID = userID;
                    singleProjectBLL.Update(singleProjectMDL);
                    #endregion

                    #region 报建完成提示信息
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "IsSuccess",
                                                                 "<script>"
                                                                 + " layer.alert('您已经成功注册,但您注册的信息,必需确认后才可以登录使用。请耐心等待,或致电:" + SystemSet._QUICKREGTEL + "', { btnAlign: 'c' }, function (i) {"
                                                                 + "     var index = parent.layer.getFrameIndex(window.name);"
                                                                 + "     parent.layer.close(index);"
                                                                 + "}); "
                                                                 + "</script>");
                    #endregion
                }
            } catch (Exception ex) {
                Common.LogUtil.Debug(this, "建设单位工程报建", ex);
                Common.MessageBox.FnLayerAlert(this.Page, "工程报建保存失败:" + ex.Message);
            }
        }