private Guid GetUserID() { DataBridgeConnector dbc = new DataBridgeConnector(""); object[] objArray = new object[1]; objArray.SetValue(GetProfile().UserName, 0); DataSet ds = dbc.GetSqlDataSet("sp_UP_GetUserID", objArray); return((Guid)ds.Tables[0].Rows[0]["UserID"]); }
private void BindGridView() { DataBridgeConnector dbc = new DataBridgeConnector(string.Empty); object[] objArray = new object[1]; objArray.SetValue(GetProfile().UserName, 0); DataSet ds = dbc.GetSqlDataSet("sp_UP_GetListOfUsers", objArray); gvUserList.DataSource = ds.Tables[0].DefaultView; gvUserList.DataBind(); }
private void BindGridView() { DataBridgeConnector dbc = new DataBridgeConnector(System.Configuration.ConfigurationManager.ConnectionStrings["Linkview"].ToString()); object[] objArray = new object[1]; objArray.SetValue(GetProfile().UserName, 0); DataSet ds = dbc.GetSqlDataSet("sp_UP_GetListOfUsers", objArray); gvUserListContact.DataSource = ds.Tables[0].DefaultView; gvUserListContact.DataBind(); }
public ActionResult <string> SendMail(int id, string mobiRecipient, string email) { DataBridgeConnector dbc = new DataBridgeConnector(Configuration.GetConnectionString("SMTPdb")); object[] objArray2 = new object[1]; objArray2.SetValue(id, 0); DataSet ds2 = dbc.GetSqlDataSet("sp_UP_GetVideoByID", objArray2); string videoPath = ds2.Tables[0].Rows[0]["VideoPath"].ToString(); string messageText = ds2.Tables[0].Rows[0]["MessageText"].ToString(); string videoName = ds2.Tables[0].Rows[0]["VideoName"].ToString(); string origText = messageText; var apiKey = Configuration["API:SMTPAPI"]; var client = new SendGridClient(apiKey); var msg = new SendGridMessage(); msg.SetFrom(new EmailAddress(Configuration["Email:FromAddress"], "Linkview Video")); List <EmailAddress> eAddress = new List <EmailAddress>(); if (!string.IsNullOrEmpty(email)) { eAddress.Add(new EmailAddress(email)); } msg.AddTos(eAddress); msg.SetSubject("Linkview Video " + videoName); messageText += "<br /><br /><a href='" + videoPath + "'>View Video</a>"; msg.AddContent(MimeType.Html, messageText); Task t = client.SendEmailAsync(msg); t.Wait(); //string messageSMSText = "<br /><br /><a href='" + videoPath + "'>View " + videoName + " video.</a>"; string messageSMSText = origText + " - View Video: " + videoPath; var accountSid = Configuration["Twilio:AccountSid"]; var authToken = Configuration["Twilio:AuthToken"]; TwilioClient.Init(accountSid, authToken); var messageOptions = new CreateMessageOptions( new PhoneNumber(mobiRecipient)); messageOptions.From = new PhoneNumber(Configuration["Twilio:PhoneNumber"]); messageOptions.Body = messageSMSText; var message = MessageResource.Create(messageOptions); return("Success"); }
protected void gvUserListContact_RowUpdating(object sender, GridViewUpdateEventArgs e) { bool bIsValid = true; try { int contactUserID = Convert.ToInt32(gvUserListContact.DataKeys[e.RowIndex].Value.ToString()); string firstName = ((TextBox)(gvUserListContact.Rows[e.RowIndex].FindControl("txtFirstName"))).Text; string lastName = ((TextBox)(gvUserListContact.Rows[e.RowIndex].FindControl("txtLastName"))).Text; string cellPhone = ((TextBox)(gvUserListContact.Rows[e.RowIndex].FindControl("txtCellPhone"))).Text; string wirelessCarrier = ((DropDownList)(gvUserListContact.Rows[e.RowIndex].FindControl("ddlwireless"))).SelectedValue; string email = ((TextBox)(gvUserListContact.Rows[e.RowIndex].FindControl("txtEmail"))).Text; if (!Regex.IsMatch(cellPhone, @"^\d+$")) { cellPhone = gvUserListContact.Rows[e.RowIndex].Cells[3].Text; litError.Text = "<font color='red'>Please enter valid cell phone number</font>"; litError.Visible = true; bIsValid = false; } if (!Regex.IsMatch(email, @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")) { email = gvUserListContact.Rows[e.RowIndex].Cells[5].Text; litError.Text = "<font color='red'>Please enter valid email address</font>"; litError.Visible = true; bIsValid = false; } if (bIsValid) { DataBridgeConnector dbc = new DataBridgeConnector(System.Configuration.ConfigurationManager.ConnectionStrings["Linkview"].ToString()); object[] objDB = new object[6]; objDB.SetValue(contactUserID, 0); objDB.SetValue(firstName, 1); objDB.SetValue(lastName, 2); objDB.SetValue(cellPhone, 3); objDB.SetValue(wirelessCarrier, 4); objDB.SetValue(email, 5); dbc.ExecuteSqlNonQuery("sp_UP_UpdateUserContact", false, objDB); } gvUserListContact.EditIndex = -1; BindGridView(); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
protected void gvUserListContact_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int contactUserID = Convert.ToInt32(gvUserListContact.DataKeys[e.RowIndex].Value.ToString()); DataBridgeConnector dbc = new DataBridgeConnector(System.Configuration.ConfigurationManager.ConnectionStrings["Linkview"].ToString()); object[] objDB = new object[1]; objDB.SetValue(contactUserID, 0); dbc.ExecuteSqlNonQuery("sp_UP_DeleteUserByID", false, objDB); gvUserListContact.EditIndex = -1; BindGridView(); } catch (Exception ex) { } }
protected void BindGridView() { DataBridgeConnector dbc = new DataBridgeConnector(System.Configuration.ConfigurationManager.ConnectionStrings["Linkview"].ToString()); object[] objArray = new object[1]; objArray.SetValue(GetProfile().UserName, 0); DataSet ds = dbc.GetSqlDataSet("sp_UP_GetMessages", objArray); dgvUpdateRecords2.DataSource = ds.Tables[0].DefaultView; dgvUpdateRecords2.DataBind(); if (ds.Tables[0].Rows.Count == 0) { btnTopSend.Visible = false; } }
protected void dgvUpdateRecords2_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { int messageID = Convert.ToInt32(dgvUpdateRecords2.DataKeys[e.RowIndex].Value.ToString()); string messageText = ((TextBox)(dgvUpdateRecords2.Rows[e.RowIndex].FindControl("lblMessage"))).Text; DataBridgeConnector dbc = new DataBridgeConnector(System.Configuration.ConfigurationManager.ConnectionStrings["Linkview"].ToString()); object[] objDB = new object[2]; objDB.SetValue(messageID, 0); objDB.SetValue(messageText, 1); dbc.ExecuteSqlNonQuery("sp_UP_UpdateMessageText", false, objDB); dgvUpdateRecords2.EditIndex = -1; BindGridView(); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
private void AddUser(string userFirstName, string userLastName, string userCellPhone, string userCarrier, string userEmail) { bool bIsValid = true; if (!Regex.IsMatch(userCellPhone, @"^\d+$")) { userCellPhone = string.Empty; litError.Text = "<font color='red'>Please enter valid cell phone number</font>"; litError.Visible = true; RegularExpressionValidator2.Visible = true; bIsValid = false; } if (!Regex.IsMatch(userEmail, @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")) { userEmail = string.Empty; litError.Text = "<font color='red'>Please enter valid email address</font>"; litError.Visible = true; bIsValid = false; } if (bIsValid) { DataBridgeConnector dbc = new DataBridgeConnector(System.Configuration.ConfigurationManager.ConnectionStrings["Linkview"].ToString()); object[] objDB = new object[6]; objDB.SetValue(GetProfile().UserName, 0); objDB.SetValue(userFirstName, 1); objDB.SetValue(userLastName, 2); objDB.SetValue(userCellPhone, 3); objDB.SetValue(userCarrier, 4); objDB.SetValue(userEmail, 5); dbc.ExecuteSqlNonQuery("sp_UP_InsertUserContact", false, objDB); } BindGridView(); Response.Redirect("~/UserUpT2.aspx"); }
public string ConvertFile(string inputPath, string userName, string tempName) { string outputOf = string.Empty; try { FfmpegConverter converter = new FfmpegConverter(); string outputpath = ConfigurationManager.AppSettings["OutputPath"].ToString(); if (ConfigurationManager.AppSettings["TempPath"].ToString() == "tmp") { } else { converter.OutputPath = ConfigurationManager.AppSettings["OutputPath"].ToString(); } converter.LogPath = Path.Combine(outputpath, "log.txt"); converter.FfmpegPath = ConfigurationManager.AppSettings["FFMpegPath"].ToString(); //FileStream fs = new FileStream(inputPath, FileMode.Open, FileAccess.ReadWrite); converter.ImagePath = Path.Combine(ConfigurationManager.AppSettings["OutputPath"].ToString(), Path.GetFileNameWithoutExtension(inputPath) + ".png"); Output output = converter.ConvertToMP4(inputPath); output.Success = true; //StringBuilder sb = new StringBuilder(); /*sb.AppendLine("Outputpath " + outputpath); * sb.AppendLine("Logpath " + converter.LogPath); * sb.AppendLine("FfmpegPath " + converter.FfmpegPath); * sb.AppendLine("ImagePath " + converter.ImagePath); * sb.AppendLine("Output Error " + output.Message); */ if (output.Success) { string renamedMP4 = Path.Combine(outputpath, output.FileName); //renamedMP4 = Path.ChangeExtension(renamedMP4, "mp4"); //FileStream outStream = new FileStream(renamedMP4, FileMode.OpenOrCreate, FileAccess.ReadWrite); //output.VideoStream.WriteTo(outStream); //output.VideoStream.Close(); //byte[] fileBytes = new byte[outStream.Length]; byte[] imageBytes = File.ReadAllBytes(converter.ImagePath); //outStream.Flush(); //outStream.Close(); //fileBytes = File.ReadAllBytes(renamedMP4); //Copy to data lake here then pass to videoPath //set videoPath here string videoPath = PutVideoToDataLake(Path.GetFileName(renamedMP4)); ETUDataControls.DataBridgeConnector dbc = new DataBridgeConnector(""); object[] objArray = new object[7]; objArray.SetValue(userName, 0); objArray.SetValue(Path.GetFileName(renamedMP4).Replace(tempName, ""), 1); objArray.SetValue(null, 2); objArray.SetValue(videoText, 3); objArray.SetValue(videoPath, 4); objArray.SetValue(0, 5); objArray.SetValue(converter.ImagePath, 6); object[] outputQuery = dbc.ExecuteSQLNonQueryWithOutput("sp_UP_InsertVideo", objArray); messageID = Convert.ToInt32(outputQuery[0]); outputOf = renamedMP4; //After the file is created on disk, perform the same task on Blob Storage and delete //the local file **TODO Venkatesh //context.Session["updategrid"]; return(outputOf); } else { return(outputOf); } } catch (Exception ex) { return(outputOf); } }
public string ProcessEmails(string username, GridView dgvUpdateRecords2, string emailFrom, GridView gvUserList) { DataBridgeConnector dbc = new DataBridgeConnector(""); object[] objArray = new object[1]; objArray.SetValue(username, 0); DataSet ds = dbc.GetSqlDataSet("sp_UP_GetListOfUsers", objArray); MMSMessaging.Messaging messaging = new MMSMessaging.Messaging(); int gg = 0; bool goodSend = false; if (ds.Tables[0].Rows.Count > 0) { while (gg < dgvUpdateRecords2.Rows.Count) { CheckBox cbb = (CheckBox)dgvUpdateRecords2.Rows[gg].FindControl("chkMessage"); if (cbb.Checked) { int i = 0; string videoName = string.Empty; string messageText = string.Empty; StringBuilder sbRecipient = new StringBuilder(); StringBuilder sbEmail = new StringBuilder(); int messageID = Convert.ToInt32(dgvUpdateRecords2.DataKeys[gg].Value.ToString()); dbc = new DataBridgeConnector(""); object[] objArray2 = new object[1]; objArray2.SetValue(messageID, 0); Label lbMessage = (Label)dgvUpdateRecords2.Rows[gg].FindControl("lblMessage"); //DataSet ds2 = dbc.GetSqlDataSet("sp_UP_GetVideoByID", objArray2); //MemoryStream ms = new MemoryStream((byte[])ds2.Tables[0].Rows[0]["Video"]); //videoName = ds2.Tables[0].Rows[0]["VideoName"].ToString(); //string videoPath = ds2.Tables[0].Rows[0]["VideoPath"].ToString(); while (i < gvUserList.Rows.Count) { CheckBox cbb2 = (CheckBox)gvUserList.Rows[i].FindControl("RowLevelCheckBox"); if (cbb2.Checked) { Label lbCell = (Label)gvUserList.Rows[i].FindControl("lblCellPhone"); Label lbEmail = (Label)gvUserList.Rows[i].FindControl("lblEmail"); string recipient = lbCell.Text; DropDownList lbCarrier = (DropDownList)gvUserList.Rows[i].FindControl("ddlWireless"); if (recipient != string.Empty && lbCarrier.SelectedValue != "Unknown") { //if (lbCarrier.SelectedValue != "Unknown") } string email = lbEmail.Text; SendSMTPEmail(messageID, recipient, email); //messageText = lbMessage.Text; //string fileFormalName = Path.GetFileName(videoName); //messaging.FormalName = fileFormalName; //messaging.SendEmailFromDBGo("You have received a file from Linkview", messageText, // emailFrom, // recipient, true, "", "", email, null, videoPath); //send message asynchronously } i++; //ms.Dispose(); //ms.Close(); } //TODO: build up user list then bulk update this call, change table structure //dbc = new DataBridgeConnector(""); //object[] objDB = new object[1]; //objDB.SetValue(messageID, 0); //dbc.ExecuteSqlNonQuery("sp_UP_UpdateMessageSent", false, objDB); goodSend = true; } gg++; } } string msg = "Fail"; if (goodSend) { msg = "Success"; } return(msg); }