//[DllImport("winmm.dll",CharSet = CharSet.Ansi)] //public static extern long mciSendString(string command, StringBuilder retString, int returnPath, IntPtr callBack); //public ContactStudents() //{ // mciSendString("open new Type waveaudio alias recsound ", null, 0, IntPtr.Zero); // //mciSendString("set capture samplespersec 11025", null, 0, IntPtr.Zero);//11025,22050,44100 // //mciSendString("set capture channels 1", null, 0, IntPtr.Zero); //} //[System.Web.Services.WebMethod] //public static void RecordVoice()//(string userID, string idOnChat, string idGrp, Object msg, int idMsgReplayed) //{ // mciSendString("record recsound", null, 0, IntPtr.Zero); //} //[System.Web.Services.WebMethod] //public static string SaveVoice(string userID, string idOnChat, string idGrp, string msg, int idMsgReplayed) //{ // const int flagVoice = 2; // var voice = Functions.MessageJs.InsertMessage(userID, idOnChat, idGrp, msg, idMsgReplayed, flagVoice, ".wav"); // JObject jsonVoice = JObject.Parse(voice.Substring(1, voice.Length - 2)); // var path = System.Web.Hosting.HostingEnvironment.MapPath("~/Contact/SoundRecorder"); // string command = "save recsound \"" + path + "\\" + jsonVoice["ChatID_P"] + ".wav \""; // mciSendString("pause recsound", null, 0, IntPtr.Zero); // mciSendString(command, null, 0, IntPtr.Zero); // mciSendString("close recsound", null, 0, IntPtr.Zero); // return voice; //} public void RfrhDtLstMessage(bool flagGroup) { DtLstMesages.DataSource = null; DtLstMesages.DataBind(); DataTable dt; if (flagGroup == false && TxtIdOnChat.Text.Trim() != "") { LblNameOnChat.Text = "گفتگو شخصی"; dt = MessagePersonalBuisnes.GetMessagePersonal(userID_Student, TxtIdOnChat.Text); } else { LblNameOnChat.Text = "گفتگو دفاع"; dt = MesageGroupBuisnes.GetMessageGroup(userID_Student, userID_Student); } if (dt != null && dt.Rows.Count > 0) { dt = Functions.AddDefualt.GetDefualt(dt); DtLstMesages.DataSource = dt; DtLstMesages.DataBind(); if (dt.Rows[dt.Rows.Count - 1]["ChatID"] != null) { LblLastIdChat.Text = dt.Rows[dt.Rows.Count - 1]["ChatID"].ToString(); } } }
public void RfrhDtLstMessage(bool flagGroup) { DtLstMesages.DataSource = null; DtLstMesages.DataBind(); DataTable dt; if (flagGroup == false && TxtIdOnChat.Text.Trim() != "") { dt = MessagePersonalBuisnes.GetMessagePersonal(userID_Ostad, TxtIdOnChat.Text); } else { dt = null; // dt = MesageGroupBuisnes.GetMessageGroup(userID_Ostad); } if (dt != null && dt.Rows.Count > 0) { DtLstMesages.DataSource = dt; DtLstMesages.DataBind(); } }
public void RfrhDtLstMessage(bool flagGroup) { DtLstMesages.DataSource = null; DtLstMesages.DataBind(); DataTable dt; if (flagGroup == false && TxtIdOnChat.Text.Trim() != "") { LblNameOnChat.Text = "گفتگو شخصی"; dt = MessagePersonalBuisnes.GetMessagePersonal(txtStCode.Text, TxtIdOnChat.Text); } else { LblNameOnChat.Text = "گفتگو دفاع"; dt = MesageGroupBuisnes.GetMessageGroup(txtStCode.Text, txtStCode.Text); } if (dt != null && dt.Rows.Count > 0) { dt = GetDefualt(dt); DtLstMesages.DataSource = dt; DtLstMesages.DataBind(); } }
public void ProcessRequest(HttpContext context) { if (context.Request.Form.Count > 0) { string userID = context.Request.Params["userID"]; string idOnChat = context.Request.Params["idOnChat"]; string idGrp = context.Request.Params["idGrp"]; string idChatLast = context.Request.Params["idChatLast"]; //Fetch the Uploaded File. DataTable dt = null; if (userID.Trim() != "" && userID != "undefined" && idChatLast.Trim() != "" && idChatLast != "undefined" && idGrp != "undefined" && idOnChat != "undefined") { if (idGrp.Trim() != "") { dt = MesageGroupBuisnes.GetMessageGroup(userID, idGrp, idChatLast); } else if (idOnChat.Trim() != "") { dt = MessagePersonalBuisnes.GetMessagePersonal(userID, idOnChat, idChatLast); } if (dt != null && dt.Rows.Count > 0) { JavaScriptSerializer serializer = new JavaScriptSerializer(); List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >(); Dictionary <string, object> row; foreach (DataRow dr in dt.Rows) { row = new Dictionary <string, object>(); foreach (DataColumn col in dt.Columns) { row.Add(col.ColumnName, dr[col]); if (col.ColumnName == "Images") { row["Images"] = System.Convert.ToBase64String((byte[])row["Images"]); } } rows.Add(row); } string daresult = serializer.Serialize(rows); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.ContentType = "text/json"; if (daresult != null && daresult.Length > 0) { context.Response.Write(daresult); } else { context.Response.Write(""); } context.Response.End(); } } else { context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.ContentType = "text/json"; context.Response.Write(""); context.Response.End(); } } }