Title / Description
Code // муÑкл namespace SP.Dal.Poll { public class Answer : DbObject { public override int Save() { try { bool flag = DbObject.IsRowExists<Answer>(this.Id); if (!flag) { this.SetSortOrder(); } ManagedCommand command = new ManagedCommand(!flag ? "INSERT INTO PollAnswer (AnswerQuestion, AnswerName, AnswerCount, AnswerSort) VALUES (?q, ?name, ?count, ?sort);SELECT LAST_INSERT_ID();" : "UPDATE PollAnswer SET AnswerQuestion=?q, AnswerName=?name, AnswerCount=?count, AnswerSort=?sort WHERE AnswerID=?id"); command.AddInt32Parameter("?id", this.Id); command.AddInt32Parameter("?q", this.Question); command.AddStringParameter("?name", this.Name); command.AddInt32Parameter("?count", this.Count); command.AddInt32Parameter("?sort", this.Sort); int num = command.ExecuteInt(true); if (this.Id <= 0) { this.Id = num; } } catch (Exception exception) { Trace.WriteLine(exception.Message); throw; } return this.Id; } } } // ÑеÑÑÐ¸Ñ namespace SP.Modules.Poll { public class Frontend : FrontendWebPart { private static void MarkAsAnswered(DbObject poll) { string str = Tools.ChkString(HttpContext.Current.Session["SP_Polls"]); int[] array = Tools.String2IntArray(str); if ((array == null) || (Array.IndexOf<int>(array, poll.Id) < 0)) { HttpContext.Current.Session["SP_Polls"] = string.Format("{0}{1}{2}", str, ((array != null) && (array.Length > 0)) ? "," : string.Empty, poll.Id); } } private bool WasAnswered() { int[] array = Tools.String2IntArray(Tools.ChkString(HttpContext.Current.Session["SP_Polls"])); return ((array != null) && (Array.IndexOf<int>(array, this._poll.Id) >= 0)); } } }
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code