コード例 #1
0
        /// <summary>
        /// Возвращает коллекцию параметров.
        /// </summary>
        public override Dictionary <string, string> GetParameters()
        {
            var parameters = base.GetParameters();

            parameters["owner_id"]   = OwnerID.ToString();
            parameters["comment_id"] = CommentID.ToString();
            if (Reason != VKReason.Spam)
            {
                parameters["reason"] = ((byte)Reason).ToString();
            }

            return(parameters);
        }
コード例 #2
0
ファイル: CIXMessage.cs プロジェクト: cixonline/cixreader
        /// <summary>
        /// Post this message to the server
        /// </summary>
        private void PostMessage()
        {
            CIX.FolderCollection.NotifyMessagePostStarted(this);
            PostPending = false;
            try
            {
                Folder      folder      = Topic;
                PostMessage postMessage = new PostMessage
                {
                    Body       = Body.FixQuotes(),
                    Forum      = folder.ParentFolder.Name,
                    Topic      = folder.Name,
                    WrapColumn = "0",
                    MarkRead   = "1",
                    MsgID      = CommentID.ToString(CultureInfo.InvariantCulture)
                };

                HttpWebRequest postUrl        = APIRequest.Post("forums/post", APIRequest.APIFormat.XML, postMessage);
                string         responseString = APIRequest.ReadResponseString(postUrl);

                int newRemoteID;
                if (int.TryParse(responseString, out newRemoteID))
                {
                    RemoteID = newRemoteID;
                    Date     = DateTime.UtcNow.UTCToGMTBST();
                    lock (CIX.DBLock)
                    {
                        CIX.DB.Update(this);
                    }
                    if (CommentID == 0)
                    {
                        LogFile.WriteLine("Posted new thread \"{0}\" as message {1}", Body.FirstLine(), RemoteID);
                    }
                    else
                    {
                        LogFile.WriteLine("Posted new reply to message {0} as message {1}", CommentID, RemoteID);
                    }
                    CIX.FolderCollection.NotifyMessageChanged(this);
                }
                else
                {
                    LogFile.WriteLine("Failed to post message {0} : {1}", ID, responseString);
                }
            }
            catch (Exception e)
            {
                CIX.ReportServerExceptions("CIXMessage.PostMessage", e);
            }
            CIX.FolderCollection.NotifyMessagePostCompleted(this);
        }
コード例 #3
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "commentid": // Int
                return(CommentID.ToString(strFormat, formatProvider));

            case "componentid": // Int
                return(ComponentId.ToString(strFormat, formatProvider));

            case "itemtype": // Int
                return(ItemType.ToString(strFormat, formatProvider));

            case "itemid": // Int
                return(ItemId.ToString(strFormat, formatProvider));

            case "parentid": // Int
                if (ParentId == null)
                {
                    return("");
                }
                ;
                return(((int)ParentId).ToString(strFormat, formatProvider));

            case "message": // NVarCharMax
                return(PropertyAccess.FormatString(Message, strFormat));

            case "approved": // Bit
                if (Approved == null)
                {
                    return("");
                }
                ;
                return(Approved.ToString());

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
コード例 #4
0
        /// <summary>
        /// Возвращает коллекцию параметров.
        /// </summary>
        public override Dictionary <string, string> GetParameters()
        {
            var parameters = base.GetParameters();

            if (OwnerID != 0)
            {
                parameters["owner_id"] = OwnerID.ToString();
            }
            parameters["comment_id"] = CommentID.ToString();
            if (!string.IsNullOrWhiteSpace(Message))
            {
                parameters["message"] = Message;
            }
            if (Attachments != null && Attachments.Count != 0)
            {
                parameters["attachments"] = string.Join(",", Attachments);
            }

            return(parameters);
        }
コード例 #5
0
        protected void lvCMNERPComment_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 CommentID;

            Int64.TryParse(e.CommandArgument.ToString(), out CommentID);

            if (CommentID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _CommentID = CommentID;

                    PrepareEditView();
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CMNERPCommentEntity.FLD_NAME_CommentID, CommentID.ToString(), SQLMatchType.Equal);

                        CMNERPCommentEntity cMNERPCommentEntity = new CMNERPCommentEntity();


                        result = FCCCMNERPComment.GetFacadeCreate().Delete(cMNERPCommentEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _CommentID           = 0;
                            _CMNERPCommentEntity = new CMNERPCommentEntity();
                            PrepareInitialView();
                            BindCMNERPCommentList();

                            MiscUtil.ShowMessage(lblMessage, "C MNERPComment has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete C MNERPComment.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }