Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Request["id"]))
            {
                Response.Write("无参数");
                Response.End();
                return;
            }
            model = bll.Get <WBCompanyInfo>(string.Format("AutoID={0}", Request["id"]));
            if (model == null)
            {
                Response.Write("企业不存在");
                Response.End();
                return;
            }
            if (model.IsDisable.Equals(1))
            {
                Response.Write("此企业已经禁用,暂时不能查看");
                Response.End();
                return;
            }

            if (DataLoadTool.CheckWanBangLogin())
            {
                IsLogin = true;
                if (bll.GetCount <WBAttentionInfo>(string.Format("UserId='{0}' And AttentionAutoID={1} And AttentionType={2}", HttpContext.Current.Session[SessionKey.WanBangUserID].ToString(), model.AutoID, 1)) > 0)
                {
                    IsAttention = true;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取我收藏的企业列表
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string GetAttentionCompanyList(HttpContext context)
        {
            int pageIndex = int.Parse(context.Request["PageIndex"]);
            int pageSize  = int.Parse(context.Request["PageSize"]);

            int           totalCount = 0;
            StringBuilder sbWhere    = new StringBuilder(string.Format(" UserId='{0}' And AttentionType=1", HttpContext.Current.Session[SessionKey.WanBangUserID].ToString()));

            totalCount = bll.GetCount <WBAttentionInfo>(sbWhere.ToString());
            List <WBAttentionInfo> data    = bll.GetLit <WBAttentionInfo>(pageSize, pageIndex, sbWhere.ToString(), "AutoID DESC");
            List <WBCompanyInfo>   NewData = new List <WBCompanyInfo>();

            foreach (var item in data)
            {
                WBCompanyInfo model = bll.Get <WBCompanyInfo>(string.Format("AutoID={0}", item.AttentionAutoID));
                if (model != null)
                {
                    model.UserId       = null;
                    model.Password     = null;
                    model.Introduction = null;
                    NewData.Add(model);
                }
            }
            resp.ExObj = NewData;
            resp.ExStr = "";
            int totalpage = bll.GetTotalPage(totalCount, pageSize);

            if ((totalpage > pageIndex) && (pageIndex.Equals(1)))
            {
                resp.ExStr = "1";//是否增加下一页按钮
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string EditCompanyInfo(HttpContext context)
        {
            int    autoId                = int.Parse(context.Request["AutoID"]);
            string companyName           = context.Request["CompanyName"];
            string thumbnails            = context.Request["Thumbnails"];
            string address               = context.Request["Address"];
            string area                  = context.Request["Area"];
            string tel                   = context.Request["Tel"];
            string phone                 = context.Request["Phone"];
            string qq                    = context.Request["QQ"];
            string contacts              = context.Request["Contacts"];
            string businessLicenseNumber = context.Request["BusinessLicenseNumber"];
            string userId                = context.Request["UserId"];
            string password              = context.Request["Password"];
            string isDisable             = context.Request["IsDisable"];
            string introduction          = context.Request["Introduction"];

            if (bll.GetCount <WBCompanyInfo>(string.Format("UserId='{0}' And AutoID!={1}", userId, autoId)) > 0)
            {
                resp.Status = 0;
                resp.Msg    = "用户名已经存在";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (bll.GetCount <WBBaseInfo>(string.Format("UserId='{0}'", userId)) > 0)
            {
                resp.Status = 0;
                resp.Msg    = "此用户名在基地列表中已经存在";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            WBCompanyInfo model = bll.Get <WBCompanyInfo>(string.Format("AutoID={0}", autoId));

            model.CompanyName           = companyName;
            model.Thumbnails            = thumbnails;
            model.Address               = address;
            model.Area                  = area;
            model.Tel                   = tel;
            model.Phone                 = phone;
            model.QQ                    = qq;
            model.Contacts              = contacts;
            model.BusinessLicenseNumber = businessLicenseNumber;
            model.UserId                = userId;
            model.Password              = password;
            model.IsDisable             = int.Parse(isDisable);
            model.Introduction          = introduction;
            if (bll.Update(model))
            {
                resp.Status = 1;
                resp.Msg    = "更新企业信息成功";
            }
            else
            {
                resp.Msg = "更新企业信息失败";
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取项目列表
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string GetProjectList(HttpContext context)
        {
            int           pageIndex   = int.Parse(context.Request["PageIndex"]);
            int           pageSize    = int.Parse(context.Request["PageSize"]);
            string        projectName = context.Request["ProjectName"];
            string        area        = context.Request["Area"];
            string        category    = context.Request["Category"];
            int           totalCount  = 0;
            StringBuilder sbWhere     = new StringBuilder(string.Format(" Status in(1,2) And WebsiteOwner='{0}' ", bll.WebsiteOwner));

            if (!string.IsNullOrEmpty(projectName))
            {
                sbWhere.AppendFormat(" And ProjectName like '%{0}%'", projectName);
            }
            if (!string.IsNullOrEmpty(area))
            {
                sbWhere.AppendFormat(" And Area='{0}'", area);
            }
            if (!string.IsNullOrEmpty(category))
            {
                sbWhere.AppendFormat(" And Category='{0}'", category);
            }
            totalCount = bll.GetCount <WBProjectInfo>(sbWhere.ToString());
            List <WBProjectInfo>    data    = bll.GetLit <WBProjectInfo>(pageSize, pageIndex, sbWhere.ToString(), " Status ASC,AutoID DESC");
            List <ProjectInfoModel> newData = new List <ProjectInfoModel>();

            foreach (var item in data)
            {
                ProjectInfoModel model = new ProjectInfoModel();
                model.AutoID        = item.AutoID;
                model.ProjectName   = item.ProjectName;
                model.Thumbnails    = item.Thumbnails;
                model.Area          = item.Area;
                model.Category      = item.Category;
                model.ProjectCycle  = item.ProjectCycle;
                model.Status        = item.Status;
                model.InsertDate    = string.Format("{0:f}", item.InsertDate);
                model.InsertDateStr = item.InsertDateStr;
                WBCompanyInfo CompanyInfo = bll.Get <WBCompanyInfo>(string.Format("UserId='{0}'", item.UserId));
                if (CompanyInfo != null)
                {
                    model.CompanyName = CompanyInfo.CompanyName;
                }
                newData.Add(model);
            }
            resp.ExObj = newData;
            resp.ExStr = "";
            int totalpage = bll.GetTotalPage(totalCount, pageSize);

            if ((totalpage > pageIndex) && (pageIndex.Equals(1)))
            {
                resp.ExStr = "1";//是否增加下一页按钮
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!DataLoadTool.CheckWanBangLogin())
     {
         Response.Redirect(string.Format("/App/WanBang/Wap/Login.aspx?redirecturl={0}", Request.Url.PathAndQuery));
     }
     if (HttpContext.Current.Session[SessionKey.WanBangUserType].ToString().Equals("0"))
     {
         Response.Write("<script>alert('只有企业用户可以访问');window.location.href='Index.aspx';</script>");
         Response.End();//只有企业能访问
     }
     model = bll.Get <WBCompanyInfo>(string.Format("UserId='{0}'", HttpContext.Current.Session[SessionKey.WanBangUserID].ToString()));
 }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     webAction = Request["Action"];
     actionStr = webAction == "add" ? "添加" : "编辑";
     if (webAction == "edit")
     {
         model = bll.Get <WBCompanyInfo>(string.Format("AutoID={0}", Convert.ToInt32(Request["id"])));
         if (model == null)
         {
             Response.End();
         }
         else
         {
         }
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// 更新企业信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string UpdateCompanyInfo(HttpContext context)
        {
            if (!DataLoadTool.CheckWanBangLogin())
            {
                resp.Msg = "请先登录";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (HttpContext.Current.Session[SessionKey.WanBangUserType].ToString().Equals("0"))
            {
                resp.Msg = "您不是企业用户,无法修改";
                return(Common.JSONHelper.ObjectToJson(resp));
            }

            string baseName              = context.Request["CompanyName"];
            string thumbnails            = context.Request["Thumbnails"];
            string address               = context.Request["Address"];
            string area                  = context.Request["Area"];
            string tel                   = context.Request["Tel"];
            string phone                 = context.Request["Phone"];
            string qq                    = context.Request["QQ"];
            string contacts              = context.Request["Contacts"];
            string businessLicenseNumber = context.Request["BusinessLicenseNumber"];
            string introduction          = context.Request["Introduction"];

            WBCompanyInfo model = bll.Get <WBCompanyInfo>(string.Format("UserId='{0}'", HttpContext.Current.Session[SessionKey.WanBangUserID].ToString()));

            model.CompanyName           = baseName;
            model.Thumbnails            = thumbnails;
            model.Address               = address;
            model.Area                  = area;
            model.Tel                   = tel;
            model.Phone                 = phone;
            model.QQ                    = qq;
            model.Contacts              = contacts;
            model.BusinessLicenseNumber = businessLicenseNumber;
            model.Introduction          = introduction;
            if (bll.Update(model))
            {
                resp.Status = 1;
                resp.Msg    = "更新企业信息成功";
            }
            else
            {
                resp.Msg = "更新企业信息失败";
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(Request["id"]))
                {
                    Response.Write("无参数");
                    Response.End();
                    return;
                }
                model = bll.Get <WBProjectInfo>(string.Format("AutoId={0}", Request["id"]));
                if (model == null)
                {
                    Response.Write("项目不存在");
                    Response.End();
                    return;
                }
                if (model.Status.Equals(0))
                {
                    Response.Write("项目正在审核中,暂时不能查看");
                    Response.End();
                    return;
                }

                companymodel = bll.Get <WBCompanyInfo>(string.Format("UserId='{0}'", model.UserId));
                if (DataLoadTool.CheckWanBangLogin())
                {
                    IsLogin = true;
                    if (bll.GetCount <WBAttentionInfo>(string.Format("UserId='{0}' And AttentionAutoID={1} And AttentionType={2}", HttpContext.Current.Session[SessionKey.WanBangUserID].ToString(), model.AutoID, 2)) > 0)
                    {
                        IsAttention = true;
                    }
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string AddCompanyInfo(HttpContext context)
        {
            string companyName           = context.Request["CompanyName"];
            string thumbnails            = context.Request["Thumbnails"];
            string address               = context.Request["Address"];
            string area                  = context.Request["Area"];
            string tel                   = context.Request["Tel"];
            string phone                 = context.Request["Phone"];
            string qq                    = context.Request["QQ"];
            string contacts              = context.Request["Contacts"];
            string businessLicenseNumber = context.Request["BusinessLicenseNumber"];
            string helpCount             = context.Request["HelpCount"];
            string userId                = context.Request["UserId"];
            string password              = context.Request["Password"];
            string isDisable             = context.Request["IsDisable"];
            string introduction          = context.Request["Introduction"];

            if (bll.GetCount <WBCompanyInfo>(string.Format("UserId='{0}'", userId)) > 0)
            {
                resp.Status = 0;
                resp.Msg    = "用户名已经存在";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (bll.GetCount <WBCompanyInfo>(string.Format("CompanyName='{0}'", companyName)) > 0)
            {
                resp.Status = 0;
                resp.Msg    = "企业已经存在";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (bll.GetCount <WBBaseInfo>(string.Format("UserId='{0}'", userId)) > 0)
            {
                resp.Status = 0;
                resp.Msg    = "此用户名在基地列表中已经存在";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            WBCompanyInfo model = new WBCompanyInfo();

            model.CompanyName           = companyName;
            model.Thumbnails            = thumbnails;
            model.Address               = address;
            model.Area                  = area;
            model.Tel                   = tel;
            model.Phone                 = phone;
            model.QQ                    = qq;
            model.Contacts              = contacts;
            model.BusinessLicenseNumber = businessLicenseNumber;
            model.UserId                = userId;
            model.Password              = password;
            model.IsDisable             = int.Parse(isDisable);
            model.Introduction          = introduction;
            model.InsertDate            = DateTime.Now;
            model.WebsiteOwner          = bll.WebsiteOwner;
            if (bll.Add(model))
            {
                resp.Status = 1;
                resp.Msg    = "添加企业成功";
            }
            else
            {
                resp.Msg = "添加企业失败";
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }