protected void Page_Load(object sender, EventArgs e) { if (Page.RouteData.Values.ContainsKey("OfferID")) { string OfferID = Page.RouteData.Values["OfferID"] as string; Int64 offID = Convert.ToInt64(OfferID); using (Ad_ConnectionString model = new Ad_ConnectionString()) { var url = (from u in model.Adv_Offers where u.OfferID == offID select u).ToList(); rpItems.DataSource = url; rpItems.DataBind(); var p = url.Select(o => o).SingleOrDefault(); Page.Title = p.Adv_Mst_Merchant.MerchantNameDetail + " | " + p.Title; Page.MetaDescription = p.Description; Page.MetaKeywords = p.Adv_Mst_Merchant.MerchantNameDetail; uc_ExtraCashBackList.MerchantName = p.Adv_Mst_Merchant.MerchantNameDetail; } } else { Response.Redirect("~/Default.aspx"); } }
public static void Proc_UpdateDeleteDupilcateOffers() { using (Ad_ConnectionString model = new Ad_ConnectionString()) { model.adv_UpdateAndDeleteDuplicateOffers(); } }
public void ProcessRequest(HttpContext context) { if (context.Request.RequestContext.RouteData.Values.ContainsKey("OfferID")) { Int64 offID = Convert.ToInt64(context.Request.RequestContext.RouteData.Values["OfferID"]); using (Ad_ConnectionString model = new Ad_ConnectionString()) { var url = (from u in model.Adv_Offers where u.OfferID == offID select u.NavigationURL).SingleOrDefault(); //context.Server.Transfer(url); if (url != null) { context.Response.Redirect(url, true); } else { Uri priURl = context.Request.UrlReferrer; context.Response.Redirect(priURl.AbsoluteUri.ToString()); } } // //context.Response.Redirect("https://clk.omgt5.com/?PID=14635&AID=764019&CID=4714676&uid=1&MID=526801&r=https%3a%2f%2fpaytm.com%2fshop%2fp%2fstag-compact-table-tennis-table-with-2-stag-club-tt-bat-and-6-tt-balls-SPOSTAG-COMPACTSTAG20133B821525E"); } //context.Response.ContentType = "image/jpg"; //context.Response.WriteFile(context.Server.MapPath("~/Images/Hydrangeas.jpg")); }
public static void Proc_OmgTransactionFinalCommision() { using (Ad_ConnectionString model = new Ad_ConnectionString()) { model.adv_proc_CalculateFinalCommission(); } }
protected void lkbDeactive_Click(object sender, EventArgs e) { List <Merchant_Commision> coms = new List <Merchant_Commision>(); foreach (GridViewRow row in gvItemsCOM.Rows) { if (((CheckBox)row.FindControl("chkRow")).Checked) { using (Ad_ConnectionString model = new Ad_ConnectionString()) { int comID = Convert.ToInt32(gvItemsCOM.DataKeys[row.RowIndex].Value); var varlist = (from var in model.Adv_Commisions where var.CommisionID == comID select var).FirstOrDefault(); if (ddlStatus.SelectedValue.ToString() == Constants.Status.Active.ToString()) { varlist.Status = Convert.ToInt32(Constants.Status.Active); } else if (ddlStatus.SelectedValue.ToString() == Constants.Status.DeActive.ToString()) { varlist.Status = Convert.ToInt32(Constants.Status.DeActive); } model.SaveChanges(); } } } }
public static List <Adv_DynamicProductFeed> GetDynamicXMLProductFeedApiURL() { using (Ad_ConnectionString model = new Ad_ConnectionString()) { var varlist = (from var in model.Adv_DynamicProductFeeds where var.ISRUN == "N" && var.Status == "A" select var); return(varlist.ToList()); } }
protected void btnRunTemplateDesign_Click(object sender, EventArgs e) { string SendMail = string.Empty; using (Ad_ConnectionString model = new Ad_ConnectionString()) { if (ddlTemplateType.SelectedValue == Constants.MailFormatContentType.ImageContent.ToString()) { Int16 mailFormatType = Convert.ToInt16(Constants.MailFormatContentType.ImageContent); var contentMail = (from pro in model.Adv_MailContents where pro.MailType == mailFormatType select pro).SingleOrDefault(); DataTable dtEmails = GetEamilsList(Convert.ToInt32(txtSendMail.Text.Trim()), Convert.ToInt32(txtMailCount.Text.ToString())); if (dtEmails.Rows.Count > 0) { string emailIDS = string.Empty; for (int i = 0; i < dtEmails.Rows.Count; i++) { emailIDS = emailIDS + "," + dtEmails.Rows[i]["SubscribeEmail"].ToString(); } string staus = MailSender.SendMailAPI(txtSubject.Text.Trim(), txtEmailTo.Text.Trim() + emailIDS, contentMail.MailContent.ToString()); lblmsg.Text = staus; } } if (ddlTemplateType.SelectedValue == Constants.MailFormatContentType.OfferContent.ToString()) { Int16 mailFormatType = Convert.ToInt16(Constants.MailFormatContentType.OfferContent); var contentMail = (from pro in model.Adv_MailContents where pro.MailType == mailFormatType select pro).SingleOrDefault(); int from = 0; int to = 500; //for (int m = 0; m < 10; m++) //{ DataTable dtEmails = GetEamilsList(Convert.ToInt32(txtSendMail.Text.Trim()), Convert.ToInt32(txtMailCount.Text.ToString())); if (dtEmails.Rows.Count > 0) { string emailIDS = string.Empty; for (int i = 0; i < dtEmails.Rows.Count; i++) { emailIDS = emailIDS + "," + dtEmails.Rows[i]["SubscribeEmail"].ToString(); } string staus = MailSender.SendMailAPI(txtSubject.Text.Trim(), txtEmailTo.Text.Trim() + emailIDS, contentMail.MailContent.ToString()); lblmsg.Text = staus; } //from = to + 1; //to = to + 500; //} } } }
private void getFeatureslist() { using (Ad_ConnectionString model = new Ad_ConnectionString()) { var varlist = (from var in model.Adv_Offers where model.Adv_FeatureOffer1.Select(s => s.OfferID).Contains(var.OfferID) select var).ToList(); gvItems.DataSource = varlist; gvItems.DataBind(); gvItems.Caption = "Feature Offers"; } }
private void BindOffersList() { using (Ad_ConnectionString model = new Ad_ConnectionString()) { Int64 mid = Convert.ToInt64(uc_MerchantListItem.SelectedMerchant); var varlist = (from var in model.Adv_Offers where var.MID == mid && var.ValidTill >= DateTime.Now select var).ToList(); gvItems.DataSource = varlist; gvItems.DataBind(); gvItems.Caption = "Live Offers"; } }
private void UpdateCategoryID() { try { using (var model = new Ad_ConnectionString()) { clsCommonMethods _modelCat = new clsCommonMethods(); var catList = _modelCat.GetAllCategories(); var catIDs = (from ct in catList select ct.CategoryName_V).ToList(); foreach (Category cat in catList) { if (cat.SubCategory.Count > 0) { var orginalCat = model.Adv_Product_Commons.Where(nc => nc.CategoryID_N == null && nc.ProductCategoryName != null && nc.Ad_For > 0).Where(p => p.ProductCategoryName.Equals(cat.CategoryName_V)).ToList(); // p.cat.CategoryName.Contains(cat.CategoryName_V)).ToList(); orginalCat.ForEach(aa => aa.CategoryID_N = cat.CategoryID_N); //a=>a..c.CategoryID_N=cat.CategoryID_N); model.SaveChanges(); var orginal = model.Adv_Product_Commons.Where(nc => nc.CategoryID_N == null && nc.ProductCategoryName != null && nc.Ad_For > 0).Where(p => cat.SubCategory.Select(s => s.SubCategoryName_V).ToList().Equals(p.ProductCategoryName)).ToList(); // p.cat.CategoryName.Contains(cat.CategoryName_V)).ToList(); orginal.ForEach(aa => aa.CategoryID_N = cat.CategoryID_N); //a=>a..c.CategoryID_N=cat.CategoryID_N); model.SaveChanges(); } else { var orginal = model.Adv_Product_Commons.Where(nc => nc.CategoryID_N == null && nc.ProductCategoryName != null && nc.Ad_For > 0).Where(p => p.ProductCategoryName.Equals(cat.CategoryName_V)).ToList(); // p.cat.CategoryName.Contains(cat.CategoryName_V)).ToList(); orginal.ForEach(aa => aa.CategoryID_N = cat.CategoryID_N); //a=>a..c.CategoryID_N=cat.CategoryID_N); model.SaveChanges(); if (cat.CategoryName_V == "Mobile Phones") { var cateNewMap = model.Adv_Product_Commons.Where(nc => nc.CategoryID_N == null && nc.ProductCategoryName != null && nc.Ad_For > 0).Where(p => p.ProductCategoryName.Equals("Mobiles & Accessories>Mobiles")).ToList(); // p.cat.CategoryName.Contains(cat.CategoryName_V)).ToList(); cateNewMap.ForEach(aa => aa.CategoryID_N = cat.CategoryID_N); //a=>a..c.CategoryID_N=cat.CategoryID_N); model.SaveChanges(); } } } model.Dispose(); } } catch (Exception ex) { } }
protected void lkbResolve_Click(object sender, EventArgs e) { foreach (GridViewRow row in gvItems.Rows) { if (((CheckBox)row.FindControl("chkRow")).Checked) { int tid = Convert.ToInt32(gvItems.DataKeys[row.RowIndex].Value); using (Ad_ConnectionString model = new Ad_ConnectionString()) { var original = model.Adv_MissingCashbacks.Where(c => c.TicketNo == tid).SingleOrDefault(); if (original != null) { original.Status = (int)Constants.Status.Resolve; model.SaveChanges(); } } } } }
protected void Delete_Click(object sender, EventArgs e) { List <Int64> offerIds = new List <Int64>(); foreach (GridViewRow row in gvItems.Rows) { if (((CheckBox)row.FindControl("chkRow")).Checked) { Int64 offerID = Convert.ToInt32(gvItems.DataKeys[row.RowIndex].Value); using (Ad_ConnectionString model = new Ad_ConnectionString()) { model.Adv_FeatureOffer1.Where(x => x.OfferID == offerID).ToList().ForEach(model.Adv_FeatureOffer1.DeleteObject); model.SaveChanges(); } } } getFeatureslist(); }
protected void lkbFeatureOffer_Click(object sender, EventArgs e) { List <Int64> offerIds = new List <Int64>(); foreach (GridViewRow row in gvItems.Rows) { if (((CheckBox)row.FindControl("chkRow")).Checked) { Int64 offerID = Convert.ToInt32(gvItems.DataKeys[row.RowIndex].Value); using (Ad_ConnectionString model = new Ad_ConnectionString()) { Adv_FeatureOffer1 offer = new Adv_FeatureOffer1(); offer.OfferID = offerID; offer.OfferType = Convert.ToInt16(Convert.ToInt32((Constants.FeatureTypeOffer)Enum.Parse(typeof(Constants.FeatureTypeOffer), ddlOfferType.SelectedValue.ToString()))); model.AddToAdv_FeatureOffer1(offer); model.SaveChanges(); } } } BindOffersList(); }
public void ProcessRequest(HttpContext context) { if (context.Request.RequestContext.RouteData.Values.ContainsKey("OfferID")) { Int64 offID = Convert.ToInt64(context.Request.RequestContext.RouteData.Values["OfferID"]); using (Ad_ConnectionString model = new Ad_ConnectionString()) { var url = (from u in model.Adv_Offers where u.OfferID == offID select u).SingleOrDefault(); context.Response.ContentType = "text/plain"; StringBuilder sb = new StringBuilder(); sb.AppendFormat("<html>"); sb.AppendFormat("<title>" + url.Title + "</title>"); sb.AppendFormat("<body>"); sb.AppendFormat("<img src='" + url.Adv_Mst_Merchant.LogoUrl + "'>"); //sb.Append("<html>"); //sb.Append("<html>"); sb.AppendFormat("</body>"); sb.AppendFormat("</html>"); context.Response.Write(sb.ToString()); } } }
protected void btnRunTemplateDesign_Click(object sender, EventArgs e) { StringBuilder templateItems = new StringBuilder(); if (ddlTemplateType.SelectedValue.ToString() == Constants.MailFormatContentType.ImageContent.ToString()) { using (Ad_ConnectionString model = new Ad_ConnectionString()) { int bannerLocation = Convert.ToInt32(Constants.BannerLocation.EmailImageMarketing); var varlist = (from var in model.Adv_Trn_Banners where var.BannerLocation == bannerLocation select var).ToList(); foreach (Adv_Trn_Banner item in varlist) { string mNamed; if (item.Adv_Mst_Merchant.MerchantNameDetail.ToString().IndexOf(".") >= 0) { mNamed = item.Adv_Mst_Merchant.MerchantNameDetail.Substring(0, item.Adv_Mst_Merchant.MerchantNameDetail.ToString().IndexOf(".")); } else { mNamed = item.Adv_Mst_Merchant.MerchantNameDetail; } templateItems.Append(ImagetemplateBuilder(item.BannerURL, mNamed, item.BannerText, item.Description)); } string body = string.Empty; using (StreamReader reader = new StreamReader(System.Web.HttpContext.Current.Server.MapPath("~/MailFormat/ImageTemplateMarketing.htm"))) { body = reader.ReadToEnd(); } body = body.Replace("{AddImages}", templateItems.ToString()); txtCodeGenerate.Text = body; //Update Contaent in DB -------------------------------------------------------------- Int16 mailFormatType = Convert.ToInt16(Constants.MailFormatContentType.ImageContent); var contentMail = (from pro in model.Adv_MailContents where pro.MailType == mailFormatType select pro).SingleOrDefault(); if (contentMail != null) { contentMail.MailContent = body; model.SaveChanges(); } else { Adv_MailContent mailContent = new Adv_MailContent(); mailContent.MailContent = body; mailContent.MailType = Convert.ToInt16(Constants.MailFormatContentType.ImageContent); model.AddToAdv_MailContents(mailContent); model.SaveChanges(); } } } else if (ddlTemplateType.SelectedValue.ToString() == Constants.MailFormatContentType.OfferContent.ToString()) { using (Ad_ConnectionString model = new Ad_ConnectionString()) { Int64 offTYpe = Convert.ToInt64(Constants.FeatureTypeOffer.FeatureOffer); var varlist = (from var in model.Adv_Offers where model.Adv_FeatureOffer1.Where(w => w.OfferType == offTYpe).Select(s => s.OfferID).Contains(var.OfferID) select var).ToList(); int offerCount = 1; foreach (Adv_Offer item in varlist) { string mNamed; if (item.Adv_Mst_Merchant.MerchantNameDetail.ToString().IndexOf(".") >= 0) { mNamed = item.Adv_Mst_Merchant.MerchantNameDetail.Substring(0, item.Adv_Mst_Merchant.MerchantNameDetail.ToString().IndexOf(".")); } else { mNamed = item.Adv_Mst_Merchant.MerchantNameDetail; } string comision = string.Empty; //Constants.PriceType.INR //int? priceType = 1; var com = (from c in model.Adv_Commisions where c.MerchantID == item.Adv_Mst_Merchant.MID select c).OrderByDescending(x => x.UserCommision).FirstOrDefault(); if (offerCount == 1) { templateItems.Append(OffertemplateBuilder("<tr>", "divLeft", item.Adv_Mst_Merchant.LogoUrl, mNamed, item.Title, com.UserCommision + getPiceType(com.PriceType), "")); } else if (offerCount == 2) { templateItems.Append(OffertemplateBuilder("", "divLeft", item.Adv_Mst_Merchant.LogoUrl, mNamed, item.Title, com.UserCommision + getPiceType(com.PriceType), "")); } else { templateItems.Append(OffertemplateBuilder("", "divLeft", item.Adv_Mst_Merchant.LogoUrl, mNamed, item.Title, com.UserCommision + getPiceType(com.PriceType), "</tr>")); if (offerCount == 3) { offerCount = 0; } } offerCount = offerCount + 1; } string body = string.Empty; using (StreamReader reader = new StreamReader(System.Web.HttpContext.Current.Server.MapPath("~/MailFormat/OfferTemplateMarketing.htm"))) { body = reader.ReadToEnd(); } body = body.Replace("{Addoffer}", templateItems.ToString()); txtCodeGenerate.Text = body; //Update Contaent in DB -------------------------------------------------------------- Int16 mailFormatType = Convert.ToInt16(Constants.MailFormatContentType.OfferContent); var contentMail = (from pro in model.Adv_MailContents where pro.MailType == mailFormatType select pro).SingleOrDefault(); if (contentMail != null) { contentMail.MailContent = body; model.SaveChanges(); } else { Adv_MailContent mailContent = new Adv_MailContent(); mailContent.MailContent = body; mailContent.MailType = Convert.ToInt16(Constants.MailFormatContentType.OfferContent); model.AddToAdv_MailContents(mailContent); model.SaveChanges(); } } } }
protected void Button1_Click(object sender, EventArgs e) { clsFramework objFramework = new clsFramework(); DataTable dt = new DataTable(); SqlParameter[] parameters = { new SqlParameter("@MailStartFrom", SqlDbType.Int) { Value = Convert.ToInt32(txtSendMail.Text.Trim()) }, new SqlParameter("@MailCount", SqlDbType.Int) { Value = Convert.ToInt32(txtMailCount.Text.Trim()) } }; dt = objFramework.GetRecordSet("Adv_Proc_SendMail", CommandType.StoredProcedure, parameters); string SendMail = string.Empty; using (Ad_ConnectionString model = new Ad_ConnectionString()) { if (ddlTemplateType.SelectedValue == Constants.MailFormatContentType.ImageContent.ToString()) { Int16 mailFormatType = Convert.ToInt16(Constants.MailFormatContentType.ImageContent); var contentMail = (from pro in model.Adv_MailContents where pro.MailType == mailFormatType select pro).SingleOrDefault(); if (dt != null) { if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { MailSender.SendHtmlFormattedEmail(txtSubject.Text.Trim(), dt.Rows[i]["SubscribeEmail"].ToString(), contentMail.MailContent.ToString(), Constants.FromAddress.Info); Thread.Sleep(3000); //SendMail = SendMail + dt.Rows[i]["SubscribeEmail"].ToString() + ","; } SendMail = SendMail.TrimEnd(','); } } lblmsg.Text = "Send"; } else if (ddlTemplateType.SelectedValue == Constants.MailFormatContentType.OfferContent.ToString()) { Int16 mailFormatType = Convert.ToInt16(Constants.MailFormatContentType.OfferContent); var contentMail = (from pro in model.Adv_MailContents where pro.MailType == mailFormatType select pro).SingleOrDefault(); if (dt != null) { if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { MailSender.SendHtmlFormattedEmail(txtSubject.Text.Trim(), dt.Rows[i]["SubscribeEmail"].ToString(), contentMail.MailContent.ToString(), Constants.FromAddress.Info); Thread.Sleep(3000); //SendMail = SendMail + dt.Rows[i]["SubscribeEmail"].ToString() + ","; } SendMail = SendMail.TrimEnd(','); } } lblmsg.Text = "Send"; } } }