protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { For_Shopkpr bndDll = new For_Shopkpr(); //DataTable dt = bndDll.bindDropdown(); ddlmall.DataSource = bndDll.bindDropdown(); ddlmall.DataTextField = "Name"; ddlmall.DataValueField = "Id"; ddlmall.DataBind(); ddlmall.Items.Insert(0, "-Please Select-"); } }
protected void btnCreateShop_Click(object sender, EventArgs e) { For_Shopkpr Nshop = new For_Shopkpr(); Nshop.UserId = Convert.ToInt32(Session["id"].ToString()); Nshop.ShopName = txtshopname.Text; Nshop.MallId = Convert.ToInt32(ddlmall.SelectedValue); Nshop.CNIC = Convert.ToString(txtcnic.Text); Nshop.Image = DateTime.Now.ToString("ddMMyymmss") + Path.GetExtension(FileUpload_Nshop.PostedFile.FileName); FileUpload_Nshop.PostedFile.SaveAs(Server.MapPath("~/ShopImg/") + Nshop.Image); Nshop.CreateNewShop(); Response.Redirect("Create_NewShops.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Redirect("Login.aspx"); } For_Shopkpr shpkr = new For_Shopkpr(); shpkr.UserId = Convert.ToInt32(Session["id"]); grd_shpkrshop.DataSource = shpkr.Getting_Shops(); grd_shpkrshop.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { For_Shopkpr bndDll = new For_Shopkpr(); //DataTable dt = bndDll.bindDropdown(); ddlmall.DataSource = bndDll.bindDropdown(); ddlmall.DataTextField = "Name"; ddlmall.DataValueField = "Id"; ddlmall.DataBind(); ddlmall.Items.Insert(0, "-Please Select-"); } }
protected void btnlogin_Click(object sender, EventArgs e) { For_Shopkpr Login = new For_Shopkpr(); Login.UserName = txtUsername.Text; Login.Password = txtpsswrd.Text; if (Login.Shp_kprLogin() == true) { Session["id"] = Convert.ToInt32(Login.id); Session["Name"] = Login.UserName; Response.Redirect("Home_shpkr.aspx"); lberror.Text = "hello"; } else { lberror.Text = "wrong"; } //lberror.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Redirect("Login.aspx"); } else { txtLoginId.Text = Session["id"].ToString(); For_Shopkpr cat = new For_Shopkpr(); if (!IsPostBack) { ddl_Cat_id.DataSource = cat.bindDDL();; ddl_Cat_id.DataTextField = "Name"; ddl_Cat_id.DataValueField = "Id"; ddl_Cat_id.DataBind(); ddl_Cat_id.Items.Insert(0, "-Select-"); cat.UserId = Convert.ToInt32(txtLoginId.Text); ddlShp_ID.DataSource = cat.bindShpId(); ddlShp_ID.DataTextField = "ShopName"; ddlShp_ID.DataValueField = "Id"; ddlShp_ID.DataBind(); ddlShp_ID.Items.Insert(0, "-Select-"); ddlsbucat.DataSource = cat.binddl_Sub_cat(); ddlsbucat.DataTextField = "Name"; ddlsbucat.DataValueField = "Id"; ddlsbucat.DataBind(); ddlsbucat.Items.Insert(0, "-Select-"); } gridItems.DataSource = cat.bindGrid_items(); gridItems.DataBind(); //if (ddl_Cat_id.SelectedValue != "-Select-") // { // ddlsbucat.DataSource = cat.binddl_Sub_cat(); // ddlsbucat.DataTextField = "Name"; // ddlsbucat.DataValueField = "Id"; // cat.Category_Id = Convert.ToInt32(ddl_Cat_id.SelectedValue.ToString()); // ddlsbucat.DataBind(); // ddlsbucat.Items.Insert(0, "-Select-"); // } } }
protected void btncreate_Click(object sender, EventArgs e) { For_Shopkpr shop_Op = new For_Shopkpr(); shop_Op.Name = txtname.Text; shop_Op.UserName = txtusername.Text; shop_Op.Email = txtemail.Text; shop_Op.Password = txtpassword.Text; shop_Op.Address = txtaddress.Text; shop_Op.Image = DateTime.Now.ToString("ddMMyymmss") + Path.GetExtension(FileUpload1.PostedFile.FileName); FileUpload1.PostedFile.SaveAs(Server.MapPath("~/ShopImg/") + shop_Op.Image); shop_Op.Contact = txtcontact.Text; shop_Op.CNIC = txtcnic.Text; shop_Op.ShopName = txtshopname.Text; shop_Op.MallId = Convert.ToInt32(ddlmall.SelectedValue); shop_Op.CreateShop(); try { MailMessage mm = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mm.From = new MailAddress("*****@*****.**"); mm.To.Add(txtemail.Text); mm.Subject = "Notification"; mm.Body = "Dear Sir Please Complete your registration by clicking the Link http://localhost:49879/Customer.aspx"; SmtpServer.Port = 587; SmtpServer.UseDefaultCredentials = false; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "aspiresrk+?1"); SmtpServer.EnableSsl = true; SmtpServer.Send(mm); lbl1.Text = "Mail Send"; lbl1.Visible = false; } catch (Exception ex) { lbl1.Text = "Fail." + ex.Message; } }
protected void btnadd_Click(object sender, EventArgs e) { For_Shopkpr AdItem = new For_Shopkpr(); AdItem.ShopId = Convert.ToInt32(ddlShp_ID.SelectedValue); AdItem.sub_catId = Convert.ToInt32(ddlsbucat.SelectedValue); AdItem.Name = txtName.Text; AdItem.Created_By = Convert.ToInt32(txtLoginId.Text); AdItem.M_Image = DateTime.Now.ToString("ddMMyymmss") + Path.GetExtension(M_img.PostedFile.FileName); M_img.PostedFile.SaveAs(Server.MapPath("~/Item_Images/") + AdItem.M_Image); AdItem.S_Image = DateTime.Now.ToString("ddMMyymmss") + Path.GetExtension(S_img.PostedFile.FileName); S_img.PostedFile.SaveAs(Server.MapPath("~/Item_Images/") + AdItem.S_Image); //HttpFileCollection uploadFilCol = Request.Files; //for (int i = 0; i < uploadFilCol.Count; i++) //{ // HttpPostedFile file = uploadFilCol[i]; // string fileExt = Path.GetExtension(FileUpload1.FileName).ToLower(); // string fileName = Path.GetFileName(FileUpload1.FileName); // if (fileName != string.Empty) // { // try // { // if (fileExt == ".jpg" || fileExt == ".gif" || fileExt == ".bmp" || fileExt == ".jpeg" || fileExt == ".png") // { // file.SaveAs(Server.MapPath("~/Item_Images/") + fileName); // if (i == 0) // { // Image.ImageUrl = "~/Images/" + fileName; // } // if (i == 1) // { // Image2.ImageUrl = "~/Images/" + fileName; // } AdItem.Add_Items(); }