Esempio n. 1
0
 public Maticsoft.Model.Ms.WeiBoMsg DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Ms.WeiBoMsg msg = new Maticsoft.Model.Ms.WeiBoMsg();
     if (row != null)
     {
         if ((row["WeiBoId"] != null) && (row["WeiBoId"].ToString() != ""))
         {
             msg.WeiBoId = int.Parse(row["WeiBoId"].ToString());
         }
         if (row["WeiboMsg"] != null)
         {
             msg.WeiboMsg = row["WeiboMsg"].ToString();
         }
         if (row["ImageUrl"] != null)
         {
             msg.ImageUrl = row["ImageUrl"].ToString();
         }
         if ((row["CreateDate"] != null) && (row["CreateDate"].ToString() != ""))
         {
             msg.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
         }
         if ((row["PublishDate"] != null) && (row["PublishDate"].ToString() != ""))
         {
             msg.PublishDate = new DateTime?(DateTime.Parse(row["PublishDate"].ToString()));
         }
     }
     return msg;
 }
Esempio n. 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string str = this.txtDesc.Text.Trim();
     if (string.IsNullOrWhiteSpace(str))
     {
         MessageBox.ShowFailTip(this, "微博消息不能为空!");
     }
     else
     {
         Maticsoft.Model.Ms.WeiBoMsg model = new Maticsoft.Model.Ms.WeiBoMsg {
             CreateDate = DateTime.Now,
             WeiboMsg = str,
             ImageUrl = this.txtimgUrl.ImageUrl
         };
         this.msgBll.Add(model);
         List<Maticsoft.Model.Members.UserBind> modelList = this.bindBll.GetModelList(" userid=" + base.CurrentUser.UserID);
         if ((modelList == null) || (modelList.Count == 0))
         {
             MessageBox.ShowFailTip(this, "该帐号没有绑定任何微博,请先绑定微博!");
         }
         else
         {
             string mediaIDs = string.Join<int>(",", from c in modelList select c.MediaID);
             string url = "http://" + Globals.DomainFullName;
             this.bindBll.SendWeiBo(-1, mediaIDs, str, url, "");
             MessageBox.ShowSuccessTip(this, "发布成功!");
         }
     }
 }
Esempio n. 3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string str = this.txtDesc.Value;
     if (string.IsNullOrWhiteSpace(str))
     {
         MessageBox.ShowFailTip(this, "微博消息不能为空!");
     }
     else
     {
         Maticsoft.Model.Ms.WeiBoMsg model = new Maticsoft.Model.Ms.WeiBoMsg {
             CreateDate = DateTime.Now,
             WeiboMsg = str
         };
         string str2 = this.hfImage.Value;
         if (!string.IsNullOrWhiteSpace(str2))
         {
             string oldValue = string.Format("/Upload/Temp/{0}/", DateTime.Now.ToString("yyyyMMdd"));
             string path = string.Format("/Upload/Weibo/{0}/", DateTime.Now.ToString("yyyyMMdd"));
             if (!Directory.Exists(HttpContext.Current.Server.MapPath(path)))
             {
                 Directory.CreateDirectory(HttpContext.Current.Server.MapPath(path));
             }
             string str5 = str2.Replace(oldValue, path);
             File.Move(HttpContext.Current.Server.MapPath(str2), HttpContext.Current.Server.MapPath(str5));
             model.ImageUrl = str5;
         }
         if (Globals.SafeInt(this.hfWeiboCount.Value, 0) == 0)
         {
             MessageBox.ShowFailTip(this, "该帐号没有绑定任何微博,请先绑定微博!");
         }
         else
         {
             string str6 = "";
             bool flag = false;
             for (int i = 0; i < this.ChkWeibo.Items.Count; i++)
             {
                 if (this.ChkWeibo.Items[i].Selected)
                 {
                     flag = true;
                     str6 = str6 + this.ChkWeibo.Items[i].Value.ToString() + ",";
                 }
             }
             if (flag)
             {
                 str6 = str6.Substring(0, str6.LastIndexOf(","));
             }
             if (string.IsNullOrWhiteSpace(str6))
             {
                 MessageBox.ShowFailTip(this, "请选择同步微博帐号!");
             }
             else
             {
                 string url = "http://" + Globals.DomainFullName;
                 if (this.chkSetTime.Checked)
                 {
                     string text = this.txtDate.Text + " " + this.ddlHour.SelectedValue + ":" + this.ddlMins.SelectedValue;
                     model.PublishDate = new DateTime?((Globals.SafeDateTime(text, DateTime.Now) > DateTime.Now) ? Globals.SafeDateTime(text, DateTime.Now) : DateTime.Now);
                     int num3 = this.taskMsgBll.AddEx(model);
                     string[] args = new string[] { num3.ToString(), str6, str, url, model.ImageUrl };
                     Task.Add(Globals.SafeDateTime(text, DateTime.MinValue), new Action<string[]>(this.WeiBoCallBack), args);
                 }
                 else
                 {
                     model.PublishDate = new DateTime?(DateTime.Now);
                     this.msgBll.Add(model);
                     this.bindBll.SendWeiBo(str6, str, url, model.ImageUrl);
                 }
                 MessageBox.ShowSuccessTip(this, "发布成功!");
                 this.hfImage.Value = "";
                 this.txtDesc.Value = "";
                 this.gridView.OnBind();
             }
         }
     }
 }