protected void btn_Click(object sender, EventArgs e) { try { //string Video = fudUploadVideo.FileName; string Image = fupImage.FileName; string CityIdIds = ","; for (int i = 0; i < lstCity.Items.Count; i++) { if (lstCity.Items[i].Selected) { CityIdIds = CityIdIds + lstCity.Items[i].Value + ","; } } if (txtTitle.Text.Trim() != "" && txtTag.Text.Trim() != "" && ((ddlDay.SelectedIndex != 0 && ddlMonth.SelectedIndex != 0 && ddlYear.SelectedIndex != 0 && ddlEndDay.SelectedIndex != 0 && ddlEndMonth.SelectedIndex != 0 && ddlEndYear.SelectedIndex != 0) || rdbViews.Checked) && txtNoofVisits.Text.Trim() != "" && txtBudget.Text.Trim() != "" && txtDescription.Text.Trim() != "" && Image != "" && ddlAgeTo.SelectedIndex != 0) { Advertisement objAdvertisement = new Advertisement(); //string FileExt = Path.GetExtension(fudUploadVideo.FileName); string ShortId = ","; for (int i = 0; i < gvSearchFilm.Rows.Count; i++) { ShortId = ShortId + (gvSearchFilm.Rows[i].FindControl("lblGridAdvertisement_Id") as Label).Text + ","; } //if ((gvSearchFilm.Rows[i].FindControl("rdbSelect") as RadioButton).Checked == true) //string UpId = ","; for (int i = 0; i < gdvUpComming.Rows.Count; i++) { ShortId = ShortId + (gdvUpComming.Rows[i].FindControl("lblGridAdvertisement_Id") as Label).Text + ","; } objAdvertisement.Title = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(txtTitle.Text.Trim()); objAdvertisement.Tag = txtTag.Text.Trim(); if (rdbViews.Checked) { objAdvertisement.StartDate = Convert.ToDateTime((DateTime.Now.AddHours(Connection.SetHours).ToShortDateString())); objAdvertisement.EndDate = Convert.ToDateTime((DateTime.Now.AddYears(20).ToShortDateString())); } else { objAdvertisement.StartDate = Convert.ToDateTime(ddlMonth.SelectedValue.ToString() + "/" + ddlDay.SelectedValue.ToString() + "/" + ddlYear.SelectedItem.ToString()); objAdvertisement.EndDate = Convert.ToDateTime(ddlEndMonth.SelectedValue.ToString() + "/" + ddlEndDay.SelectedValue.ToString() + "/" + ddlEndYear.SelectedItem.ToString()); } objAdvertisement.NoofVisits = txtNoofVisits.Text.Trim(); objAdvertisement.Budget = Convert.ToDecimal(txtBudget.Text.Trim()); objAdvertisement.PromoCode = txtPromoCode.Text.Trim(); objAdvertisement.Description = txtDescription.Text.Trim(); string Url = txtURL.Text.Trim(); string[] SplitUrl = Url.Split('/'); string NewUrl = ""; if (SplitUrl.Length != 0) { for (int i = 0; i < SplitUrl.Length; i++) { if (i == 1) { NewUrl = NewUrl + "//player." + SplitUrl[i].ToString(); } else if (i == 3) { NewUrl = NewUrl + "/video/" + SplitUrl[i].ToString(); } else { NewUrl = NewUrl + SplitUrl[i].ToString(); } } } objAdvertisement.Video = NewUrl; objAdvertisement.UserId = Convert.ToInt32(Session["UserId"].ToString()); objAdvertisement.CreatedDate = DateTime.Now.AddHours(Connection.SetHours); objAdvertisement.ShortFilmId = ShortId; objAdvertisement.Image = Image; objAdvertisement.CityId = CityIdIds; string Gender = ""; if (rdbAll.Checked) { Gender = "ALL"; } else if (rdbMale.Checked) { Gender = "Male"; } else { Gender = "Female"; } objAdvertisement.Gender = Gender; objAdvertisement.Agefrom = ddlAgefrom.SelectedItem.ToString(); objAdvertisement.Ageto = ddlAgeTo.SelectedItem.ToString(); objAdvertisement.UpComming = "";//UpId; DataSet objDataSet = Advertisement.Advertisement_Send_To_DB(objAdvertisement); if (objDataSet.Tables[0].Rows[0][1].ToString() == "1") { if (Image != "") { fupImage.SaveAs(Server.MapPath("~/Video_Images/") + "Advatizments_" + objDataSet.Tables[0].Rows[0][0].ToString() + ".jpg"); } ShowNotification("Advertisement", "Your advertisement is uploaded successfully and we will inform you shortly once it got approved", NotificationType.success); Clear_Advertisement(); if (Convert.ToInt32(Session["UserId"].ToString()) == 1) { Display_List(gvadvertisement, "SELECT Advertisement_Id,Title,Tag,convert(varchar(12),StartDate,100)as StartDate,convert(varchar(12),EndDate,100)as EndDate,NoofVisits,Budget,PromoCode,case when Status='Approve' then 'Approved' else 'Unapproved' end as Status,Description,Video,CreatedDate,CreatedById,ModifiedDate,ModifiedById,Isactive,case when Status='Approve' then 'label label-success' else case when Status='Unapprove' then 'label label-danger' else 'label label-warning' end end as StatusClr,Visits FROM tbl_Advertisement where Isactive='True'"); } else { Display_List(gvadvertisement, "SELECT Advertisement_Id,Title,Tag,convert(varchar(12),StartDate,100)as StartDate,convert(varchar(12),EndDate,100)as EndDate,NoofVisits,Budget,PromoCode,case when Status='Approve' then 'Approved' else 'Unapproved' end as Status,Description,Video,CreatedDate,CreatedById,ModifiedDate,ModifiedById,Isactive,case when Status='Approve' then 'label label-success' else case when Status='Unapprove' then 'label label-danger' else 'label label-warning' end end as StatusClr,Visits FROM tbl_Advertisement where Isactive='True' and CreatedById=" + Convert.ToInt32(Session["UserId"].ToString())); } } else { ShowNotification("Advertisement", "not inserted..", NotificationType.error); } } else { ShowNotification("Advertisement", "Please Fill All Fields..!", NotificationType.error); } //if (!string.IsNullOrEmpty(file.ThumbnailLink)) //{ // rowThumbnail.Visible = true; // imgThumbnail.ImageUrl = file.ThumbnailLink; //} } catch (Exception Ex) { ShowNotification("Advertisement", "Invalid Date..", NotificationType.error); } }
protected void btn_Click(object sender, EventArgs e) { try { string Video = fudUploadVideo.FileName; string Image = fupImage.FileName; if (txtTitle.Text.Trim() != "" && txtTag.Text.Trim() != "" && txtStartDate.Text.Trim() != "" && txtEndDate.Text.Trim() != "" && txtNoofVisits.Text.Trim() != "" && txtBudget.Text.Trim() != "" && txtPromoCode.Text.Trim() != "" && txtDescription.Text.Trim() != "" && lblAdvertisementId.Text.Trim() != "0") { Advertisement objAdvertisement = new Advertisement(); string FileExt = Path.GetExtension(fudUploadVideo.FileName); string ShortId = ","; for (int i = 0; i < gvSearchFilm.Rows.Count; i++) { if ((gvSearchFilm.Rows[i].FindControl("rdbSelect") as RadioButton).Checked == true) { ShortId = (gvSearchFilm.Rows[i].FindControl("lblGridAdvertisement_Id") as Label).Text; } } objAdvertisement.Title = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(txtTitle.Text.Trim()); objAdvertisement.Tag = txtTag.Text.Trim(); objAdvertisement.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim()); objAdvertisement.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim()); objAdvertisement.NoofVisits = txtNoofVisits.Text.Trim(); objAdvertisement.Budget = Convert.ToDecimal(txtBudget.Text.Trim()); objAdvertisement.PromoCode = txtPromoCode.Text.Trim(); objAdvertisement.Description = txtDescription.Text.Trim(); objAdvertisement.Video = FileExt; objAdvertisement.UserId = Convert.ToInt32(Session["UserId"].ToString()); objAdvertisement.CreatedDate = DateTime.Now.AddHours(Connection.SetHours); objAdvertisement.ShortFilmId = ShortId; objAdvertisement.Image = Image; objAdvertisement.AdvertisementId = Convert.ToInt32(lblAdvertisementId.Text.Trim()); DataSet objDataSet = Advertisement.Advertisement_Send_To_DB(objAdvertisement); if (objDataSet.Tables[0].Rows[0][1].ToString() == "1") { if (Video != "") { fudUploadVideo.SaveAs(Server.MapPath("~/Videos/") + "Video_" + objDataSet.Tables[0].Rows[0][0].ToString() + FileExt); } if (Image != "") { fupImage.SaveAs(Server.MapPath("~/Video_Images/") + "Advatizments_" + objDataSet.Tables[0].Rows[0][0].ToString() + ".jpg"); } ShowNotification("Advertisement", "Updated Successfully..", NotificationType.success); Clear_Advertisement(); if (Convert.ToInt32(Session["UserId"].ToString()) == 1) { Display_List(gvadvertisement, "SELECT Advertisement_Id,Title,Tag,convert(varchar(12),StartDate,100)as StartDate,convert(varchar(12),EndDate,100)as EndDate,NoofVisits,Budget,PromoCode,Status,Description,Video,CreatedDate,CreatedById,ModifiedDate,ModifiedById,Isactive,case when Status='Approve' then 'label label-success' else case when Status='Unapprove' then 'label label-danger' else 'label label-warning' end end as StatusClr FROM tbl_Advertisement where Isactive='True' and Status!='Approve'"); } else { Display_List(gvadvertisement, "SELECT Advertisement_Id,Title,Tag,convert(varchar(12),StartDate,100)as StartDate,convert(varchar(12),EndDate,100)as EndDate,NoofVisits,Budget,PromoCode,Status,Description,Video,CreatedDate,CreatedById,ModifiedDate,ModifiedById,Isactive,case when Status='Approve' then 'label label-success' else case when Status='Unapprove' then 'label label-danger' else 'label label-warning' end end as StatusClr FROM tbl_Advertisement where Isactive='True' and Status!='Approve' and CreatedById=" + Convert.ToInt32(Session["UserId"].ToString())); } } else { ShowNotification("Advertisement", "not inserted..", NotificationType.error); } } else { ShowNotification("Advertisement", "Please Fill All Fields..!", NotificationType.error); } //if (!string.IsNullOrEmpty(file.ThumbnailLink)) //{ // rowThumbnail.Visible = true; // imgThumbnail.ImageUrl = file.ThumbnailLink; //} } catch (Exception Ex) { } }
protected void btn_Click(object sender, EventArgs e) { try { string Video = fudUploadVideo.FileName; if (txtTitle.Text.Trim() != "" && txtTag.Text.Trim() != "" && txtStartDate.Text.Trim() != "" && txtEndDate.Text.Trim() != "" && txtNoofVisits.Text.Trim() != "" && txtBudget.Text.Trim() != "" && txtPromoCode.Text.Trim() != "" && txtDescription.Text.Trim() != "" && Video != "") { if (!string.IsNullOrEmpty(Request.QueryString["code"])) { Session["File"] = fudUploadVideo.PostedFile; Session["Description"] = txtTitle.Text; string code = Request.QueryString["code"]; string json = GoogleConnect.PostFile(code, (HttpPostedFile)Session["File"], Session["Description"].ToString()); GoogleDriveFile file = (new JavaScriptSerializer()).Deserialize <GoogleDriveFile>(json); //tblFileDetails.Visible = true; //lblTitle.Text = file.Title; //lblId.Text = file.Id; //imgIcon.ImageUrl = file.IconLink; //lblCreatedDate.Text = file.CreatedDate.ToString(); //lnkDownload.NavigateUrl = file.WebContentLink; lblVideoLLink.Text = file.WebContentLink; Advertisement objAdvertisement = new Advertisement(); string FileExt = Path.GetExtension(fudUploadVideo.FileName); objAdvertisement.Title = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(txtTitle.Text.Trim()); objAdvertisement.Tag = txtTag.Text.Trim(); objAdvertisement.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim()); objAdvertisement.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim()); objAdvertisement.NoofVisits = txtNoofVisits.Text.Trim(); objAdvertisement.Budget = Convert.ToDecimal(txtBudget.Text.Trim()); objAdvertisement.PromoCode = txtPromoCode.Text.Trim(); objAdvertisement.Description = txtDescription.Text.Trim(); string[] Split = (lblVideoLLink.Text).Split('='); objAdvertisement.Video = Split[0] + "=" + Split[1] + "=view"; objAdvertisement.UserId = Convert.ToInt32(Session["UserId"].ToString()); objAdvertisement.CreatedDate = DateTime.Now.AddHours(Connection.SetHours); DataSet objDataSet = Advertisement.Advertisement_Send_To_DB(objAdvertisement); if (objDataSet.Tables[0].Rows[0][1].ToString() == "1") { ShowNotification("Advertisement", "inserted Successfully..", NotificationType.success); Clear_Advertisement(); if (Convert.ToInt32(Session["UserId"].ToString()) == 1) { Display_List(gvadvertisement, "SELECT Advertisement_Id,Title,Tag,convert(varchar(12),StartDate,100)as StartDate,convert(varchar(12),EndDate,100)as EndDate,NoofVisits,Budget,PromoCode,Status,Description,Video,CreatedDate,CreatedById,ModifiedDate,ModifiedById,Isactive,case when Status='Approve' then 'label label-success' else case when Status='Unapprove' then 'label label-danger' else 'label label-warning' end end as StatusClr FROM tbl_Advertisement where Isactive='True'"); } else { Display_List(gvadvertisement, "SELECT Advertisement_Id,Title,Tag,convert(varchar(12),StartDate,100)as StartDate,convert(varchar(12),EndDate,100)as EndDate,NoofVisits,Budget,PromoCode,Status,Description,Video,CreatedDate,CreatedById,ModifiedDate,ModifiedById,Isactive,case when Status='Approve' then 'label label-success' else case when Status='Unapprove' then 'label label-danger' else 'label label-warning' end end as StatusClr FROM tbl_Advertisement where Isactive='True' and CreatedById=" + Convert.ToInt32(Session["UserId"].ToString())); } } else { ShowNotification("Advertisement", "not inserted..", NotificationType.error); } } else { ShowNotification("Advertisement", "Please Fill All Fields..!", NotificationType.error); } //if (!string.IsNullOrEmpty(file.ThumbnailLink)) //{ // rowThumbnail.Visible = true; // imgThumbnail.ImageUrl = file.ThumbnailLink; //} } if (Request.QueryString["error"] == "access_denied") { ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Access denied.')", true); } } catch (Exception Ex) { } }