示例#1
0
        public JsonResult GetCompanyByFlow(string Id)
        {
            var FlowModel    = Bll.LoadData(Id);
            var companyModel = new ModSysCompany();
            var MasterModel  = new ModSysMaster();

            if (FlowModel.FlowType != 3)
            {
                companyModel = new BllSysCompany().LoadData(FlowModel.CompanyId);
                MasterModel  = new BllSysMaster().Get(FlowModel.MasterId);
            }
            else
            {
                MasterModel  = new BllSysMaster().Get(FlowModel.ApprovalUser);//申请人编号
                companyModel = new BllSysCompany().LoadData(MasterModel.Cid);
            }
            Hashtable ht = new Hashtable();

            ht.Add("Introduction", FlowModel.Reamrk);
            //公司信息
            if (companyModel != null)
            {
                ht.Add("Name", companyModel.Name);         //公司名称
                ht.Add("Address", companyModel.Address);   //地址
                ht.Add("LinkUser", companyModel.LinkUser); //联系 人
                ht.Add("Phone", companyModel.Phone);       //联系电话
                ht.Add("Attribute", companyModel.Attribute);
            }
            if (MasterModel != null)
            {
                ht.Add("LoginName", MasterModel.LoginName);
            }
            return(Json(new { data = ht }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public void SaveRegedit()
        {
            ModJsonResult json = new ModJsonResult();

            ModSysMaster  master = new ModSysMaster();
            ModSysCompany t      = new ModSysCompany();

            #region ===获取管理员信息
            string nickName  = Request.Params["UserName"];
            string LoginName = Request.Params["LoginName"];
            string Pwd       = Request.Params["pwd"];
            master.Pwd = (string.IsNullOrEmpty(Pwd) ? DESEncrypt.Encrypt("666666") : DESEncrypt.Encrypt(Pwd));
            #endregion

            string UserType       = Request["UserType"].ToString();    //用户类型
            string HidCompanyType = Request["CompanyType"].ToString(); //单位类型

            t.Id = Guid.NewGuid().ToString();

            master.Id        = Guid.NewGuid().ToString();
            master.Cid       = t.Id;
            master.IsSystem  = true;
            master.IsMain    = true;
            master.CreaterId = "";
            master.UserName  = nickName;
            master.LoginName = LoginName;
            master.Phone     = LoginName;
            master.Email     = "";
            master.Phone     = LoginName;
            master.Status    = (int)StatusEnum.未激活;

            new BllSysMaster().ClearCache();

            string titleTip = "";
            if (int.Parse(UserType) == 1)//普通用户
            {
                switch (int.Parse(HidCompanyType))
                {
                case 1:     //社会单位
                    master.Attribute = (int)AdminTypeEnum.单位用户;
                    titleTip         = "单位用户";
                    break;

                case 3:     //消防单位
                    master.Attribute = (int)AdminTypeEnum.消防用户;
                    titleTip         = "消防用户";
                    break;

                case 4:    //维保公司
                    master.Attribute = (int)AdminTypeEnum.维保用户;
                    titleTip         = "维保用户";
                    break;

                case 5:    //器材供应商
                    master.Attribute = (int)AdminTypeEnum.供应商用户;
                    titleTip         = "供应商用户";
                    break;
                }

                string CompanyCode = Request["CompanyCode"].ToString(); //单位编号
                string DeptCode    = Request["DeptCode"].ToString();    //部门编号

                master.OrganizaId = DeptCode;
                master.Cid        = CompanyCode;//公司编号

                int result = new BllSysMaster().Insert(master);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = " 保存失败,请稍后再操作!";
                }
                else
                {
                    //保存用户与单位之间的关系
                    ModSysFlow SysFlow = new ModSysFlow();
                    SysFlow.Id           = Guid.NewGuid().ToString();
                    SysFlow.Title        = titleTip + ":" + nickName + " 注册申请";
                    SysFlow.FlowType     = 2;//(1:单位管理员注册时的审核 2:普通用户注册审核  3:用户单位变更审核)
                    SysFlow.FlowStatus   = 0;
                    SysFlow.Reamrk       = "";
                    SysFlow.ApprovalUser = master.Id;
                    SysFlow.ApprovalTime = DateTime.Now;
                    SysFlow.CompanyId    = CompanyCode;
                    SysFlow.MasterId     = master.Id;
                    int count = new BllSysFlow().Insert(SysFlow);
                    if (count <= 0)
                    {
                        json.success = false;
                        json.msg     = "用户同步流程失败,请稍后再操作!";
                        new BllSysMaster().Delete(master.Id);
                    }
                    else
                    {
                        json.success = true;
                    }
                }
            }
            else
            {
                switch (int.Parse(HidCompanyType))
                {
                case 1:     //社会单位
                    master.Attribute = (int)AdminTypeEnum.单位管理员;
                    t.Attribute      = (int)CompanyType.单位;
                    titleTip         = "社会单位";
                    break;

                case 3:     //消防单位
                    master.Attribute = (int)AdminTypeEnum.消防部门管理员;
                    t.Attribute      = (int)CompanyType.消防部门;
                    titleTip         = "消防单位";
                    break;

                case 4:    //维保公司
                    master.Attribute = (int)AdminTypeEnum.维保公司管理员;
                    t.Attribute      = (int)CompanyType.维保公司;
                    titleTip         = "维保单位";
                    break;

                case 5:    //器材供应商
                    master.Attribute = (int)AdminTypeEnum.供应商管理员;
                    t.Attribute      = (int)CompanyType.供应商;
                    titleTip         = "供应商";
                    break;
                }
                master.IsMain     = true;
                master.OrganizaId = "0";//部门编号
                int result = new BllSysMaster().Insert(master);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = " 保存失败,请稍后再操作!";
                }
                else
                {
                    string x           = Request.Params["Bx"];
                    string y           = Request.Params["By"];
                    string CompanyName = Request["CompanyName"].ToString(); //用户类型
                    string Address     = Request["Address"].ToString();     //用户类型
                    string LinkUser    = Request["LinkUser"].ToString();    //用户类型
                    string LinkPhone   = Request["LinkPhone"].ToString();   //用户类型

                    t.Phone           = LinkPhone;
                    t.LinkUser        = LinkUser;
                    t.Address         = Address;
                    t.Name            = CompanyName;
                    t.CompLat         = x;
                    t.ComPLon         = y;
                    t.Status          = (int)StatusEnum.未激活;
                    t.CreaterUserId   = "";
                    t.CreateTime      = DateTime.Now;
                    t.ProPic          = "/UploadFile/CompanyProPic/default_img_company.png";
                    t.MasterId        = master.Id;
                    t.CreateCompanyId = "0";
                    t.RegisiTime      = DateTime.Now;//公司注册时间

                    result = new BllSysCompany().Insert(t);

                    if (result <= 0)
                    {
                        json.msg = "保存公司失败,请稍后再操作!";
                        new BllSysMaster().Delete(master.Id);
                    }
                    else
                    {
                        //保存用户与单位之间的关系
                        ModSysFlow SysFlow = new ModSysFlow();
                        SysFlow.Id           = Guid.NewGuid().ToString();
                        SysFlow.Title        = titleTip + ":" + CompanyName + "注册申请";
                        SysFlow.FlowType     = 1;//(1:单位管理员注册时的审核 2:普通用户注册审核  3:用户单位变更审核)
                        SysFlow.FlowStatus   = 0;
                        SysFlow.Reamrk       = "";
                        SysFlow.ApprovalUser = master.Id;
                        SysFlow.ApprovalTime = DateTime.Now;
                        SysFlow.CompanyId    = t.Id;
                        SysFlow.MasterId     = master.Id;
                        int count = new BllSysFlow().Insert(SysFlow);
                        if (count <= 0)
                        {
                            json.msg     = "用户同步流程失败,请稍后再操作!";
                            json.success = false;
                            new BllSysMaster().Delete(master.Id);
                            new BllSysCompany().Delete(t.Id);
                        }
                        else
                        {
                            json.success = true;
                        }
                    }
                }
            }
            Response.Write(json.ToString());
            Response.End();
        }