Beispiel #1
0
        public List <PostInformation> GetPostFeedBack(string PostID, string IsActive, string User) // 1
        {
            List <PostInformation> listData = new List <PostInformation>();
            PostInformation        ObjItem  = new PostInformation();

            if (PostID == "" || PostID == null)
            {
                ObjItem.PostID = "-1";
            }
            else
            {
                ObjItem.PostID = PostID;
            }

            if (IsActive == "" || IsActive == null)
            {
                ObjItem.IsActive = "-1";
            }
            else
            {
                ObjItem.IsActive = IsActive;
            }

            listData = GetData(LoadPostFeedBack, ObjItem, User);
            return(listData);
        }
Beispiel #2
0
        public List <PostInformation> GetPostFeedBack_API() // 1
        {
            List <PostInformation> listData = new List <PostInformation>();

            try
            {
                cmd             = new SqlCommand(getSP, DataManager.cnConnection);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@LoadOption", SqlDbType.Int).Value = 2;
                cmd.Parameters.Add("@PostID", SqlDbType.Int).Value     = "-1";
                cmd.Parameters.Add("@IsActive", SqlDbType.Int).Value   = "-1";
                dt = DataManager.ExecuteQuerySqlCommand(cmd);

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        PostInformation listItem = new PostInformation();
                        listItem.PostID                      = dt.Rows[i]["PostID"].ToString();
                        listItem.PostHead                    = dt.Rows[i]["PostHead"].ToString();
                        listItem.PostImage                   = dt.Rows[i]["PostImage"].ToString();
                        listItem.PostImageBase64Bytes        = GetPostImage(dt.Rows[i]["PostID"].ToString(), dt.Rows[i]["PostImage"].ToString());
                        listItem.IsActive                    = dt.Rows[i]["IsActive"].ToString();
                        listItem.Status                      = dt.Rows[i]["Status"].ToString();
                        listItem.PostCreatedBy               = dt.Rows[i]["PostCreatedBy"].ToString();
                        listItem.PostCreatedUserName         = dt.Rows[i]["PostCreatedUserName"].ToString();
                        listItem.PostCreatedDate             = dt.Rows[i]["PostCreatedDate"].ToString();
                        listItem.PostUpdatedBy               = dt.Rows[i]["PostUpdatedBy"].ToString();
                        listItem.PostUpdatedUserName         = dt.Rows[i]["PostUpdatedUserName"].ToString();
                        listItem.PostUpdatedDate             = dt.Rows[i]["PostUpdatedDate"].ToString();
                        listItem.PostFeedbackID              = dt.Rows[i]["PostFeedbackID"].ToString();
                        listItem.PostComment                 = dt.Rows[i]["PostComment"].ToString();
                        listItem.PostLike                    = dt.Rows[i]["PostLike"].ToString();
                        listItem.PostDislike                 = dt.Rows[i]["PostDislike"].ToString();
                        listItem.PostFeedbackCreatedBy       = dt.Rows[i]["PostFeedbackCreatedBy"].ToString();
                        listItem.PostFeedbackCreatedUserName = dt.Rows[i]["PostFeedbackCreatedUserName"].ToString();
                        listItem.PostFeedbackCreatedDate     = dt.Rows[i]["PostFeedbackCreatedDate"].ToString();
                        listItem.PostFeedbackUpdatedBy       = dt.Rows[i]["PostFeedbackUpdatedBy"].ToString();
                        listItem.PostFeedbackUpdatedUserName = dt.Rows[i]["PostFeedbackUpdatedUserName"].ToString();
                        listItem.PostFeedbackUpdatedDate     = dt.Rows[i]["PostFeedbackUpdatedDate"].ToString();
                        listData.Add(listItem);
                    }
                }
            }
            catch (Exception ex)
            {
                objResult.ExceptionError = ex.ToString();
            }
            finally
            {
                objResult.IsLogin = "******";
            }
            return(listData);
        }
Beispiel #3
0
        public OutputResult UpdatePost(PostInformation objItem, string UserBy)
        {
            try
            {
                cmd             = new SqlCommand(setSP, DataManager.cnConnection);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("SaveOption", SqlDbType.Int).Value     = SaveOption.UpdateRow;
                cmd.Parameters.Add("@PostID", SqlDbType.Int).Value        = objItem.PostID;
                cmd.Parameters.Add("@PostHead", SqlDbType.VarChar).Value  = objItem.PostHead;
                cmd.Parameters.Add("@PostImage", SqlDbType.VarChar).Value = objItem.PostImage;
                cmd.Parameters.Add("@IsActive", SqlDbType.Int).Value      = objItem.IsActive;
                cmd.Parameters.Add("@UserBy", SqlDbType.VarChar).Value    = UserBy;

                SqlParameter paramIdentityValue = new SqlParameter("@IdentityValue", SqlDbType.Int, 20, ParameterDirection.Output, false, 0, 0, "", DataRowVersion.Default, null);
                cmd.Parameters.Add(paramIdentityValue);

                SqlParameter ErrNo = new SqlParameter("@ErrNo", SqlDbType.Int, 20, ParameterDirection.Output, false, 0, 0, "", DataRowVersion.Default, null);
                cmd.Parameters.Add(ErrNo);
                DataManager.cnConnection.Open();

                objResult.NoofRows = cmd.ExecuteNonQuery();
                objResult.ErrorNo  = int.Parse(cmd.Parameters["@ErrNo"].Value.ToString());
                objResult.ResultId = int.Parse(cmd.Parameters["@IdentityValue"].Value.ToString());

                if (objResult.NoofRows > 0 && objResult.ResultId > 0)
                {
                    objResult.Message = "Update operation successful.";
                }
                else
                {
                    if (objResult.ErrorNo == -1)
                    {
                        objResult.Message = "Update operation failed.";
                    }
                }
            }
            catch (Exception ex)
            {
                objResult.ExceptionError = ex.ToString();
                objResult.ResultId       = 0;
                objResult.ErrorNo        = -1;
                objResult.Message        = "Exception: Update operation failed.";
            }
            finally
            {
                DataManager.cnConnection.Close();
                cmd = null;
            }
            return(objResult);
        }