示例#1
0
 /// <summary>
 /// 添加日记(类型:1.日记,2.心情,3.手账)
 /// </summary>
 /// <param name="openid"></param>
 /// <param name="nickname"></param>
 /// <param name="content"></param>
 public void AddDiary(string openid, string nickname, string content)
 {
     try
     {
         string[] arrStr = content.Replace("\"", "").Replace("}", "").Split(new char[2] {
             ',', ':'
         });
         if (arrStr[9] == "1")
         {
             DiaryBLL   bll   = new DiaryBLL();
             DiaryModel model = new DiaryModel();
             model.OpenID       = openid;
             model.NickName     = nickname;
             model.Weather      = arrStr[3];
             model.City         = arrStr[5];
             model.DiaryContent = arrStr[7];
             model.IsPublic     = int.Parse(arrStr[11]);
             model.Createtime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             model.Modifytime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             bll.AddDiary(model);
         }
         else if (arrStr[9] == "2")
         {
             MoodBLL  bll   = new MoodBLL();
             MoodModl model = new MoodModl();
             model.OpenID     = openid;
             model.NickName   = nickname;
             model.Weather    = arrStr[3];
             model.City       = arrStr[5];
             model.Mood       = arrStr[7];
             model.IsPublic   = int.Parse(arrStr[11]);
             model.Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             model.Modifytime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             bll.AddMood(model);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
 /// <summary>
 /// 添加日记
 /// </summary>
 /// <param name="openid"></param>
 /// <param name="nickname"></param>
 /// <param name="content"></param>
 public void AddDiary(string openid, string nickname, string content)
 {
     try
     {
         string[] arrStr = content.Replace("\"", "").Replace("}", "").Split(new char[2] {
             ',', ':'
         });
         DiaryBLL   bll   = new DiaryBLL();
         DiaryModel model = new DiaryModel();
         model.OpenID       = openid;
         model.NickName     = nickname;
         model.Weather      = arrStr[3];
         model.City         = arrStr[5];
         model.DiaryContent = arrStr[7];
         bll.AddDiary(model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }