protected void rbtnpd_CheckedChanged(object sender, EventArgs e) { foreach (RepeaterItem item in rptpdetails.Items) { RadioButton rbtn = (RadioButton)item.FindControl("rbtnpd"); rbtn.Checked = false; } ((RadioButton)sender).Checked = true; foreach (RepeaterItem item in rptpdetails.Items) { RadioButton rbtn = (RadioButton)item.FindControl("rbtnpd"); if (rbtn.Checked) { using (productparameter obj = new productparameter()) { ViewState["rbtnid"] = rbtn.ToolTip.ToString(); obj._id = Convert.ToInt64(ViewState["rbtnid"].ToString()); DataSet ds = new DataSet(); ds = obj.productparameter_select_byid(); if (ds.Tables[0].Rows.Count > 0) { lbltotal.Text = ds.Tables[0].Rows[0]["Credit"].ToString(); ViewState["prid"] = ds.Tables[0].Rows[0]["ParameterID"].ToString(); //ViewState["credit"] = lbltotal.Text; } } } } }
private void FillRegData() { using (productparameter obj = new productparameter()) { DataSet ds = new DataSet(); obj._id = Convert.ToInt64(Request.QueryString["id"]); ds = obj.productparameter_select_byid(); if (ds.Tables[0].Rows.Count > 0) { txtcredit.Text = ds.Tables[0].Rows[0]["credit"].ToString(); //txtsize.Text = ds.Tables[0].Rows[0]["size"].ToString(); btnsubmit.Text = "Update"; } } }
private void downloaddata(object p) { //throw new NotImplementedException(); using (productparameter obj = new productparameter()) { obj._id = Convert.ToInt64(p.ToString()); DataSet ds = new DataSet(); ds = obj.productparameter_select_byid(); if (ds.Tables[0].Rows.Count > 0) { filename = ds.Tables[0].Rows[0]["OProduct"].ToString(); fileloc = Server.MapPath("Admin\\upload\\orignal\\") + filename; //download file from folder Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=" + filename); Response.WriteFile(fileloc); Response.End(); } } }
protected void btnconfirm_Click(object sender, EventArgs e) { double currentcredit = 0; double total = Convert.ToDouble(lbltotals.Text.ToString()); if (Session["UserID"] != null) { using (users objo = new users()) { objo.uid = Convert.ToInt64(Session["UserID"].ToString()); DataSet dsr = new DataSet(); dsr = objo.user_select_byid(); if (dsr.Tables[0].Rows.Count > 0) { currentcredit = Convert.ToDouble(dsr.Tables[0].Rows[0]["Balance"].ToString()); } if (currentcredit > total) { currentcredit = currentcredit - total; objo.balanceid = currentcredit; objo.user_updatebalance(); using (cart obj = new cart()) { obj._userid = Convert.ToInt64(Session["UserID"].ToString()); obj._sessionid = Session["Current"].ToString(); obj._orderid = Convert.ToInt64("0"); DataSet ds = new DataSet(); ds = obj.cart_details(); using (order objc = new order()) { WebClient client = new WebClient(); String htmlcode = client.DownloadString(Server.MapPath("Order.htm")); htmlcode = htmlcode.Replace("###username###", Session["Name"].ToString()); htmlcode = htmlcode.Replace("###credit###", lbltotals.Text.ToString()); MailMessage mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**", "Dream Multimedia"); mail.To.Add(Session["Email"].ToString()); mail.Subject = "Order Massage"; string Body = htmlcode; mail.Body = Body; mail.IsBodyHtml = true; Attachment ob; //ob= new Attachment(Server.MapPath("my_friends_166225.jpg")); //mail.Attachments.Add(ob); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { objc._uid = Convert.ToInt64(Session["UserID"].ToString()); objc._date = Convert.ToDateTime(System.DateTime.Now); objc._cname = ds.Tables[0].Rows[i]["cname"].ToString(); objc._pname = ds.Tables[0].Rows[i]["pdname"].ToString(); objc._pcode = ds.Tables[0].Rows[i]["pcode"].ToString(); objc._image = ds.Tables[0].Rows[i]["image"].ToString(); objc._res = ds.Tables[0].Rows[i]["res"].ToString(); objc._size = ds.Tables[0].Rows[i]["size"].ToString(); objc._credit = Convert.ToInt64(ds.Tables[0].Rows[i]["credit"].ToString()); objc._prname = ds.Tables[0].Rows[i]["prname"].ToString(); Int64 ppid = Convert.ToInt64(ds.Tables[0].Rows[i]["PPID"].ToString()); objc._ppid = Convert.ToInt64(ds.Tables[0].Rows[i]["PPID"].ToString()); objc.order_insert(); using (productparameter obcpp = new productparameter()) { DataSet pp = new DataSet(); obcpp.id = ppid; pp = obcpp.productparameter_select_byid(); ob = new Attachment(Server.MapPath("Admin\\upload\\orignal\\") + pp.Tables[0].Rows[0]["OProduct"].ToString()); mail.Attachments.Add(ob); } } SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Dream143"); smtp.EnableSsl = true; // Other then smtp.gmail.com = false; smtp.Send(mail); mail = null; smtp = null; } obj._orderid = Convert.ToInt64("1"); obj.cart_updateorderid(); } } else { Response.Redirect("Packagesub.aspx"); } } Response.Redirect("Currentorder.aspx"); } }