Esempio n. 1
0
        public JsonResult AddOrEditSysUser(SysAdminUser sysUser)
        {
            SysAdminUserService userService       = new SysAdminUserService();
            WebCompanyService   webCompanyService = new WebCompanyService();
            int        companyID = sysUser.CompanyID != null ? (int)sysUser.CompanyID : 0;
            WebCompany company   = webCompanyService.GetWebCompanyByID(companyID);

            if (company != null)
            {
                sysUser.CompanyName = company.CompanyName;
            }
            int result = 0;

            if (sysUser.UserID > 0)
            {
                result = userService.UpdateAdminUser(sysUser);
            }
            else
            {
                sysUser.UserPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(sysUser.UserPassword, "md5");
                result = userService.AddAdminUser(sysUser);
            }
            return(Json(new { RetCode = result }));
        }
        /// <summary>
        /// 获取案例分页
        /// </summary>
        public void GetDecCaseList()
        {
            int    pageIndex        = string.IsNullOrEmpty(context.Request["pageIndex"]) ? 1 : Convert.ToInt32(context.Request["pageIndex"]);
            int    PageSize         = Convert.ToInt32(context.Request["PageSize"]);
            int    companyID        = string.IsNullOrEmpty(context.Request["companyID"]) ? 0 : Convert.ToInt32(context.Request["companyID"]);
            int    peopleID         = string.IsNullOrEmpty(context.Request["peopleID"]) ? 0 : Convert.ToInt32(context.Request["peopleID"]);
            int    style            = Convert.ToInt32(context.Request["styleid"]);
            int    housetype        = Convert.ToInt32(context.Request["housetypeid"]);
            int    costarea         = Convert.ToInt32(context.Request["costareaid"]);
            int    housearea        = Convert.ToInt32(context.Request["houseareaid"]);
            int    gzstyleid        = Convert.ToInt32(context.Request["gzstyleid"]);
            int    DecType          = string.IsNullOrEmpty(context.Request["DecType"]) ? 0 : Convert.ToInt32(context.Request["DecType"]);
            string SortOrder        = context.Request["SortOrder"];
            string SortParameters   = "";
            string SelectParameters = "";
            int    pageCount        = 0;
            int    recordcount      = 0;

            SelectParameters = string.Format("[CaseID],[CaseTitle],[CaseBrief],[CaseInfo],[CompanyID],[PeopleID],[thumbnailImage],[CaseImageBig],[IsTop],[ShowOrder],[DecType]," +
                                             "(select description from WebLookup where code=WebCase.Style and lookup_key='Case_style') as [StyleName]," +
                                             "(select description from WebLookup where code=WebCase.HouseType and lookup_key='Case_house_type') as [HouseTypeName]," +
                                             "(select description from WebLookup where code=WebCase.HouseArea and lookup_key='Case_house_area') as [HouseAreaName]," +
                                             "(select description from WebLookup where code=WebCase.CostArea and lookup_key='Case_cost_area') as [CostAreaName]," +
                                             "(select description from WebLookup where code=WebCase.GzStyle and lookup_key='Case_gz_style') as [GzStyleName]," +
                                             "(select description from WebLookup where code=WebCase.DecType and lookup_key='Case_DecType') as [DecTypeName]," +
                                             "[PageViewCount],[CollectCount],[ZanCount],[CommentCount],[AddOn]");

            SortParameters = string.Format(" FlagDelete=0 {0} {1} {2} {3} {4} {5} {6} {7}",
                                           companyID == 0 ? "" : "and companyID=" + companyID,
                                           style == 0 ? "" : "and style=" + style,
                                           housetype == 0 ? "" : "and housetype=" + housetype,
                                           costarea == 0 ? "" : "and costarea=" + costarea,
                                           housearea == 0 ? "" : "and housearea=" + housearea,
                                           gzstyleid == 0 ? "": "and GzStyle=" + gzstyleid,
                                           DecType == 0 ? "" : "and DecType=" + DecType,
                                           peopleID == 0 ? "" : "and PeopleID=" + peopleID);

            Pagination paginfo = new Pagination();

            paginfo.PageIndex        = pageIndex;
            paginfo.PageSize         = PageSize;
            paginfo.EntityName       = "WebCase";
            paginfo.SelectParameters = SelectParameters;
            paginfo.SortParameters   = SortParameters;
            paginfo.SortOrder        = SortOrder + "AddOn desc,CaseID desc";
            var result = PageList.GetPageListBySQL <WebCasePage>(paginfo, out recordcount, out pageCount);
            List <WebCaseAndDesigner> list = new List <WebCaseAndDesigner>();

            if (result != null)
            {
                foreach (WebCasePage item in result)
                {
                    WebCaseAndDesigner cadec = new WebCaseAndDesigner();
                    cadec.webcase = item;
                    if (item.PeopleID == 0)
                    {
                        cadec.designer = new WebPeople();
                    }
                    else
                    {
                        cadec.designer = webPeopleService.GetWebPeopleByID(item.PeopleID);
                    }
                    if (item.CompanyID == 0)
                    {
                        cadec.company = new WebCompany();
                    }
                    else
                    {
                        cadec.company = webCompanyService.GetWebCompanyByID(item.CompanyID);
                    }
                    list.Add(cadec);
                }
            }


            var obj = new
            {
                list        = list,
                recordcount = recordcount,
                pageCount   = pageCount
            };
            string msg = JsonConvert.SerializeObject(obj);

            context.Response.Write(msg);
        }
Esempio n. 3
0
        public ActionResult _CompanyTuBaHead(int companyID)
        {
            WebCompany company = webCompanyService.GetWebCompanyByID(companyID);

            return(View(company));
        }