Example #1
0
        static void Main(string[] args)
        {
            Ninject.IKernel kernal = new StandardKernel(new Core());
            ////kernal.Bind<IMsgRepo>().To<MsgRepo>();
            _repo = kernal.Get<MsgRepo>();

            _svc = kernal.Get<MsgService>();

            var svcreplies = _svc.GetReplies();
            foreach (var x in svcreplies)
            {
                Console.WriteLine(x.Body);
            }

            Console.WriteLine("enter reply");
            var consoleReply = Console.ReadLine();

            var reply = new Reply()
            {
                Body = consoleReply,
                Created = DateTime.Now,
                TopicId = 1

            };

            _repo.InsertReply(reply);

            var replies = _repo.GetReplies();
            _repo.DeleteReply(replies.First().Id);

            foreach (var x in replies)
            {
                Console.WriteLine(x.Body);
            }

            Main(args);

            //var baseClass = new BaseClass();
            //var derivedOverride = new DerivedOverride();
            //var derivedNew = new DerivedNew();
            //var derivedOverWrite = new DerivedOverwrite();

            //baseClass.Name();
            //derivedOverride.Name();
            //derivedNew.Name();
            //derivedOverWrite.Name();

            //Console.ReadLine();
            //baseClass.Name();
            //derivedOverride.Name();
            //((BaseClass)derivedNew).Name();
            //((BaseClass)derivedOverWrite).Name();
            //Console.ReadLine();

            //var t1 = typeof(BaseClass);
            //Console.WriteLine(t1.Name);
            //Console.WriteLine(t1.Assembly);

            //Console.ReadLine();
        }
Example #2
0
        public ReplyEntity(Reply reply)
        {
            this.PartitionKey = reply.MessageID;
            this.RowKey = string.Format("{0}_{1}",
                Utils.ToAzureStorageSecondBasedString(reply.PostTime.ToUniversalTime()),
                Guid.NewGuid().ToString());

            Content = reply.toJsonString();
        }
 public vReply(Reply model)
 {
     this.ID = model.Id;
     this.UserID = model.UserId;
     this.Username = model.User.Username;
     this.AccidentID = model.AccidentId;
     this.Description = model.Description;
     this.Time = model.Time.ToString();
 }
        public ReplyNotificationEntifity(string userid, Reply reply)
        {
            this.PartitionKey = userid;
            this.RowKey = string.Format(
                    "{0}_{1}",
                    Utils.ToAzureStorageSecondBasedString(reply.PostTime.ToUniversalTime()),
                    Guid.NewGuid().ToString()
                );

            Content = reply.toJsonString();
        }
        public Reply Create(CreateReplyCommand command)
        {
            var service = new Reply(command.BodyReply, command.Group);
            service.Validate();
            _repository.Create(service);

            if (Commit())
                return service;

            return null;
        }
Example #6
0
        public void TestMethod1()
        {
            var expected = new Reply() { Body = "bdy return", TopicId = 1, Id = 1 };
            var mockReplyRepo = new Mock<IMsgRepo>();
            mockReplyRepo
                .Setup(m => m.FindById(1))
                .Returns(new Reply() { Id = 1, Body = "bdy return" });

            var mockSvc = new MsgService(mockReplyRepo.Object);
            var actual = mockSvc.FindById(expected.Id);
            Assert.AreEqual(expected.Id, actual.Id);
            Assert.AreEqual(expected.Body, actual.Body);
        }
Example #7
0
 public vReply(Reply model)
 {
     DB db = new DB();
     this.Content = model.Content;
     this.ID = model.ID;
     this.Time = model.Time;
     this.TopicID = model.TopicID;
     this.User = model.User;
     this.UserID = model.UserID;
     this.TopicTitle = model.Topic.Title;
     this.FatherID = model.FatherID;
     this.Children = db.Replies.Where(r => r.FatherID == model.ID).OrderBy(r => r.Time).ToList();
 }
Example #8
0
        public bool InsertReply(Reply newReply)
        {
            try
            {
                _ctx.Replies.Add(newReply);
                _ctx.SaveChanges();
                return true;
            }
            catch (Exception)
            {
                return false;

            }
        }
Example #9
0
 public ActionResult Post(FormCollection form)
 {
     int ID;
     Reply reply = new Reply();
     ID = Convert.ToInt32(form["postid"]);
     reply.PostID = ID;
     reply.Name = form["name"].ToString();
     reply.Email = form["email"].ToString();
     reply.Comment = form["comment"].ToString();
     reply.Date = DateTime.Now;
     db.Replies.Add(reply);
     db.SaveChanges();
     var p = (from Post in db.Posts where Post.PostID == ID select Post).First();
     ViewBag.Post = p;
     var replies = from Reply in db.Replies where Reply.PostID == ID select Reply;
     return View(replies.ToList());
 }
Example #10
0
 public void SendRequest(CDSOperations Op, string TgtNode, byte[] Body, Reply OnReply)
 {
     if (CDSHandler.Alive)
     {
         int OpID = 0;
         foreach (SentOp o in SentOps)
             OpID = Math.Max(OpID, o.OpID + 1);
         SentOp NewSentOp = new SentOp() { OpID = OpID };
         NewSentOp.OnReply += OnReply;
         SentOps.Add(NewSentOp);
         CDSHandler.SendMessage(ChannelID, (byte)Op, TgtNode, OpID, Body);
     }
     else
     {
         throw new Exception("connection closed");
     }
 }
    public void Init(Reply newReply)
    {
        reply = newReply;

        if (text != null)
            text.text = reply.text;
        finalAnswerColor = reply.finalAnswerColor;
        if (reply.image != null)
        {
            sprite.atlas = reply.atlas;
            sprite.spriteName = Utilities.SetTextureName(reply.image.name);
            sprite.enabled = true;
            if (audioUI != null)
                audioUI.enabled = true;
        }
        sprite.alpha = 1;
        if (audioUI != null)
            audioUI.alpha = 1;
    }
Example #12
0
 public ActionResult Create(int id, string content, int? father_id)
 {
     if (string.IsNullOrEmpty(content))
         return Content("NO");
     var reply = new Reply
     {
         FatherID = father_id,
         Time = DateTime.Now,
         Content = content,
         TopicID = id,
         UserID = ViewBag.CurrentUser.ID
     };
     DbContext.Replies.Add(reply);
     DbContext.SaveChanges();
     var topic = DbContext.Topics.Find(id);
     topic.LastReply = reply.Time;
     DbContext.SaveChanges();
     return Content("OK");
 }
Example #13
0
 public bool AddReply(Reply reply)
 {
     reply.Id      = new Random().Next(5, 1000);
     reply.Created = DateTime.UtcNow;
     return(true);
 }
Example #14
0
 /// <summary>
 /// Updates an existing reply in the data context.
 /// </summary>
 /// <param name="reply">The reply to be updated.</param>
 public void UpdateReply(Reply reply)
 {
     _entityContainer.SaveChanges();
 }
Example #15
0
 /// <summary>
 /// Deletes a reply from the data context.
 /// </summary>
 /// <param name="reply">The reply to be deleted.</param>
 public void DeleteReply(Reply reply)
 {
     _entityContainer.Replies.Remove(reply);
     _entityContainer.SaveChanges();
 }
Example #16
0
        // --------------------

        async Task <ICommandResultBase> ApplyLatestHistoryPoint(Topic entity, Reply reply)
        {
            // Get current user
            var user = await _contextFacade.GetAuthenticatedUserAsync();

            // We need to be authenticated to make changes
            if (user == null)
            {
                return(await ResetEditDetails(entity, reply, user));
            }

            // Get newest / most recent history entry
            var histories = await _entityHistoryStore.QueryAsync()
                            .Take(1)
                            .Select <EntityHistoryQueryParams>(q =>
            {
                q.EntityId.Equals(entity.Id);
                q.EntityReplyId.Equals(reply?.Id ?? 0);
            })
                            .OrderBy("Id", OrderBy.Desc)
                            .ToList();

            // No history point, return success
            if (histories == null)
            {
                return(await ResetEditDetails(entity, reply, user));
            }

            // No history point, return success
            if (histories.Data == null)
            {
                return(await ResetEditDetails(entity, reply, user));
            }

            // No history point, return success
            if (histories.Data.Count == 0)
            {
                return(await ResetEditDetails(entity, reply, user));
            }

            var history = histories.Data[0];

            // No history available reset edit details
            if (history == null)
            {
                return(await ResetEditDetails(entity, reply, user));
            }

            // Update edit details based on latest history point

            var result = new CommandResultBase();

            if (reply != null)
            {
                reply.ModifiedUserId = user.Id;
                reply.ModifiedDate   = DateTimeOffset.UtcNow;
                reply.EditedUserId   = history.CreatedUserId;
                reply.EditedDate     = history.CreatedDate;

                // Update reply to history point
                var updateResult = await _entityReplyStore.UpdateAsync(reply);

                if (updateResult != null)
                {
                    return(result.Success());
                }
            }
            else
            {
                entity.ModifiedUserId = user.Id;
                entity.ModifiedDate   = DateTimeOffset.UtcNow;
                entity.EditedUserId   = history.CreatedUserId;
                entity.EditedDate     = history.CreatedDate;

                // Update entity to history point
                var updateResult = await _entityStore.UpdateAsync(entity);

                if (updateResult != null)
                {
                    return(result.Success());
                }
            }

            return(result.Success());
        }
Example #17
0
        /// <summary>
        /// 被关注自动回复
        /// 不存在,则补充完备数据,保证进入页面时,数据是完备的
        /// </summary>
        /// <returns></returns>
        public ActionResult FollowedIndex()
        {
            //获取KeyWordGroup信息
            var _KeyWordGroup = svc.Select(
                new RuleQuery()
            {
                OwnerID = OwnerID,
                Type    = (int)RuleType.Subscribe
            }).FirstOrDefault();

            // 不存在,则写入新纪录
            if (_KeyWordGroup == null)
            {
                Rule _Model = new Rule();
                _Model.Name    = "被关注自动回复";
                _Model.OwnerID = OwnerID;
                _Model.Type    = (int)RuleType.Subscribe;

                //插入KeyWordGroup
                svc.Create(_Model);

                //获取新插入的KeyWordGroup记录
                _KeyWordGroup = _Model;
            }

            //获取Reply信息
            var _Reply = svc.Select(
                new ReplyQuery()
            {
                OwnerID = OwnerID,
                Type    = (int)ReplyType.Text,
                RuleID  = _KeyWordGroup.ID
            }).FirstOrDefault();

            //不存在,则写入一条新纪录
            if (_Reply == null)
            {
                Reply _ReplyModel = new Reply();
                _ReplyModel.OwnerID = OwnerID;
                _ReplyModel.Type    = (int)ReplyType.Text;
                _ReplyModel.RuleID  = _KeyWordGroup.ID;

                svc.Create(_ReplyModel);

                _Reply = _ReplyModel;
            }

            //获取TextReply信息
            var _TextReplyItem = svc.Select(
                new TextReplyItemQuery()
            {
                RuleID   = _KeyWordGroup.ID,
                ParentID = _Reply.ID,
                OwnerID  = OwnerID
            }).FirstOrDefault();

            //不存在,则写入新纪录
            if (_TextReplyItem == null)
            {
                TextReplyItem _TextReplyItemModel = new TextReplyItem();
                _TextReplyItemModel.RuleID   = _KeyWordGroup.ID;
                _TextReplyItemModel.ParentID = _Reply.ID;
                _TextReplyItemModel.OwnerID  = OwnerID;
                _TextReplyItemModel.Content  = "";

                svc.Create(_TextReplyItemModel);

                _TextReplyItem = _TextReplyItemModel;
            }

            return(View(_TextReplyItem));
        }
Example #18
0
 /// <summary>
 /// 通知交易回報
 /// </summary>
 private static void MrWangConnection_OnTradingReply(Reply reply)
 {
     Console.WriteLine($"Status:{reply.OrderStatus} {reply.Side} " +
                       $"{reply.Qty} {reply.Symbol} @ {reply.Price} " +
                       $"{reply.orderType} {reply.TimeInForce}");
 }
Example #19
0
 public bool HasError(Reply r)
 {
     return _errors.Contains(r);
 }
Example #20
0
 public static void Respond(string userID, Reply reply)
 {
     Discord_Respond(userID, (int)reply);
 }
 public static extern void Respond(String userId, Reply reply);
Example #22
0
 public void AddReply(Reply r)
 {
     db.Replies.Add(r);
     db.SaveChanges();
 }
 private void ReplyMainBlock_CommentButtonClick(object sender, Reply e)
 {
     //_selectReplyId = e.rpid_str;
     //ReplyTextBox.AtUser = e.member.uname;
     //ReplyTextBox.PlaceholderText = $"回复 @{e.member.uname}:";
 }
Example #24
0
        public ActionResult ReplyMessage(MessageReplyViewModel vm, int messageId, string replyMessage, HttpPostedFileBase file)
        {
            try
            {
                var    username = User.Identity.Name;
                string fullName = "";
                if (!string.IsNullOrEmpty(username))
                {
                    fullName = username;
                }
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    string        savePath = "~/Images/Replies" + User.Identity.Name + "/";
                    DirectoryInfo dir      = new DirectoryInfo(HttpContext.Server.MapPath(savePath));
                    if (!dir.Exists)
                    {
                        dir.Create();
                    }
                    file = Request.Files[i];
                    file.SaveAs(HttpContext.Server.MapPath(savePath)
                                + file.FileName);
                    if (vm.Reply.ReplyVideo != null)
                    {
                        vm.Reply.ReplyVideo.Add(new Models.Media
                        {
                            Path = "/Images/Replies" + User.Identity.Name + "/" + file.FileName
                        });
                    }
                    else
                    {
                        vm.Reply.ReplyVideo = new List <Models.Media>
                        {
                            new Models.Media {
                                Path = "/Images/Replies" + User.Identity.Name + "/" + file.FileName
                            }
                        }
                    };
                }

                Reply _reply = new Reply();
                _reply.ReplyDateTime = DateTime.Now;
                _reply.MessageId     = messageId;
                _reply.ReplyFrom     = fullName;
                _reply.ReplyMessage  = vm.Reply.ReplyMessage;
                _reply.ReplyVideo    = vm.Reply.ReplyVideo;
                db.Replies.Add(_reply);
                db.SaveChanges();
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                               validationError.PropertyName,
                                               validationError.ErrorMessage);
                    }
                }
            }

            //reply to the message owner          - using email template

            var messageOwner = db.Messages.Where(x => x.Id == messageId).Select(s => s.From).FirstOrDefault();

            //var users = from user in db.Users
            //    orderby user.FirstName
            //    select new
            //    {
            //        FullName = user.FirstName + " " + user.LastName,
            //        UserEmail = user.Email
            //    };

            //var uemail = User.Identity.GetUserName().Where(x => x.ToString() == messageOwner).Select(s => s.UserEmail).FirstOrDefault();
            //SendGridMessage ReplyMessage = new SendGridMessage();
            //ReplyMessage.From = new MailAddress(username);
            //ReplyMessage.Subject = "Reply for your message :" + db.Messages.Where(i => i.Id == messageId).Select(s => s.Subject).FirstOrDefault();
            //ReplyMessage.Text = vm.Reply.ReplyMessage;


            //ReplyMessage.AddTo(uemail);


            //var credentials = new NetworkCredential("YOUR SENDGRID USERNAME", "PASSWORD");
            //var transportweb = new Web(credentials);
            //transportweb.DeliverAsync(ReplyMessage);
            return(RedirectToAction("Index", "Contestants", new { Id = messageId }));
            //return Json(new { Url = "Contestants/Index" }, JsonRequestBehavior.AllowGet);
        }
 public bool AddReply(Reply newReply)
 {
     throw new NotImplementedException();
 }
Example #26
0
        public async Task AddAsync(Reply reply)
        {
            await _dbContext.AddAsync(reply);

            await _dbContext.SaveChangesAsync();
        }
Example #27
0
        /// <summary>
        /// 发回复
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="reply"></param>
        /// <param name="usergroupinfo"></param>
        /// <param name="userinfo"></param>
        /// <param name="foruminfo"></param>
        /// <param name="topictitle"></param>
        /// <returns></returns>
        private PostInfo PostReply(int uid, Reply reply, UserGroupInfo usergroupinfo, ShortUserInfo userinfo, ForumInfo foruminfo, string topictitle)
        {
            int hide = 0;
            if (ForumUtils.IsHidePost(reply.Message) && usergroupinfo.Allowhidecode == 1)
            {
                hide = 1;
            }

            string curdatetime = Utils.GetDateTime();
            //int replyuserid = postinfo.Posterid;
            string replyTitle = reply.Title;
            if (replyTitle.Length >= 50)
            {
                replyTitle = Utils.CutString(replyTitle, 0, 50) + "...";
            }

            PostInfo postinfo = new PostInfo();
            postinfo.Fid = reply.Fid;
            postinfo.Tid = reply.Tid;
            postinfo.Parentid = 0;
            postinfo.Layer = 1;
            postinfo.Poster = (userinfo == null ? "游客" : userinfo.Username);
            postinfo.Posterid = uid;

            bool htmlon = reply.Message.Length != Utils.RemoveHtml(reply.Message).Length && usergroupinfo.Allowhtml == 1;
            string message = ForumUtils.BanWordFilter(reply.Message);
            if (!htmlon)
            {
                message = Utils.HtmlDecode(message);
            }
            postinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(replyTitle));
            postinfo.Message = message;
            postinfo.Postdatetime = curdatetime;

            postinfo.Ip = DNTRequest.GetIP();
            postinfo.Lastedit = "";
            postinfo.Debateopinion = 0;//DNTRequest.GetInt("debateopinion", 0);
            if (foruminfo.Modnewposts == 1 && usergroupinfo.Radminid != 1 && usergroupinfo.Radminid != 2)
            {
                postinfo.Invisible = 1;
            }
            else
            {
                postinfo.Invisible = 0;
            }

            // 如果当前用户非管理员并且论坛设定了发帖审核时间段,当前时间如果在其中的一个时间段内,则用户所发帖均为待审核状态
            if (usergroupinfo.Radminid != 1)
            {
                if (Scoresets.BetweenTime(Config.Postmodperiods))
                {
                    postinfo.Invisible = 1;
                }

                if (ForumUtils.HasAuditWord(postinfo.Title) || ForumUtils.HasAuditWord(postinfo.Message))
                {
                    postinfo.Invisible = 1;
                }
            }

            postinfo.Usesig = 1;//Utils.StrToInt(DNTRequest.GetString("usesig"), 0);
            postinfo.Htmlon = htmlon ? 1 : 0;

            postinfo.Smileyoff = 1 - foruminfo.Allowsmilies;

            postinfo.Bbcodeoff = 1;
            if (usergroupinfo.Allowcusbbcode == 1 && foruminfo.Allowbbcode == 1)
            {
                postinfo.Bbcodeoff = 0;
            }
            postinfo.Parseurloff = 0;
            postinfo.Attachment = 0;
            postinfo.Rate = 0;
            postinfo.Ratetimes = 0;
            postinfo.Topictitle = topictitle;

            // 产生新帖子
            int postid = Posts.CreatePost(postinfo);

            if (hide == 1)
            {
                Discuz.Forum.Topics.UpdateTopicHide(reply.Tid);
            }
            Discuz.Forum.Topics.UpdateTopicReplyCount(reply.Tid);
            //设置用户的积分
            ///首先读取版块内自定义积分
            ///版设置了自定义积分则使用,否则使用论坛默认积分
            float[] values = null;
            if (!foruminfo.Replycredits.Equals(""))
            {
                int index = 0;
                float tempval = 0;
                values = new float[8];
                foreach (string ext in Utils.SplitString(foruminfo.Replycredits, ","))
                {

                    if (index == 0)
                    {
                        if (!ext.Equals("True"))
                        {
                            values = null;
                            break;
                        }
                        index++;
                        continue;
                    }
                    tempval = Utils.StrToFloat(ext, 0.0f);
                    values[index - 1] = tempval;
                    index++;
                    if (index > 8)
                    {
                        break;
                    }
                }
            }

            if (postinfo.Invisible != 1 && userinfo != null)
            {
                if (values != null)
                {
                    ///使用版块内积分
                    UserCredits.UpdateUserExtCredits(uid, values);
                }
                else
                {
                    ///使用默认积分
                    UserCredits.UpdateUserCreditsByPosts(uid);
                }
            }
            postinfo.Pid = postid;
            return postinfo;
        }
Example #28
0
 public void AddReply(Reply nt)
 {
     db.Replies.Add(nt);
     db.SaveChanges();
 }
Example #29
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {  //Coneection String by default empty
        string ConStr = "";
        ResUpdateExcelUpdateStatus objResResUpdateExcelUpdateStatus = new ResUpdateExcelUpdateStatus();
        DataSet objDsExcel = new DataSet();
        //Extantion of the file upload control saving into ext because
        //there are two types of extation .xls and .xlsx of Excel
        string ext = Path.GetExtension(BtnExcelUpload.FileName).ToLower();
        //getting the path of the file
        string path = Server.MapPath("~/MyFolder/" + BtnExcelUpload.FileName);

        if (!path.Contains(".xls"))
        {
            Response.Write("<script type='text/javascript'>alert( 'Please select excel file XLS format.' )</script>");
            return;
        }

        //saving the file inside the MyFolder of the server
        BtnExcelUpload.SaveAs(path);
        //  Label1.Text = FileUpload1.FileName + "\'s Data showing into the GridView";
        //checking that extantion is .xls or .xlsx
        if (ext.Trim() == ".xls")
        {
            //connection string for that file which extantion is .xls
            ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
        }
        else if (ext.Trim() == ".xlsx")
        {
            //connection string for that file which extantion is .xlsx
            ConStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
        }
        //making query
        string query = "SELECT * FROM [Sheet1$]";
        //Providing connection
        OleDbConnection conn = new OleDbConnection(ConStr);

        //checking that connection state is closed or not if closed the
        //open the connection
        if (conn.State == ConnectionState.Closed)
        {
            conn.Open();
        }
        //create command object
        OleDbCommand cmd = new OleDbCommand(query, conn);
        // create a data adapter and get the data into dataadapter
        OleDbDataAdapter da = new OleDbDataAdapter(cmd);

        //fill the Excel data to data set
        da.Fill(objDsExcel);

        conn.Close();

        if (File.Exists(path))
        {
            File.Delete(path);
        }
        ///////////////////////////////////////
        Reply objRes = new Reply();

        // send request
        using (WebClient client = new WebClient())
        {
            if (Session["Role"].ToString() == "admin")
            {
                perameter = "all# #";
            }
            else
            {
                perameter = Session["Role"].ToString() + "#" + Session["Location"].ToString();
            }
            client.Headers[HttpRequestHeader.ContentType] = "text/json";
            ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;

            DataContractJsonSerializer objJsonSerSend = new DataContractJsonSerializer(typeof(string));

            MemoryStream memStrToSend = new MemoryStream();

            objJsonSerSend.WriteObject(memStrToSend, perameter);

            // string data = Encoding.Default.GetString(memStrToSend.ToArray());

            string result = client.UploadString(URL + "/GetAllTicketData", "POST", "\"" + perameter + "\"");  // , "\"" + perameter + "\"" |   GetDashBoardDetail |GetHealthTxnDataWithState

            MemoryStream memstrToReceive = new MemoryStream(Encoding.UTF8.GetBytes(result));

            DataContractJsonSerializer objJsonSerRecv = new DataContractJsonSerializer(typeof(Reply));

            objRes = (Reply)objJsonSerRecv.ReadObject(memstrToReceive);
        }

        if (objRes.res == true)
        {
            //DataSet DT = new DataSet();
            //DT = objDsExcel;
            //var ExcelRows = DT.Tables[0].AsEnumerable().Select(r => Convert.ToString(r.Field<Double>("Call Ticket Number")));
            //var AllTicketRows = objRes.DS.Tables[0].AsEnumerable().Select(r => r.Field<string>("TicketNUmber"));
            //IEnumerable<string> allIntersectingTicketNumber = ExcelRows.Intersect(AllTicketRows);
            //if (allIntersectingTicketNumber.Any())
            //{
            //    string firstIntersectingEmpName = allIntersectingTicketNumber.FirstOrDefault();
            //    if (firstIntersectingEmpName != null)
            //    {
            //        foreach (string empName in allIntersectingTicketNumber)
            //        {

            //        }
            //        //  yes, there was at least one EmpName that was in both tables
            //    }

            //}

            string strQuery    = "";
            int    TempCounter = 0;
            for (int i = 0; i < objDsExcel.Tables[0].Rows.Count; i++)
            {
                for (int index = 0; index < objRes.DS.Tables[0].Rows.Count; index++)
                {
                    if (objDsExcel.Tables[0].Rows[i]["Call Ticket Number"].ToString() != "" &&
                        objDsExcel.Tables[0].Rows[i]["Date Ticket Closed"].ToString() != "")
                    {
                        if (objDsExcel.Tables[0].Rows[i]["Call Ticket Number"].ToString().Trim() == objRes.DS.Tables[0].Rows[index]["TicketNUmber"].ToString().Trim())
                        {
                            DateTime ExcelDT = Convert.ToDateTime(objDsExcel.Tables[0].Rows[i]["Date Ticket Closed"]);
                            //   objSelectedFromDate = DateTime.ParseExact(ExcelDT, "dd-mm-yyyy HH:mm:ss", CultureInfo.InvariantCulture);

                            if (objRes.DS.Tables[0].Rows[index]["FlmSlm"].ToString() == "" || objRes.DS.Tables[0].Rows[index]["FlmSlm"].ToString() == null)
                            {
                                if (TempCounter != 0)
                                {
                                    strQuery += " UNION ALL";
                                }

                                strQuery += " update [KMSDB].[dbo].[IssueTable] set FlmSlm='" + objDsExcel.Tables[0].Rows[index]["Flm Slm"].ToString() + "' where " +
                                            " TicketNUmber='" + objRes.DS.Tables[0].Rows[index]["TicketNUmber"].ToString() + "' ; ";
                            }
                            if (objRes.DS.Tables[0].Rows[index]["CallClosedDT"].ToString() == "" || objRes.DS.Tables[0].Rows[index]["CallClosedDT"].ToString() == null)
                            {
                                if (TempCounter != 0)
                                {
                                    strQuery += " UNION ALL";
                                }

                                strQuery += " update [KMSDB].[dbo].[IssueTable] set Status = 'Call Closed' , CallClosedDT ='" + ExcelDT.ToString("yyyy-MM-dd HH:mm:ss") + "',FlmSlm='" + objDsExcel.Tables[0].Rows[index]["Flm Slm"].ToString() + "' where " +
                                            " TicketNUmber='" + objRes.DS.Tables[0].Rows[index]["TicketNUmber"].ToString() + "' ; ";

                                continue;
                            }

                            DateTime DBDT = Convert.ToDateTime(objRes.DS.Tables[0].Rows[index]["CallClosedDT"]);

                            if (ExcelDT < DBDT)
                            {
                                if (TempCounter != 0)
                                {
                                    strQuery += " UNION ALL";
                                }


                                strQuery += " update [KMSDB].[dbo].[IssueTable] set Status = 'Call Closed' ,  CallClosedDT='" + ExcelDT.ToString("yyyy-MM-dd HH:mm:ss") + "',FlmSlm='" + objDsExcel.Tables[0].Rows[index]["Flm Slm"].ToString() + "' where " +
                                            " TicketNUmber='" + objRes.DS.Tables[0].Rows[index]["TicketNUmber"].ToString() + "' ; ";
                            }
                        }
                    }
                }
            }
            ///////////////////////////////////////
            // send request
            if (strQuery != "")
            {
                using (WebClient client = new WebClient())
                {
                    if (Session["Role"].ToString() == "admin")
                    {
                        perameter = "all# #";
                    }
                    else
                    {
                        perameter = Session["Role"].ToString() + "#" + Session["Location"].ToString();
                    }
                    client.Headers[HttpRequestHeader.ContentType] = "text/json";
                    ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;


                    ReqUpdateExcelUpdateStatus objReqUpdateExcelUpdateStatus = new ReqUpdateExcelUpdateStatus();
                    objReqUpdateExcelUpdateStatus.strQuery = strQuery;
                    DataContractJsonSerializer objJsonSerSend = new DataContractJsonSerializer(typeof(ReqUpdateExcelUpdateStatus));

                    MemoryStream memStrToSend = new MemoryStream();

                    objJsonSerSend.WriteObject(memStrToSend, objReqUpdateExcelUpdateStatus);

                    string data = Encoding.Default.GetString(memStrToSend.ToArray());

                    string result = client.UploadString(URL + "/UpdateExcelData", "POST", data);  // , "\"" + perameter + "\"" |   GetDashBoardDetail |GetHealthTxnDataWithState

                    MemoryStream memstrToReceive = new MemoryStream(Encoding.UTF8.GetBytes(result));

                    DataContractJsonSerializer objJsonSerRecv = new DataContractJsonSerializer(typeof(ResUpdateExcelUpdateStatus));

                    objResResUpdateExcelUpdateStatus = (ResUpdateExcelUpdateStatus)objJsonSerRecv.ReadObject(memstrToReceive);


                    if (objResResUpdateExcelUpdateStatus.Result == true)
                    {
                        Response.Write("<script type='text/javascript'>alert( 'Excel Data Uploaded Sucessfully.' )</script>");
                    }
                    else
                    {
                        Response.Write("<script type='text/javascript'>alert( 'Failed to upload.' )</script>");
                    }
                }
            }
            else
            {
                Response.Write("<script type='text/javascript'>alert( 'No Record found for upload.' )</script>");
            }
        }
        else
        {
            Response.Write("<script type='text/javascript'>alert( 'Data Not Exist.' )</script>");
        }



        //  gvExcelFile.DataSource = ds.Tables[0];

        //  gvExcelFile.DataBind();
    }
Example #30
0
 internal static TResult OkResult <TResult>(this Reply <TResult> reply)
 {
     reply.IsOk().ShouldBeTrue(reply.Error.Print());
     return(reply.Result);
 }
    public void Reset()
    {
        if (audioUI != null)
            audioUI.alpha = 0;
        sprite.color = Color.white;
        sprite.alpha = 0;

        if (text != null)
            text.text = "";

        reply = null;
    }
Example #32
0
 internal static void ShouldBe <TResult>(this Reply <TResult> reply, TResult result)
 => reply.OkResult().ShouldBe(result, reply.Error.Print());
Example #33
0
		//start  Added by bobo 2013-8-16  System.BitConverter.ToUInt16(replyNode.Value.Data.ToArray(), 0); 
		static public UInt16 headerByReply(ref Reply reply)
		{
			return BitConverter.ToUInt16(reply.Data.ToArray(), 0);
		}
Example #34
0
 internal static void ShouldBe <TResult>(this Reply <FSharpList <TResult> > reply, params TResult[] results)
 => reply.OkResult().ShouldBe(results.ToFSharpList(), reply.Error.Print());
Example #35
0
 /// <summary>
 /// Adds a reply to the data context.
 /// </summary>
 /// <param name="reply">The reply to be added.</param>
 public void AddReply(Reply reply)
 {
     _entityContainer.Replies.Add(reply);
     _entityContainer.SaveChanges();
 }
Example #36
0
 internal static void ShouldBe <T>(this Reply <T> reply, ReplyStatus status)
 => reply.Status.ShouldBe(status, reply.Error.Print());
Example #37
0
 /// <summary>Sends a 'synchronous' request on this <code>SharedChannel</code>.</summary>
 /// <param name="ds"><code>DataStream</code> to send as this request's payload.</param>
 /// <returns>Reply Caller may block using this object to retrieve the reply
 /// to this request.</returns>
 /// <exception cref="BEEPException" />
 public virtual Reply sendRequest(OutputDataStream ds)
 {
     Reply r = new Reply();
     channel.sendMSG(ds, r);
     return r;
 }
Example #38
0
 internal static void ShouldBe <T, TError>(this Reply <T> reply, string message)
     where TError : ErrorMessage
 => reply.Error.AsEnumerable()
 .ShouldHaveSingleItem()
 .ShouldBeOfType <TError>()
 .Map(err => err switch
 public ReplyViewModel(Reply replay)
 {
     this.Author  = UserService.GetUser(replay.AuthorId).Username;
     this.Content = this.GetLines(replay.Content);
 }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtusername.Text == "" || txtusername.Text == null)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Please Enter The UserName');", true);
                txtusername.Focus();
                return;
            }

            if (txtPassword.Text == "" || txtPassword.Text == null)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Please Enter The Password with atleast one special charcter and a Capital latter');", true);
                txtPassword.Focus();
                return;
            }

            if (txtAnswer.Text == "" || txtAnswer.Text == null)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Please Enter Answer For Selected Question');", true);
                txtAnswer.Focus();
                return;
            }
            bool          ticked   = false;
            List <string> userrole = new List <string>();
            if (chkAdmin.Checked)
            {
                userrole.Add(chkAdmin.Text); ticked = true;
            }
            if (chkUser.Checked)
            {
                userrole.Add(chkUser.Text); ticked = true;
            }
            if (chkLocation.Checked)
            {
                userrole.Add(chkLocation.Text); ticked = true;
            }
            if (!ticked)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Please Select Atleast One Role');", true);
                return;
            }
            UserDetails objUserReq = new UserDetails();
            if (btnsubmit.Text == "Submit")
            {
                objUserReq.Username = txtusername.Text;
                objUserReq.Password = txtPassword.Text;
                string Role = string.Join("| ", userrole);
                if (txtLocation.Text != "" && chkLocation.Checked == true)
                {
                    objUserReq.Location = txtLocation.Text;
                }
                objUserReq.Role     = Role;
                objUserReq.Question = filterlist.SelectedValue.ToString();
                objUserReq.Answer   = txtAnswer.Text.ToString();

                if (objds == null)
                {
                    objds = new DataSet();
                }

                Reply objRes = new Reply();
                using (WebClient client = new WebClient())
                {
                    client.Headers[HttpRequestHeader.ContentType] = "text/json";

                    string     JsonString    = JsonConvert.SerializeObject(objUserReq);
                    EncRequest objEncRequest = new EncRequest();
                    objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                    string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

                    string result = client.UploadString(URL + "/Adduser", "POST", dataEncrypted);

                    EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                    objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                    JsonSerializer json = new JsonSerializer();
                    json.NullValueHandling = NullValueHandling.Ignore;
                    StringReader sr = new StringReader(objResponse.ResponseData);
                    Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
                    objRes = json.Deserialize <Reply>(reader);

                    if (objRes.res == true)
                    {
                        var page1 = HttpContext.Current.CurrentHandler as Page;
                        ScriptManager.RegisterStartupScript(page1, page1.GetType(), "alert", "alert('User Created Successfully' );window.location ='CreateUser.aspx';", true);
                        clearAll();
                    }
                    else
                    {
                        Response.Write("<script type='text/javascript'>alert( 'User Already Exist. / " + objRes.strError + "')</script>");
                        lblPassword.Text = "";
                    }
                    chkAdmin.Checked    = false;
                    chkUser.Checked     = false;
                    chkLocation.Checked = false;
                    chkUser.Enabled     = true;
                    chkAdmin.Enabled    = true;
                }
            }
            else
            {
                objUserReq.Username = txtusername.Text;
                objUserReq.Password = txtPassword.Text;
                string Role = string.Join("| ", userrole);
                if (txtLocation.Text != "" && chkLocation.Checked == true)
                {
                    objUserReq.Location = txtLocation.Text;
                }
                objUserReq.Role     = Role;
                objUserReq.Question = filterlist.SelectedValue.ToString();
                objUserReq.Answer   = txtAnswer.Text.ToString();

                if (objds == null)
                {
                    objds = new DataSet();
                }

                Reply objRes = new Reply();
                using (WebClient client = new WebClient())
                {
                    client.Headers[HttpRequestHeader.ContentType] = "text/json";

                    string     JsonString    = JsonConvert.SerializeObject(objUserReq);
                    EncRequest objEncRequest = new EncRequest();
                    objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                    string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

                    string result = client.UploadString(URL + "/UpdateUser", "POST", dataEncrypted);

                    EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                    objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                    JsonSerializer json = new JsonSerializer();
                    json.NullValueHandling = NullValueHandling.Ignore;
                    StringReader sr = new StringReader(objResponse.ResponseData);
                    Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
                    objRes = json.Deserialize <Reply>(reader);

                    if (objRes.res == true)
                    {
                        var page1 = HttpContext.Current.CurrentHandler as Page;
                        ScriptManager.RegisterStartupScript(page1, page1.GetType(), "alert", "alert('User Update Successfully' );window.location ='ViewUser.aspx';", true);
                    }
                    else
                    {
                        Response.Write("<script type='text/javascript'>alert( 'User Already Exist. / " + objRes.strError + "')</script>");
                        lblPassword.Text = "";
                    }
                }
            }
        }
        catch (Exception excp)
        {
            Response.Write("<script type='text/javascript'>alert( 'Error catch " + excp.Message + "')</script>");
        }
    }
Example #41
0
        /// <summary>
        /// Creates a new reply to a comment.
        /// Documentation https://developers.google.com/drive/v3/reference/replies/create
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Drive service.</param>
        /// <param name="fileId">The ID of the file.</param>
        /// <param name="commentId">The ID of the comment.</param>
        /// <param name="body">A valid Drive v3 body.</param>
        /// <returns>ReplyResponse</returns>
        public static Reply Create(DriveService service, string fileId, string commentId, Reply body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (fileId == null)
                {
                    throw new ArgumentNullException(fileId);
                }
                if (commentId == null)
                {
                    throw new ArgumentNullException(commentId);
                }

                // Make the request.
                return(service.Replies.Create(body, fileId, commentId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Replies.Create failed.", ex);
            }
        }
Example #42
0
        public void InsertReply()
        {
            Reply r = new Reply()
            {
                Body = "New Reply",
                TopicId = 1,
                Created = DateTime.UtcNow
            };
            //before insert
            var replycount = MockRepo.GetReplies().Count();
            Assert.AreEqual(replycount, 4);

            //insert
            MockRepo.InsertReply(r);
            replycount = MockRepo.GetReplies().Count();
            Assert.AreEqual(replycount, 5);
        }
Example #43
0
        /// <summary>
        /// 发回复
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="reply"></param>
        /// <param name="usergroupinfo"></param>
        /// <param name="userinfo"></param>
        /// <param name="foruminfo"></param>
        /// <param name="topictitle"></param>
        /// <returns></returns>
        public static PostInfo PostReply(Reply reply, UserGroupInfo usergroupinfo, ShortUserInfo userinfo, ForumInfo foruminfo, string topictitle, int disablePost, bool hasAudit)
        {
            int hide = ForumUtils.IsHidePost(reply.Message) && usergroupinfo.Allowhidecode == 1 ? 1 : 0;
            string curdatetime = Utils.GetDateTime();
            if (reply.Title.Length >= 50)
                reply.Title = Utils.CutString(reply.Title, 0, 50) + "...";

            PostInfo postinfo = new PostInfo();
            postinfo.Fid = reply.Fid;
            postinfo.Tid = reply.Tid;
            postinfo.Parentid = 0;
            postinfo.Layer = 1;
            postinfo.Poster = (userinfo == null ? "游客" : userinfo.Username);
            postinfo.Posterid = userinfo.Uid;

            bool htmlon = reply.Message.Length != Utils.RemoveHtml(reply.Message).Length && usergroupinfo.Allowhtml == 1;
            reply.Message = !htmlon ? Utils.HtmlDecode(reply.Message) : reply.Message;
            postinfo.Title = Utils.HtmlEncode(reply.Title);
            postinfo.Message = reply.Message;
            postinfo.Postdatetime = curdatetime;

            postinfo.Ip = DNTRequest.GetIP();
            postinfo.Lastedit = "";
            postinfo.Debateopinion = 0;
            postinfo.Invisible = disablePost != 1 ? foruminfo.Modnewposts : 0;
            if (postinfo.Invisible != 1 && disablePost != 1)
                postinfo.Invisible = Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods) || hasAudit ? 1 : 0;

            postinfo.Usesig = 1;
            postinfo.Htmlon = htmlon ? 1 : 0;

            postinfo.Smileyoff = 1 - foruminfo.Allowsmilies;
            postinfo.Bbcodeoff = usergroupinfo.Allowcusbbcode == 1 && foruminfo.Allowbbcode == 1 ? 0 : 1;
            postinfo.Parseurloff = 0;
            postinfo.Attachment = 0;
            postinfo.Rate = 0;
            postinfo.Ratetimes = 0;
            postinfo.Topictitle = topictitle;

            // 产生新帖子
            int postid = Posts.CreatePost(postinfo);

            if (hide == 1)
                Discuz.Forum.Topics.UpdateTopicHide(reply.Tid);

            Discuz.Forum.Topics.UpdateTopicReplyCount(reply.Tid);
            //设置用户的积分
            ///首先读取版块内自定义积分
            ///版设置了自定义积分则使用,否则使用论坛默认积分
            if (postinfo.Invisible == 0 && userinfo != null)
                CreditsFacade.PostReply(userinfo.Uid, foruminfo);
            //float[] values = null;
            //if (!foruminfo.Replycredits.Equals(""))
            //{
            //    int index = 0;
            //    float tempval = 0;
            //    values = new float[8];
            //    foreach (string ext in Utils.SplitString(foruminfo.Replycredits, ","))
            //    {
            //        if (index == 0)
            //        {
            //            if (!ext.Equals("True"))
            //            {
            //                values = null;
            //                break;
            //            }
            //            index++;
            //            continue;
            //        }
            //        tempval = Utils.StrToFloat(ext, 0.0f);
            //        values[index - 1] = tempval;
            //        index++;
            //        if (index > 8)
            //        {
            //            break;
            //        }
            //    }
            //}

            //if (postinfo.Invisible != 1 && userinfo != null)
            //{
            //    if (values != null)
            //    {
            //        ///使用版块内积分
            //        UserCredits.UpdateUserExtCredits(userinfo.Uid, values, false);
            //    }
            //    else
            //    {
            //        ///使用默认积分
            //        UserCredits.UpdateUserCreditsByPosts(userinfo.Uid);
            //    }
            //}
            postinfo.Pid = postid;
            return postinfo;
        }
Example #44
0
        public Reply GetReply(int id)
        {
            Reply reply = db.Replies.Where(r => r.ReplyId == id).SingleOrDefault();

            return(reply);
        }
Example #45
0
 public ReplyViewModel(Reply reply)
 {
     Author  = UserService.GetUser(reply.AuthorId).Username;
     Content = GetLines(reply.Content);
 }
 public void Delete(Reply Reply)
 {
     _context.Reply.Remove(Reply);
 }
Example #47
0
 /// <summary>
 /// 通知交易回報
 /// </summary>
 private static void MrWangConnection_OnTradingReply(Reply reply)
 {
 }
Example #48
0
        public async Task <IActionResult> Delete(int id)
        {
            // Validate
            if (id <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(id));
            }

            // Get history point
            var history = await _entityHistoryStore.GetByIdAsync(id);

            // Ensure we found the entity
            if (history == null)
            {
                return(NotFound());
            }

            // Get entity
            var entity = await _entityStore.GetByIdAsync(history.EntityId);

            // Ensure we found the entity
            if (entity == null)
            {
                return(NotFound());
            }

            // Get reply
            Reply reply = null;

            if (history.EntityReplyId > 0)
            {
                reply = await _entityReplyStore.GetByIdAsync(history.EntityReplyId);

                // Ensure we found a reply if supplied
                if (reply == null)
                {
                    return(NotFound());
                }
            }

            // Ensure we have permission
            if (!await _authorizationService.AuthorizeAsync(HttpContext.User,
                                                            entity.CategoryId, reply != null
                    ? Permissions.DeleteReplyHistory
                    : Permissions.DeleteEntityHistory))
            {
                return(Unauthorized());
            }

            // Delete history point
            var result = await _entityHistoryManager.DeleteAsync(history);

            // Add result
            if (result.Succeeded)
            {
                // Update edit details for entity or reply based on latest history point
                var entityResult = await ApplyLatestHistoryPoint(entity, reply);

                if (entityResult.Succeeded)
                {
                    _alerter.Success(T["Version Deleted Successfully!"]);
                }
                else
                {
                    foreach (var error in entityResult.Errors)
                    {
                        _alerter.Danger(T[error.Description]);
                    }
                }
            }
            else
            {
                foreach (var error in result.Errors)
                {
                    _alerter.Danger(T[error.Description]);
                }
            }

            // Redirect
            return(Redirect(_contextFacade.GetRouteUrl(new RouteValueDictionary()
            {
                ["area"] = "Plato.Discuss",
                ["controller"] = "Home",
                ["action"] = "Reply",
                ["opts.id"] = entity.Id,
                ["opts.alias"] = entity.Alias,
                ["opts.replyId"] = reply?.Id ?? 0
            })));
        }
Example #49
0
        /// <summary>
        /// 댓글을 반환하는 함수
        /// </summary>
        /// <param name="cmtSrc">댓글을 포함하는 HTML 소스</param>
        /// <param name="gall">갤러리 정보를 가진 GalleryInfo 객체</param>
        /// <param name="id">댓글이 달린 게시물의 ID</param>
        /// <returns></returns>
        public static Reply[] BuildReplies(string cmtSrc, GalleryInfo gall, int id)
        {
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(cmtSrc);

            List<Reply> replies = new List<Reply>();

            foreach(HtmlNode trow in doc.DocumentNode.Descendants("tr").Where(x=>x.GetAttributeValue("class", "") == "reply_line"))
            {
                UserInfo userInfo = null;
                string content = null;
                string date = null;
                string ip = null;

                foreach(HtmlNode td in trow.Descendants("td"))
                {
                    if(td.GetAttributeValue("class", "").Contains("user")) // 유저 정보
                    {
                        string userid = td.GetAttributeValue("user_id", "");
                        if (userid == "") //유동
                        {
                            string user_name = td.GetAttributeValue("user_name", "");
                            userInfo = new UserInfo(user_name);
                        }
                        else // 고닉
                        {
                            HtmlNode imgNode = td.SelectNodes(".//img")[0];
                            string src = imgNode.GetAttributeValue("src", "");
                            string user_name = td.GetAttributeValue("user_name", "");
                            string gallogLink = ExtractGallogURL(imgNode.GetAttributeValue("onClick", ""));
                            if (src.Contains("g_default")) // 유동고닉
                            {
                                userInfo = new UserInfo(user_name, userid, false, gallogLink);
                            }
                            else // 고정닉
                            {
                                userInfo = new UserInfo(user_name, userid, true, gallogLink);
                            }
                        }
                    }
                    else if(td.GetAttributeValue("class", "") == "reply")
                    {
                        IEnumerable<HtmlNode> ipNode = td.Descendants("span");
                        if(ipNode.Count()!= 0)
                        {
                            ip = ipNode.First().InnerText;
                            ipNode.First().Remove();
                        }

                        
                        content = td.InnerHtml.Replace("\n", "");
                    }
                    else if(td.GetAttributeValue("class", "") == "retime")
                    {
                        date = td.InnerText;
                    }
                }

                Reply rep = new Reply(gall, id, userInfo, content, ip, date);
                replies.Add(rep);
            }

            return replies.ToArray();
        }
Example #50
0
		protected virtual void OnDisconnect(int e)
		{
			lock(mLock)
			{
				mNetState = ENetState.ES_Disconnect;
					
				Reply reply = new Reply();
				reply.Type = EReplyType.RT_Disconnect;
				reply.e = e;
				mReplyList.AddLast(reply);
			}
		}
Example #51
0
        /// <summary>
        /// Get the <see cref="MessageTypeAttribute"/> associated with <paramref name="reply"/>
        /// </summary>
        /// <param name="reply">The <see cref="Reply"/> whose attributes are returned</param>
        /// <returns><see cref="MessageTypeAttribute"/></returns>
        public static MessageTypeAttribute GetReplyAttributes(Reply reply)
        {
            MessageTypeAttribute retval = new MessageTypeAttribute(MessageType.ServerMessage);
            var type = typeof(Reply);
            var info = type.GetMember(reply.ToString());

            retval.Source = string.Format("[{0}]", Strings_Connection.Unknown);
            if (info.Length > 0)
            {
                var attributes = info[0].GetCustomAttributes(typeof(MessageTypeAttribute), false);
                if (attributes.Length > 0)
                {
                    retval = (MessageTypeAttribute)attributes[0];
                    if (retval.MessageType == MessageType.ErrorMessage)
                    {
                        retval.Source = string.Format("[{0}]", Strings_Connection.Error);
                    }
                    else
                    {
                        retval.Source = Strings_General.ReplySource;
                    }
                }
            }

            return retval;
        }
Example #52
0
		protected virtual void OnDataReply(byte[] data)
		{
			lock(mLock)
			{
				Reply reply = new Reply();
				reply.Type = EReplyType.RT_DataReply;
				reply.Data = new List<byte>();
				for (int i=0; i<data.Length; ++i)
				{
					reply.Data.Add(data[i]);
				}
				mReplyList.AddLast(reply);
			}
		}
Example #53
0
    protected void btn_login_Click(object sender, EventArgs e)
    {
        try
        {
            if (Div_SSOBody.Visible != true)
            {
                if ((!string.IsNullOrEmpty(txtPassword.Text)) && (!string.IsNullOrEmpty(txtUserName.Text)))
                {
                    Reply objRes = new Reply();
                    try
                    {
                        if (txtUserName.Text == "" || txtUserName.Text == null)
                        {
                            txtUserName.Text = "";
                            txtUserName.Text = "";
                            Response.Write("<script>alert('Kindly enter username')</script>");
                            return;
                        }
                        if (txtPassword.Text == "" || txtPassword.Text == null)
                        {
                            txtUserName.Text = "";
                            txtPassword.Text = "";
                            Response.Write("<script>alert('Kindly enter password')</script>");
                            return;
                        }

                        UserLogin userLogin      = new UserLogin();
                        var       decodedString1 = Base64.Decode(txtUserName.Text);
                        userLogin.UserName = Convert.ToString(TrimString(System.Text.Encoding.UTF8.GetString(decodedString1), '&'));
                        var decodedString2 = Base64.Decode(txtPassword.Text);
                        userLogin.Password = Convert.ToString(TrimString(System.Text.Encoding.UTF8.GetString(decodedString2), '*'));
                        WebClient objWC = new WebClient();
                        objWC.Headers[HttpRequestHeader.ContentType] = "text/json";

                        string     JsonString    = JsonConvert.SerializeObject(userLogin);
                        EncRequest objEncRequest = new EncRequest();
                        objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                        string EncData = JsonConvert.SerializeObject(objEncRequest);
                        string result  = objWC.UploadString(URL + "/User_login", "POST", EncData);

                        EncResponse objEncResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                        objEncResponse.ResponseData = AesGcm256.Decrypt(objEncResponse.ResponseData);

                        JsonSerializer json = new JsonSerializer();
                        json.NullValueHandling = NullValueHandling.Ignore;
                        StringReader sr = new StringReader(objEncResponse.ResponseData);
                        Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
                        objRes = json.Deserialize <Reply>(reader);

                        if (objRes.res == true)
                        {
                            if (objRes.DS.Tables[0].Rows[0]["Credential_type"].ToString().ToLower().Trim() == "admin")
                            {
                                globle.BankName        = ConfigurationManager.AppSettings["BankName"].ToString();
                                globle.CallLogRequired = ConfigurationManager.AppSettings["CallLogRequired"].ToString();

                                Session["Username"] = userLogin.UserName;
                                Session["Role"]     = objRes.DS.Tables[0].Rows[0]["credential_type"].ToString();
                                Session["Location"] = "";
                                Session["PF_Index"] = "";

                                globle.UserValue = userLogin.UserName;
                                globle.Role      = "admin";
                                globle.Location  = "";
                                globle.PF_Index  = "LIP3";

                                Response.Redirect("Dashboard-V3_1.aspx", false);
                                Context.ApplicationInstance.CompleteRequest();
                            }
                            else if (objRes.DS.Tables[0].Rows[0]["Credential_type"].ToString().ToLower().Trim() == "user")
                            {
                                globle.BankName        = ConfigurationManager.AppSettings["BankName"].ToString();
                                globle.CallLogRequired = ConfigurationManager.AppSettings["CallLogRequired"].ToString();

                                Session["Username"] = userLogin.UserName;
                                Session["Role"]     = "Nonadmin";
                                Session["Location"] = "";
                                Session["PF_Index"] = "";

                                globle.UserValue = userLogin.UserName;
                                globle.Role      = "Nonadmin";
                                globle.Location  = "";

                                Response.Redirect("Dashboard-V3_1.aspx", false);
                                Context.ApplicationInstance.CompleteRequest();
                            }
                            else
                            {
                                txtUserName.Text = "";
                                txtPassword.Text = "";
                                Response.Write("<script>alert('Invalid Username Password')</script>");
                            }
                        }

                        else
                        {
                            txtUserName.Text = "";
                            txtPassword.Text = "";
                            Response.Write("<script>alert('Invalid Username Password')</script>");
                        }
                    }
                    catch (Exception ex)
                    {
                        txtUserName.Text = "";
                        txtPassword.Text = "";
                    }
                }
                else
                {
                    PageUtility.MessageBox(this, "Filed is empty ! Try again");
                }
            }
            else
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                if (lbl_PF.Text.ToLower().Contains("lip"))
                {
                    globle.BankName        = ConfigurationManager.AppSettings["BankName"].ToString();
                    globle.CallLogRequired = ConfigurationManager.AppSettings["CallLogRequired"].ToString();
                    Session["Username"]    = lbl_name.Text;
                    Session["Role"]        = "admin";
                    Session["Location"]    = "";
                    Session["PF_Index"]    = lbl_PF.Text;
                    globle.UserValue       = lbl_name.Text;

                    globle.Role     = "admin";
                    globle.Location = "";
                    globle.PF_Index = lbl_PF.Text;


                    Response.Redirect("Dashboard-V3_1.aspx", false);
                    Context.ApplicationInstance.CompleteRequest();
                }
                else
                {
                    globle.BankName        = ConfigurationManager.AppSettings["BankName"].ToString();
                    globle.CallLogRequired = ConfigurationManager.AppSettings["CallLogRequired"].ToString();
                    Session["Username"]    = lbl_name.Text;
                    Session["Role"]        = "Nonadmin";
                    Session["Location"]    = "";
                    Session["PF_Index"]    = lbl_PF.Text;
                    globle.UserValue       = lbl_name.Text;

                    globle.Role     = "Nonadmin";
                    globle.Location = "";
                    globle.PF_Index = lbl_PF.Text;

                    Response.Redirect("Dashboard-V3_1.aspx", false);
                    Context.ApplicationInstance.CompleteRequest();
                }
            }
        }
        catch (Exception ex)
        {
            PageUtility.MessageBox(this, "Exception: -" + ex.Message + "");
        }
    }
    public void RepeterData()
    {
        try
        {
            iTotResolved = 0;
            iTotPending  = 0;
            iTotTicket   = 0;
            Reply objRes = new Reply();
            // send request
            using (WebClient client = new WebClient())
            {
                if (Session["Role"].ToString().ToLower().Contains("admin"))
                {
                    parameter = "all#";
                }
                else
                {
                    parameter = Session["Role"].ToString() + "#" + Session["Location"].ToString();
                }

                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                string     JsonString    = JsonConvert.SerializeObject(parameter);
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

                string result = client.UploadString(URL + "/GetIssueList", "Post", dataEncrypted);  //   GetDashBoardDetail |GetLastTransactionDetail

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //objRes = (Reply)objDCS.ReadObject(objMS);


                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.JsonSerializer();
                json.NullValueHandling = NullValueHandling.Ignore;
                StringReader sr = new StringReader(objResponse.ResponseData);
                Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
                objRes = json.Deserialize <Reply>(reader);

                if (objRes.res == true)
                {
                    //1. pending list
                    objRes.DS.Tables[0].DefaultView.RowFilter = "RequestType = 'open'";
                    RepeaterPendingIssue.DataSource           = objRes.DS.Tables[0].DefaultView;
                    RepeaterPendingIssue.DataBind();
                    RepeaterTickets.DataSource = objRes.DS.Tables[0].DefaultView;
                    RepeaterTickets.DataBind();
                    iTotPending = objRes.DS.Tables[0].DefaultView.Count;

                    //2. resolved list - Resolved
                    objRes.DS.Tables[0].DefaultView.RowFilter = "RequestType = 'close'";
                    RepeaterResolvedIssue.DataSource          = objRes.DS.Tables[0].DefaultView;
                    RepeaterResolvedIssue.DataBind();
                    iTotResolved = objRes.DS.Tables[0].DefaultView.Count;

                    iTotTicket = iTotPending + iTotResolved;
                }
                else
                {
                    Response.Write("<script type='text/javascript'>alert('Data Not Found  ')</script>");
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script type='text/javascript'>alert('catch error : " + ex.Message + "  ')</script>");
        }
    }
Example #55
0
 internal AuthenticateReply(Reply reply)
     : base(reply)
 {
 }
Example #56
0
 public static extern void Discord_Respond(string userId, Reply reply);
 public void Create(Reply Reply)
 {
     _context.Reply.Add(Reply);
 }
Example #58
0
 /// <summary>
 /// Adds a reply to the data context.
 /// </summary>
 /// <param name="reply">The reply to be added.</param>
 public void AddReply(Reply reply)
 {
     _entityContainer.Replies.Add(reply);
     _entityContainer.SaveChanges();
 }
 public void Update(Reply Reply)
 {
     _context.Entry<Reply>(Reply).State = EntityState.Modified;
 }
Example #60
0
 /// <summary>
 /// Updates an existing reply in the data context.
 /// </summary>
 /// <param name="reply">The reply to be updated.</param>
 public void UpdateReply(Reply reply)
 {
     _entityContainer.SaveChanges();
 }