public bool Ok(string data) { if (data.Trim() != "" && data.Trim() != null && data.Length > 0) { if (_chat.Get_ID() == 0) { _chat.Save(); } MChatEntry entry = new MChatEntry(_chat, data); bool saved = entry.Save(); return(saved); } return(false); //else //{ // ShowMessage.Info("PleaseEnterText", null, "", ""); // btnOK.IsEnabled = true; // SetBusy(false); // rtxtEnter.Focus(); //} }
/// <summary> /// Get History as text from data base using Html display formate /// </summary> /// <param name="ConfidentialType">confidential type</param> /// <returns>text from control</returns> public ChatInfo GetHistory(String confidentialType, MChat _chat, int page, int pageSize, Ctx ctx) { ChatInfo cinfo = new ChatInfo(); GetEntries(true, _chat.GetCM_Chat_ID(), page, pageSize, ctx);//array list status StringBuilder strName = new StringBuilder(); List <LatestSubscribedRecordChat> subscribedChat = new List <LatestSubscribedRecordChat>(); //List<int> imgIds = new List<int>(); List <UserImages> imgIds = new List <UserImages>(); DataSet ds = null; //ring img = null; int imgID = 0; for (int i = 0; i < _chatEntries.Length; i++) { //olean first = true; MChatEntry entry = _chatEntries[i]; //get the created date of a perticular chat from PO _createdDate = entry.GetCreated(); _format = DateTime.SpecifyKind(new DateTime(_createdDate.Year, _createdDate.Month, _createdDate.Day, _createdDate.Hour, _createdDate.Minute, _createdDate.Second), DateTimeKind.Utc); _createdDate = _format; if (!entry.IsActive() || !entry.IsConfidentialTypeValid(confidentialType)) { continue; } //status for first chat string sql = "SELECT au.name, aimg.ad_image_id FROM ad_user au LEFT OUTER JOIN ad_image aimg"; sql += " ON(au.ad_image_id= aimg.ad_image_id) where au.ad_user_id =" + entry.GetCreatedBy(); ds = DB.ExecuteDataset(sql, null); if (ds.Tables[0].Rows.Count > 0) { strName.Clear(); strName.Append(ds.Tables[0].Rows[0]["NAME"].ToString()); //if (ds.Tables[0].Rows[0]["BINARYDATA"] != null && ds.Tables[0].Rows[0]["BINARYDATA"] != DBNull.Value) //{ // img = Convert.ToBase64String((Byte[])ds.Tables[0].Rows[0]["BINARYDATA"]); //} imgID = Util.GetValueOfInt(ds.Tables[0].Rows[0]["ad_image_id"]); if (imgIds.Where(a => a.AD_Image_ID == imgID).Count() == 0) { UserImages uimsg = new UserImages(); uimsg.AD_Image_ID = imgID; MImage mimg = new MImage(ctx, imgID, null); uimsg.UserImg = mimg.GetThumbnailURL(46, 46); imgIds.Add(uimsg); } } subscribedChat.Add(new LatestSubscribedRecordChat() { //UserImg = img, UserName = strName.ToString(), ChatData = entry.GetCharacterData(), ChatDate = _createdDate, AD_Image_ID = imgID, AD_User_ID = entry.GetCreatedBy() } ); } cinfo.subChat = subscribedChat; cinfo.userimages = imgIds; return(cinfo); }