Пример #1
0
 public List<Maticsoft.Model.Poll.PollUsers> GetModelList(string strWhere)
 {
     DataSet set = this.dal.GetList(strWhere);
     List<Maticsoft.Model.Poll.PollUsers> list = new List<Maticsoft.Model.Poll.PollUsers>();
     int count = set.Tables[0].Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.Poll.PollUsers item = new Maticsoft.Model.Poll.PollUsers();
             if (set.Tables[0].Rows[i]["UserID"].ToString() != "")
             {
                 item.UserID = int.Parse(set.Tables[0].Rows[i]["UserID"].ToString());
             }
             item.UserName = set.Tables[0].Rows[i]["UserName"].ToString();
             if (set.Tables[0].Rows[i]["Password"].ToString() != "")
             {
                 item.Password = (byte[]) set.Tables[0].Rows[i]["Password"];
             }
             item.TrueName = set.Tables[0].Rows[i]["TrueName"].ToString();
             if (set.Tables[0].Rows[i]["Age"].ToString() != "")
             {
                 item.Age = new int?(int.Parse(set.Tables[0].Rows[i]["Age"].ToString()));
             }
             item.Sex = set.Tables[0].Rows[i]["Sex"].ToString();
             item.Phone = set.Tables[0].Rows[i]["Phone"].ToString();
             item.Email = set.Tables[0].Rows[i]["Email"].ToString();
             item.UserType = set.Tables[0].Rows[i]["UserType"].ToString();
             list.Add(item);
         }
     }
     return list;
 }
Пример #2
0
 public ActionResult SubmitPoll(FormCollection fm)
 {
     string str = fm["TopicIDjson"];
     if (base.Request.Cookies["votetopic"] != null)
     {
         return base.Content("isnotnull");
     }
     if (string.IsNullOrWhiteSpace(str))
     {
         return base.Content("false");
     }
     Maticsoft.BLL.Poll.PollUsers users = new Maticsoft.BLL.Poll.PollUsers();
     Maticsoft.Model.Poll.PollUsers model = new Maticsoft.Model.Poll.PollUsers();
     int num = users.Add(model);
     if (num < 0)
     {
         return base.Content("false");
     }
     Maticsoft.Model.Poll.UserPoll poll = new Maticsoft.Model.Poll.UserPoll();
     Maticsoft.BLL.Poll.UserPoll poll2 = new Maticsoft.BLL.Poll.UserPoll();
     poll.UserIP = base.Request.UserHostAddress;
     poll.UserID = num;
     foreach (JsonObject obj2 in JsonConvert.Import<JsonArray>(str))
     {
         int num2 = Globals.SafeInt(obj2["topicid"].ToString(), 0);
         string text = obj2["topicvlaue"].ToString();
         int num3 = Globals.SafeInt(obj2["type"].ToString(), -1);
         poll.TopicID = new int?(num2);
         switch (num3)
         {
             case 0:
             {
                 poll.OptionID = new int?(Globals.SafeInt(text, -1));
                 poll2.Add(poll);
                 continue;
             }
             case 1:
             {
                 poll.OptionIDList = text;
                 if (!string.IsNullOrWhiteSpace(text))
                 {
                     poll2.Add2(poll);
                 }
                 continue;
             }
             case 2:
             {
                 continue;
             }
         }
     }
     HttpCookie cookie = new HttpCookie("votetopic");
     cookie.Values.Add("voteid", "votetopic");
     cookie.Expires = DateTime.Now.AddHours(240.0);
     base.Response.Cookies.Add(cookie);
     return base.Content("true");
 }
Пример #3
0
 public Maticsoft.Model.Poll.PollUsers GetModel(int UserID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select  top 1 UserID,UserName,Password,TrueName,Age,Sex,Phone,Email,UserType from Poll_Users ");
     builder.Append(" where UserID=@UserID ");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@UserID", SqlDbType.Int, 4) };
     cmdParms[0].Value = UserID;
     Maticsoft.Model.Poll.PollUsers users = new Maticsoft.Model.Poll.PollUsers();
     DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if (set.Tables[0].Rows[0]["UserID"].ToString() != "")
     {
         users.UserID = int.Parse(set.Tables[0].Rows[0]["UserID"].ToString());
     }
     users.UserName = set.Tables[0].Rows[0]["UserName"].ToString();
     if (set.Tables[0].Rows[0]["Password"].ToString() != "")
     {
         users.Password = (byte[]) set.Tables[0].Rows[0]["Password"];
     }
     users.TrueName = set.Tables[0].Rows[0]["TrueName"].ToString();
     if (set.Tables[0].Rows[0]["Age"].ToString() != "")
     {
         users.Age = new int?(int.Parse(set.Tables[0].Rows[0]["Age"].ToString()));
     }
     users.Sex = set.Tables[0].Rows[0]["Sex"].ToString();
     users.Phone = set.Tables[0].Rows[0]["Phone"].ToString();
     users.Email = set.Tables[0].Rows[0]["Email"].ToString();
     users.UserType = set.Tables[0].Rows[0]["UserType"].ToString();
     return users;
 }