示例#1
0
        public string InsertCollegeDayComment(NextCollegeDayComment Info)
        {
            string Result = string.Empty;

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("SP_InsertNextCollegeComment", con);
                    com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.AddWithValue("@Comment", Info.Comment);
                    com.Parameters.AddWithValue("@StudentID", Info.StudentID);
                    com.Parameters.AddWithValue("@TeacherID", Info.TeacherID);
                    com.Parameters.AddWithValue("@EventID", Info.EventID);
                    com.Parameters.Add("@Commentid", SqlDbType.BigInt).Direction = ParameterDirection.Output;
                    con.Open();
                    if (com.ExecuteNonQuery() > 0)
                    {
                        Result = "Success!" + com.Parameters["@Commentid"].Value.ToString();
                    }
                    else
                    {
                        Result = "Failed! ";
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
            }
            return(Result);
        }
示例#2
0
        public JsonResult InsertCollegeDayComment(NextCollegeDayComment Info)
        {
            ResultInfo <string> ResultInfo = new ResultInfo <string>()
            {
                Status      = false,
                Description = "Failed|Login"
            };

            try
            {
                if (Info != null)
                {
                    Global PageObj = new Global();
                    ResultInfo.Info = PageObj.InsertCollegeDayComment(Info);
                    if (ResultInfo.Info != null)
                    {
                        ResultInfo.Description = "Success| Insert Topic";
                        ResultInfo.Status      = true;
                    }
                }
            }
            catch (Exception ex)
            {
                ResultInfo.Description = ex.Message;
            }
            return(Json(ResultInfo, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public List <NextCollegeDayComment> GetCollegeComments(long id)
        {
            List <NextCollegeDayComment> Result = new List <NextCollegeDayComment>();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("SP_GetAllNextCollegeCommentByEventID", con);
                    com.Parameters.AddWithValue("@EventID", id);
                    com.CommandType = CommandType.StoredProcedure;

                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        NextCollegeDayComment temp = new NextCollegeDayComment();
                        temp.CommentID   = Convert.ToInt16(reader["NxtCollege_Comments_ID"]);
                        temp.Comment     = Convert.ToString(reader["NxtCollege_Comments_Text"]);
                        temp.CreatedDate = Convert.ToDateTime(reader["NxtCollege_Comments_InsertedDate"]);
                        temp.StudentName = Convert.ToString(reader["Student_Name"]);
                        temp.TeacherName = Convert.ToString(reader["TeacherName"]);
                        temp.IsStudent   = Convert.ToBoolean(reader["IsStudent"]);
                        Result.Add(temp);
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }