예제 #1
0
        public void SaveData(ModSysCompany t)
        {
            ModJsonResult json = new ModJsonResult();

            t.LinkUser    = (t.LinkUser == null ? "" : t.LinkUser);
            t.LegalPerson = (t.LegalPerson == null ? "" : t.LegalPerson);
            t.CompLat     = (t.CompLat == null ? "" : t.CompLat);
            t.ComPLon     = (t.ComPLon == null ? "" : t.ComPLon);

            if (!string.IsNullOrEmpty(Request["modify"])) //修改
            {
                ModSysCompany model = bll.LoadData(t.Id);
                model.Name         = t.Name;
                model.LegalPerson  = t.LegalPerson;
                model.LinkUser     = t.LinkUser;
                model.Address      = t.Address;
                model.CompLat      = t.CompLat;
                model.ComPLon      = t.ComPLon;
                model.Code         = t.Code;
                model.ReegistMoney = t.ReegistMoney;
                model.Phone        = t.Phone;
                model.Email        = t.Email;
                model.Introduction = t.Introduction;

                int result = bll.Update(model);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = "修改失败,请稍后再操作!";
                }
            }
            else
            {
                t.Id            = Guid.NewGuid().ToString();
                t.Status        = (int)StatusEnum.正常;
                t.CreaterUserId = CurrentMaster.Id;
                t.CreateTime    = DateTime.Now;
                if (t.Attribute == (int)CompanyType.维保公司)//集团
                {
                    t.Path = t.Id;
                }
                else
                {
                    t.Path = t.Path + "," + t.Id;
                }
                int result = bll.Insert(t);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = " 保存失败,请稍后再操作!";
                }
            }
            WriteJsonToPage(json.ToString());
        }
예제 #2
0
        public void SaveData(ModSysCompany mod)
        {
            try
            {
                ModSysMaster master = new ModSysMaster();

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

                mod.CompLat = (mod.CompLat == null ? "" : mod.CompLat);
                mod.ComPLon = (mod.ComPLon == null ? "" : mod.ComPLon);

                int result = 0;
                if (!string.IsNullOrEmpty(Request["modify"])) //修改
                {
                    ModSysCompany model = bll.LoadData(mod.Id);
                    model.Name          = mod.Name;         //公司名称
                    model.LegalPerson   = mod.LegalPerson;
                    model.LinkUser      = mod.LinkUser;     //联系人
                    model.Address       = mod.Address;      //公司地址
                    model.Code          = mod.Code;
                    model.ReegistMoney  = mod.ReegistMoney; //注册资金
                    model.Phone         = mod.Phone;        //公司电话
                    model.Email         = mod.Email;        //邮箱
                    model.Introduction  = mod.Introduction; //公司介绍
                    model.CompLat       = mod.CompLat;
                    model.ComPLon       = mod.ComPLon;
                    model.Nature        = mod.Nature;      //公司分类
                    model.Type          = mod.Type;        //公司性质
                    model.LegalPerson   = mod.LegalPerson; //法人
                    model.Pact          = mod.Pact;        //合同
                    model.LicenseNumber = mod.LicenseNumber;

                    model.Province = mod.Province;
                    model.CityId   = mod.CityId;
                    model.AreaId   = mod.AreaId;

                    result = bll.Update(model);
                    if (result <= 0)
                    {
                        json.success = false;
                        json.msg     = "修改失败,请稍后再操作!";
                    }
                    else
                    {
                        BllSysMaster newMaster = new BllSysMaster();
                        master           = newMaster.LoadData(Request.Params["UID"]);
                        master.UserName  = UserName;
                        master.LoginName = LoginName;
                        master.Email     = UserEmail;
                        master.Phone     = UserPhone;
                        master.Id        = Request.Params["UID"];
                        master.Pwd       = Pwd;
                        newMaster.Update(master);
                    }
                }
                else
                {
                    mod.Id            = Guid.NewGuid().ToString();
                    master.Pwd        = Pwd;
                    master.Id         = Guid.NewGuid().ToString();
                    master.Status     = (int)StatusEnum.正常;
                    master.IsMain     = true;
                    master.Cid        = mod.Id;
                    master.IsSystem   = true;
                    master.CreaterId  = CurrentMaster.Id;
                    master.UserName   = UserName;
                    master.LoginName  = LoginName;
                    master.Email      = UserEmail;
                    master.Phone      = UserPhone;
                    master.OrganizaId = "0";
                    master.Attribute  = (int)AdminTypeEnum.供应商管理员;
                    new BllSysMaster().ClearCache();
                    result = new BllSysMaster().Insert(master);
                    if (result > 0)
                    {
                        mod.Attribute       = (int)CompanyType.供应商;
                        mod.CreateCompanyId = CurrentMaster.Cid;
                        mod.CreateTime      = DateTime.Now;
                        mod.CreaterUserId   = CurrentMaster.Id;

                        mod.Status   = (int)StatusEnum.正常;
                        mod.Path     = "1," + CurrentMaster.Company.CreateCompanyId + "," + CurrentMaster.Cid;
                        mod.ProPic   = "/UploadFile/CompanyProPic/default_img_company.png";
                        mod.MasterId = master.Id;
                        result       = bll.Insert(mod);
                        if (result <= 0)
                        {
                            new BllSysMaster().Delete(master.Id);
                        }
                    }
                    if (result <= 0)
                    {
                        json.success = false;
                        json.msg     = " 保存失败,请稍后再操作!";
                    }
                }
            }
            catch (Exception)
            {
                json.msg     = "保存失败!";
                json.success = false;
            }

            WriteJsonToPage(json.ToString());
        }
예제 #3
0
        public void SaveData(ModSysCompany t)
        {
            ModJsonResult json = new ModJsonResult();

            ModSysMaster master = new ModSysMaster();

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


            t.LinkUser    = (t.LinkUser == null ? "" : t.LinkUser);
            t.LegalPerson = (t.LegalPerson == null ? "" : t.LegalPerson);
            t.CompLat     = (t.CompLat == null ? "" : t.CompLat);
            t.ComPLon     = (t.ComPLon == null ? "" : t.ComPLon);

            string x = Request.Params["x"];
            string y = Request.Params["y"];


            if (!string.IsNullOrEmpty(Request["modify"])) //修改
            {
                ModSysCompany model = bll.LoadData(t.Id);
                model.Name         = t.Name;
                model.LegalPerson  = t.LegalPerson;
                model.LinkUser     = t.LinkUser;
                model.Address      = t.Address;
                model.CompLat      = t.CompLat;
                model.ComPLon      = t.ComPLon;
                model.Code         = t.Code;
                model.ReegistMoney = t.ReegistMoney;
                model.Phone        = t.Phone;
                model.Email        = t.Email;
                model.Introduction = t.Introduction;
                model.LawyerPhone  = t.LawyerPhone;
                model.LawyerName   = t.LawyerName;
                model.CompLat      = t.CompLat;
                model.ComPLon      = t.ComPLon;
                model.Province     = t.Province;
                model.CityId       = t.CityId;
                model.AreaId       = t.AreaId;
                model.Nature       = t.Nature; //公司分类
                model.Type         = t.Type;   //公司性质
                model.RegisiTime   = t.RegisiTime;

                int result = bll.Update(model);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = "修改失败,请稍后再操作!";
                }
                else
                {
                    BllSysMaster newMaster = new BllSysMaster();
                    master           = newMaster.LoadData(Request.Params["UID"]);
                    master.UserName  = UserName;
                    master.Pwd       = Pwd;
                    master.LoginName = LoginName;
                    master.Email     = UserEmail;
                    master.Phone     = UserPhone;
                    master.Id        = Request.Params["UID"];
                    newMaster.Update(master);
                }
            }
            else
            {
                t.Id              = Guid.NewGuid().ToString();
                master.Id         = Guid.NewGuid().ToString();
                master.Status     = (int)StatusEnum.正常;
                master.IsMain     = true;
                master.Cid        = t.Id;
                master.IsSystem   = true;
                master.Pwd        = Pwd;
                master.CreaterId  = CurrentMaster.Id;
                master.UserName   = UserName;
                master.LoginName  = LoginName;
                master.Email      = UserEmail;
                master.Phone      = UserPhone;
                master.OrganizaId = "0";
                master.Attribute  = (int)AdminTypeEnum.单位管理员;
                new BllSysMaster().ClearCache();
                int result = new BllSysMaster().Insert(master);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = " 保存失败,请稍后再操作!";
                }
                else
                {
                    t.Status          = (int)StatusEnum.正常;
                    t.CreaterUserId   = CurrentMaster.Id;
                    t.CreateTime      = DateTime.Now;
                    t.Attribute       = (int)CompanyType.单位;
                    t.Path            = "1," + CurrentMaster.Cid;
                    t.ProPic          = "/UploadFile/CompanyProPic/default_img_company.png";
                    t.MasterId        = master.Id;
                    t.CreateCompanyId = "0";
                    t.RegisiTime      = DateTime.Now;//公司注册时间

                    result = bll.Insert(t);
                    if (result <= 0)
                    {
                        new BllSysMaster().Delete(master.Id);
                    }
                }
            }
            WriteJsonToPage(json.ToString());
        }