예제 #1
0
 public void add(JabinfoContext context,string parentId)
 {
     if (context.IsPost) {
         string keyword = context.Post ["keyword"].Trim ();
         context.Post ["categoryId"] = Jabinfo.Help.Basic.AutoId ("cat_tag");
         foreach (string name in context.Files.AllKeys) {
             if (context.Files [name].ContentLength > 5) {
                 System.Web.HttpPostedFile temp = context.Files [name];
                 Jabinfo.Help.Image.Save (string.Format ("{0}_{1}", context.Post ["categoryId"], name.Split ('_') [1]), context.Files [name]);
             }
         }
         if (context.Post ["parentId"].Length > 1) {
             CategoryVO categoryVO = CategoryMapper.I.Create (context.Post ["parentId"]);
             if (categoryVO.categoryId == null) {
                 context.Jump ("/crm/category/home/" + parentId, "添加失败,不存在父级分类");
                 return;
             }
             if (categoryVO.childen == "0") {
                 JabinfoKeyValue data = new JabinfoKeyValue ();
                 data ["categoryId"] = context.Post ["parentId"];
                 data ["childen"] = "1";
                 CategoryMapper.I.UpdateByPrimary (data);
             }
             JabinfoKeyValue cate_Data = new JabinfoKeyValue ();
             context.Post ["childen"] = (Convert.ToInt32 (categoryVO.childen) + 1).ToString ();
         }
         CategoryMapper.I.Insert (context.Post);
         context.Jump ("/crm/category/home/" + parentId, "添加成功");
         return;
     }
     context.Variable["parentId"] = parentId;
 }
예제 #2
0
 public void add(JabinfoContext context,string categoryId)
 {
     if (!context.IsPost) {
         context.Variable["categoryId"] = categoryId;
         context.Variable ["now"] = Jabinfo.Help.Date.Now;
         return;
     }
     context.Post ["articleId"] = Jabinfo.Help.Basic.JabId;
     context.Post ["pubtime"] = Jabinfo.Help.Date.StringToDate (context.Post ["pubtime"]).ToString ();
     context.Post ["uid"] = context.Role.Uid;
     //上传图片
     if (context.Files["image"] != null && context.Files["image"].ContentLength > 10)
     {
         Jabinfo.Help.Image.Save(context.Post["articleId"], context.Files["image"]);
         JabinfoKeyValue sizes = Jabinfo.Help.Config.Get("article.photosize");
         foreach (string key in sizes.Keys)
         {
             string[] size = sizes[key].Split('x');
             Jabinfo.Help.Image.Resize(string.Format("{0}_{1}", context.Post["articleId"], key), context.Post["articleId"], Convert.ToInt32(size[0]), Convert.ToInt32(size[1]));
         }
         context.Post["attach"] = "1";//有预览图
     }
     else
     {
         context.Post["attach"] = "0";
     }
     //上传文件
     if (context.Files["afile"] != null && context.Files["afile"].ContentLength > 10)
     {
         string fileName = context.Files["afile"].FileName;
         context.Post["model"] = fileName.Substring(fileName.LastIndexOf('.') + 1);
         Jabinfo.Help.Upload.Save(context.Post["article_id"] + "_file", context.Files["afile"], context.Post["model"]);
     }
     if (string.IsNullOrEmpty(context.Post["summary"]))
     {
         string content = Jabinfo.Help.Formate.HtmlClear(context.Post["content"]);
         if (content.Length < 200)
             context.Post["summary"] = content;
         else
             context.Post["summary"] = content.Substring(0, 200);
     }
     ArticleMapper.I.Insert(context.Post);
     ArticleDetailMapper.I.Insert(context.Post);
     if (context.Post ["category_id"] == string.Empty) {
         context.Jump (string.Format ("/article/article/category/{0}", context.Post ["articleId"]), "添加成功,请设置文章分类");
         return;
     }
     else {
         context.Jump(string.Format("article/article/edit/{0}", context.Post["articleId"]),"添加成功");
         return;
     }
 }
예제 #3
0
 public void add(JabinfoContext context)
 {
     Weixin weixin = new Weixin ();
     Utils util = new Utils ();
     if (!context.IsPost) {
         return;
     }
     context.Post ["uploadId"] = Jabinfo.Help.Basic.JabId;
     string type = context.Post ["type"];
     string fileName = context.Files ["afile"].FileName;
     string model=fileName.Substring(fileName.LastIndexOf('.') + 1);
     Jabinfo.Help.Upload.Save (context.Post ["uploadId"], context.Files["afile"],model);
     string file = Jabinfo.Help.Upload.PysPath (context.Post ["uploadId"],model);
     string url = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token="+weixin.GetAccessToken();
     url = url + "&type=" + type;
     string json = util.HttpUpload (url, file);
     context.Post ["mediaId"] = weixin.GetJsonValue (json,"media_id");
     context.Post ["createdAt"] = weixin.GetJsonValue(json,"created_at");
     if (!string.IsNullOrEmpty (weixin.GetJsonValue (json, "errcode"))) {
         context.Jump ("/article/upload/home","无效媒体类型,请重新上传");
         return;
     }
     UploadMapper.I.Insert(context.Post);
     context.Refresh ();
 }
예제 #4
0
파일: Job.cs 프로젝트: justinfoxmail/wxipr
 public void activeedit(JabinfoContext context,string jobId)
 {
     if (!context.IsPost) {
         context.Variable ["sex"] = Jabinfo.Help.Config.Get ("job_system.sex");
         context.Variable ["cityList"] = CityMapper.I.SelectByPage (0,50);
         context.Variable ["job"] = JobMapper.I.Create (jobId);
         context.Variable ["extend"] = JobMapper.I.Create (jobId).extendKV;
         return;
     }
     JabinfoKeyValue extend = new JabinfoKeyValue ();
     extend ["contact"] = context.Post ["contact"];   //联系人
     context.Post ["extend"] = extend.ToString ();
     context.Post ["overtime"] =  Jabinfo.Help.Date.StringToDate (context.Post ["overtime"]).ToString ();
     JobMapper.I.UpdateByPrimary(context.Post);
     context.Jump("/crm/job/activeedit/"+ context.Post["jobId"],"编辑成功");
 }
예제 #5
0
파일: Job.cs 프로젝트: justinfoxmail/wxipr
 /// <summary>
 /// 活动添加
 /// </summary>
 /// <param name="context">Context.</param>
 public void activeadd(JabinfoContext context)
 {
     if (!context.IsPost) {
         context.Variable ["sex"] = Jabinfo.Help.Config.Get ("job_system.sex");
         context.Variable ["cityList"] = CityMapper.I.SelectByPage (0,50);
         return;
     }
     context.Post ["jobId"] = Jabinfo.Help.Basic.AutoId ("crm_id");
     JabinfoKeyValue extend = new JabinfoKeyValue ();
     extend ["contact"] = context.Post ["contact"];
     context.Post ["contact"] = extend.ToString ();
     context.Post["type"]="3";         //type=’3‘  活动
     context.Post ["overtime"] =  Jabinfo.Help.Date.StringToDate (context.Post ["overtime"]).ToString ();
     JobMapper.I.Insert(context.Post);
     context.Jump("/crm/job/activeedit/"+ context.Post["jobId"],"添加成功");
 }
예제 #6
0
 public void edit(JabinfoContext context, String animationId)
 {
     if (!context.IsPost) {
         context.Variable ["animation"] = AnimationMapper.I.Create (animationId);
         return;
     }
     if (context.Files["image"] != null && context.Files["image"].ContentLength > 10)
     {
         Jabinfo.Help.Image.Save(context.Post["animationId"], context.Files["image"]);
         JabinfoKeyValue sizes = Jabinfo.Help.Config.Get("article.photosize");
         foreach (string key in sizes.Keys)
         {
             string[] size = sizes[key].Split('x');
             Jabinfo.Help.Image.Resize(string.Format("{0}_{1}", context.Post["animationId"], key), context.Post["animationId"], Convert.ToInt32(size[0]), Convert.ToInt32(size[1]));
         }
     }
     AnimationMapper.I.UpdateByPrimary(context.Post);
     context.Jump ("/crm/animation/home", "编辑成功");
 }
예제 #7
0
 public void add(JabinfoContext context)
 {
     if (!context.IsPost) {
         return;
     }
     context.Post ["animationId"] = Jabinfo.Help.Basic.JabId;
     if (context.Files["image"] != null && context.Files["image"].ContentLength > 10)
     {
         Jabinfo.Help.Image.Save(context.Post["animationId"], context.Files["image"]);
         JabinfoKeyValue sizes = Jabinfo.Help.Config.Get("article.photosize");
         foreach (string key in sizes.Keys)
         {
             string[] size = sizes[key].Split('x');
             Jabinfo.Help.Image.Resize(string.Format("{0}_{1}", context.Post["animationId"], key), context.Post["animationId"], Convert.ToInt32(size[0]), Convert.ToInt32(size[1]));
         }
     }
     AnimationMapper.I.Insert(context.Post);
     context.Jump ("/crm/animation/home", "添加成功");
 }
예제 #8
0
파일: Job.cs 프로젝트: justinfoxmail/wxipr
 /// <summary>
 /// 活动搜索
 /// </summary>
 /// <param name="context">Context.</param>
 /// <param name="index">Index.</param>
 public void activesearch(JabinfoContext context, int index)
 {
     int size = 30;
     string where = string.Empty;
     if (context.IsPost) {
         string type = context.Post ["type"];
         string title = context.Post ["title"];
         string city = context.Post ["city"];
         string status = context.Post ["status"];
             where = string.Format ("and type='{0}'", type);
         if (!string.IsNullOrEmpty (title))
                 where = string.Format ("{0} and title like '%{1}%'", where, title);
         if (!string.IsNullOrEmpty (city))
                 where = string.Format ("{0} and city ='{1}'", where, city);
         if (!string.IsNullOrEmpty (status))
                 where = string.Format ("{0} and status='{1}'", where, status);
         if (!string.IsNullOrEmpty (where)) {
                 where = where.Substring (4);
             context.Session.Add ("active_search", where,1);
         }
     } else {
         try {
                 where = context.Session.Get ("active_search").ToString ();
         } catch (Exception ex) {
             context.Jump ("/crm/job/fulltim", "页面停留过期");
             return;
         }
     }
     context.Variable ["total"] =JobModel.I.Count(where);
     context.Variable ["sex"] = Jabinfo.Help.Config.Get ("job_system.sex");
     context.Variable ["size"] = size;
     context.Variable ["index"] = index;
     context.Variable ["status"] = Jabinfo.Help.Config.Get ("job_system.status");
     context.Variable ["jobList"] = JobModel.I.Select(index, size,where);
 }
예제 #9
0
파일: Job.cs 프로젝트: justinfoxmail/wxipr
 /// <summary>
 /// 实习全职列表
 /// </summary>
 /// <param name="context">Context.</param>
 public void fulladd(JabinfoContext context)
 {
     if (!context.IsPost) {
         context.Variable ["sex"] = Jabinfo.Help.Config.Get ("job_system.sex");
         context.Variable ["cityList"] = CityMapper.I.SelectByPage (0,50);
         context.Variable ["typeList"] = JTypeMapper.I.SelectByPage (0, 50);
         context.Variable ["wageset"] = Jabinfo.Help.Config.Get ("job_system.wageset");
         return;
     }
     context.Post ["jobId"] = Jabinfo.Help.Basic.AutoId ("full_id");
     JabinfoKeyValue extend = new JabinfoKeyValue ();
     context.Post["type"]="2";         //type=’2‘  为全职
     extend ["company"] = context.Post ["company"];
     extend ["contact"] = context.Post ["contact"];
     extend ["wage"] = context.Post ["wage"];
     context.Post ["extend"] = extend.ToString ();
     context.Post ["overtime"] =  Jabinfo.Help.Date.StringToDate (context.Post ["overtime"]).ToString ();
     JobMapper.I.Insert(context.Post);
     context.Jump("/crm/job/fulledit/"+ context.Post["jobId"],"添加成功");
 }
예제 #10
0
 public void edit(JabinfoContext context, String categoryId)
 {
     if (categoryId == null)
     {
         CategoryVO category = CategoryMapper.I.Create(context.Post["categoryId"]);
         string keyword = context.Post["keyword"].Trim();
         if (keyword.Contains(",") || keyword == "")
         {
             CategoryMapper.I.UpdateByPrimary(context.Post);
             foreach (string name in context.Files.AllKeys)
             {
                 if (context.Files[name].ContentLength > 5)
                 {
                     Jabinfo.Help.Image.Save(string.Format("{0}_{1}", context.Post["categoryId"], name.Split('_')[1]), context.Files[name]);
                 }
             }
             context.Jump("crm/category/home/"+category.parentId, "修改成功");
             return;
         }
         else
         {
             context.Jump("crm/category/home/"+category.parentId, "关键字请用逗号隔开");
             return;
         }
     }
     context.Variable["category"] = CategoryMapper.I.Create(categoryId);
 }
예제 #11
0
 public void edit(JabinfoContext context, String articleId)
 {
     if (!context.IsPost) {
         context.Variable ["article"] = ArticleMapper.I.Create (articleId);
         context.Variable ["detail"] = ArticleDetailMapper.I.Create (articleId);
         return;
     }
     context.Post ["pubtime"] = Jabinfo.Help.Date.StringToDate (context.Post ["pubtime"]).ToString ();
     //记录图片
     if (context.Files["image"] != null && context.Files["image"].ContentLength > 10)
     {
         Jabinfo.Help.Image.Save(context.Post["articleId"], context.Files["image"]);
         JabinfoKeyValue sizes = Jabinfo.Help.Config.Get("article.photosize");//切图保存
         foreach (string key in sizes.Keys)
         {
             string[] size = sizes[key].Split('x');
             Jabinfo.Help.Image.Resize(string.Format("{0}_{1}", context.Post["articleId"], key), context.Post["articleId"], Convert.ToInt32(size[0]), Convert.ToInt32(size[1]));
         }
         context.Post["attach"] = "1";//有预览图
     }
     if (context.Files["afile"] != null && context.Files["afile"].ContentLength > 10)
     {
         string fileName = context.Files["afile"].FileName;
         context.Post["model"] = fileName.Substring(fileName.LastIndexOf('.') + 1);
         Jabinfo.Help.Upload.Save(context.Post["articleId"] + "_file", context.Files["afile"], context.Post["model"]);
     }
     if (context.Post["iscash"] == null)
         context.Post["iscash"] = "0";
     ArticleMapper.I.UpdateByPrimary (context.Post);
     context.Post["categorys"] = context.Post["categoryId"];
     context.Post["tags"] = context.Post["tagId"];
     ArticleDetailMapper.I.UpdateByPrimary(context.Post);
     context.Jump(string.Format("/crm/article/edit/{0}", context.Post["articleId"]), "编辑成功");
     return;
 }