public int checkcount(ecprops p) { // SqlConnection conn = new SqlConnection(connectionString); // SqlDataAdapter dAd = new SqlDataAdapter("Select Count(*) FROM Categories where CategoryName ='" + txtaddcat.Text + "'", conn); // DataTable dTable = new DataTable(); // dAd.Fill(dTable); // return dTable; //ecprops p=new ecprops(); string query = "Select Count(*) FROM Categories where CategoryName ='" + p.addcat + "'"; SqlConnection conn = new SqlConnection(connectionString); conn.Open(); SqlCommand dCmd = new SqlCommand(query, conn); //dCmd.CommandType = CommandType.StoredProcedure; // try // { // dCmd.Parameters.AddWithValue("@UserName", Username); return((int)dCmd.ExecuteScalar()); /*} * catch * { * throw; * } * finally * { * dCmd.Dispose(); * conn.Close(); * conn.Dispose(); * }*/ }
public bool blladdrole(ecprops p) { bool b = d.daladdrole(p); return(b); //return true; }
public bool bll_insertproducts(ecprops p) { bool b = d.dal_insertproducts(p); return(b); //return true; }
public int dll_viewcart(ecprops p) { string query = "select count(*) from ShoppingCart where CustomerID='" + p.customerid + "'"; SqlConnection conn = new SqlConnection(connectionString); conn.Open(); SqlCommand dCmd = new SqlCommand(query, conn); return((int)dCmd.ExecuteScalar()); }
public int checkassingrolecount(ecprops p) { string query = "Select Count(*) FROM roles inner join users on roles.UserID=users.UserID inner join groups on roles.GroupID =groups.GroupID where username ='******' AND RoleName = '" + p.myrolename + "'"; SqlConnection conn = new SqlConnection(connectionString); conn.Open(); SqlCommand dCmd = new SqlCommand(query, conn); return((int)dCmd.ExecuteScalar()); }
public int checkcountrole(ecprops p) { string query = "Select Count(*) FROM Groups where RoleName ='" + p.rolename + "'"; SqlConnection conn = new SqlConnection(connectionString); conn.Open(); SqlCommand dCmd = new SqlCommand(query, conn); return((int)dCmd.ExecuteScalar()); }
public int dll_salecount(ecprops p) { string query = "select count(*) from Orders where OrderDate between '" + p.strDate + "' and '" + p.endDate + "'"; SqlConnection conn = new SqlConnection(connectionString); conn.Open(); SqlCommand dCmd = new SqlCommand(query, conn); return((int)dCmd.ExecuteScalar()); }
//admin orders public DataTable dllorderreader(ecprops p) { SqlConnection conn = new SqlConnection(connectionString); SqlDataAdapter dAd = new SqlDataAdapter("select customerID,FirstName,LastName,Company,Address,Country,Province,ZipCode,Telephone,Fax,City,Status,totalAmount from Orders where OrderID='" + p.orderid + "'", conn); DataTable dTable = new DataTable(); dAd.Fill(dTable); return(dTable); }
public DataTable dllstockhistory(ecprops p) { SqlConnection conn = new SqlConnection(connectionString); SqlDataAdapter dAd = new SqlDataAdapter("Select * from stock where ProductId='" + p.proid + "'", conn); DataTable dTable = new DataTable(); dAd.Fill(dTable); return(dTable); }
protected void Page_Load(object sender, EventArgs e) { ecprops prop = new ecprops(); prop.customerid = HttpContext.Current.User.Identity.Name; Businesslayer bus = new Businesslayer(); int count = bus.bll_viewcart(prop); if (HttpContext.Current.User.Identity.IsAuthenticated) { lbluser.Text = "Welcome  " + HttpContext.Current.User.Identity.Name; lnksignin.Visible = false; lnksignout.Visible = true; lnkorderhistory.Visible = true; lnkviewcart.Visible = true; //top menu Lnktopsignin.Visible = false; lnktopsignout.Visible = true; lnktoporders.Visible = true; lnktopviewcart.Visible = true; lnktopregister.Visible = false; lblshow.Text = " " + count + " items in cart"; } else { lbluser.Text = "Welcome Guest"; lnksignin.Visible = true; lnksignout.Visible = false; lnkviewcart.Visible = false; lnkorderhistory.Visible = false; //top menu Lnktopsignin.Visible = true; lnktopsignout.Visible = false; lnktopviewcart.Visible = false; lnktoporders.Visible = false; lnktopregister.Visible = true; } if (HttpContext.Current.User.IsInRole("Admin")) { lnkadmin.Visible = true; lnkadminmenu.Visible = true; } else { lnkadmin.Visible = false; lnkadminmenu.Visible = false; } }
public DataTable dllgridorder(ecprops p) { SqlConnection conn = new SqlConnection(connectionString); //SqlDataAdapter dAd = new SqlDataAdapter("select Products.ProductID,Products.ProductName,OrderDetails.UnitCost,OrderDetails.Quantity from Products RIGHT JOIN OrderDetails on Products.ProductID=OrderDetails.ProductID where OrderID='" +p.orderidgrid+ "'", conn); SqlDataAdapter dAd = new SqlDataAdapter("select ProductID,ProductName,UnitCost,Quantity from OrderDetails where OrderID='" + p.orderidgrid + "'", conn); DataTable dTable = new DataTable(); dAd.Fill(dTable); return(dTable); }
public DataTable dllLoadProfit(ecprops p) { string status = "Completed"; SqlConnection conn = new SqlConnection(connectionString); //SqlDataAdapter dAd = new SqlDataAdapter("SELECT Products.ProductID,Products.ProductName, Products.origionalPrice, OrderDetails.Quantity,OrderDetails.UnitCost,OrderDetails.PurchaseDate FROM Products LEFT JOIN OrderDetails ON Products.ProductID=OrderDetails.ProductID where OrderDetails.PurchaseDate Between '" + p.strDate + "' and '" + p.endDate + "'", conn); string query = "select * from OrderDetails Left Join Orders On OrderDetails.OrderID=Orders.OrderID where OrderDetails.PurchaseDate Between '" + p.strDate + "' and '" + p.endDate + "' and Orders.Status='" + status + "'"; SqlDataAdapter dAd = new SqlDataAdapter(query, conn); DataTable dTable = new DataTable(); dAd.Fill(dTable); return(dTable); }
protected void btnLogin_Click(object sender, EventArgs e) { ecprops _user = new ecprops(); dbcon dbo = new dbcon(); _user = dbo.CheckUser(txtUserid.Text); if (_user != null) { if (_user.Password == txtPassword.Text) { FormsAuthenticationTicket Authticket = new FormsAuthenticationTicket( 1, txtUserid.Text, DateTime.Now, DateTime.Now.AddMinutes(30), chkRemeberMe.Checked, _user.RoleName, FormsAuthentication.FormsCookiePath); string hash = FormsAuthentication.Encrypt(Authticket); HttpCookie Authcookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash); if (Authticket.IsPersistent) { Authcookie.Expires = Authticket.Expiration; } Response.Cookies.Add(Authcookie); string returnUrl = Request.QueryString["ReturnUrl"]; if (returnUrl == null) { returnUrl = "Default.aspx"; } Response.Redirect(returnUrl); } else { lblMessage.Text = "Password does'nt match."; } } else { lblMessage.Text = "User not exists."; } }
public DataTable bllLoadProfit(ecprops p) { dbcon obj = new dbcon(); try { return(obj.dllLoadProfit(p)); } catch { throw; } finally { obj = null; } }
public DataTable bllgridorder(ecprops p) { dbcon obj = new dbcon(); try { return(obj.dllgridorder(p)); } catch { throw; } finally { obj = null; } }
public DataTable bllstockhistory(ecprops pro) { dbcon obj = new dbcon(); try { return(obj.dllstockhistory(pro)); } catch { throw; } finally { obj = null; } }
public int assingrolecount(ecprops p) { dbcon obj = new dbcon(); try { return(obj.checkassingrolecount(p)); } catch { throw; } finally { obj = null; } }
public int bll_salecount(ecprops p) { dbcon obj = new dbcon(); try { return(obj.dll_salecount(p)); } catch { throw; } finally { obj = null; } }
public int countrole(ecprops p) { dbcon obj = new dbcon(); try { return(obj.checkcountrole(p)); } catch { throw; } finally { obj = null; } }
public bool dal_insertproducts(ecprops p) { String query = "insert into Products(CategoryID,ProductName,ProductImage,UnitCost,Description,origionalPrice,productquantity) select CategoryID,'" + p.proproductname + "','" + "Images/" + p.filename + "'," + p.unitcost + ",'" + p.desc + "','" + p.oprice + "','" + p.proquantity + "' from Categories where CategoryName='" + p.procatname + "'"; b = obj.UDI(query); if (b) { return(true); } else { return(false); } }
public bool dllassignrole(ecprops p) { String query = "INSERT INTO ROLES (UserId,GroupId) SELECT UserId,GroupId FROM Users, Groups WHERE username= '******' AND RoleName='" + p.rolename + "'";; b = obj.UDI(query); if (b) { return(true); } else { return(false); } }
public bool daladdrole(ecprops p) { String query = "insert into groups values ('" + p.addrole + "')"; b = obj.UDI(query); if (b) { return(true); } else { return(false); } }
//ecprops prop = new ecprops(); public bool dal_insert(ecprops p) { String query = "INSERT INTO Categories VALUES('" + p.CatName + "')"; b = obj.UDI(query); if (b) { return(true); } else { return(false); } }
private DataTable Loadrolename() { DataTable dTable = new DataTable(); try { dTable = bus.bllloadrolename(); } catch (Exception ee) { //lblMessage.Text = ee.Message.ToString(); } finally { p = null; } return(dTable); }
public ecprops CheckUser(string UserName) { MAconn = new SqlConnection(connectionString); const string SP_CHECKUSER = "******"; MAconn.Open(); MAcmd = new SqlCommand(SP_CHECKUSER, MAconn); MAcmd.CommandType = CommandType.StoredProcedure; MAcmd.Parameters.Add("@UserName", DbType.String).Value = UserName; dr = MAcmd.ExecuteReader(); ecprops _user = null; while (dr.Read()) { _user = new ecprops(); _user.Password = dr["Password"].ToString(); _user.RoleName = dr["RoleName"].ToString(); } return(_user); }
private SqlDataReader loadcomb() { Businesslayer p = new Businesslayer(); SqlDataReader dr = null; try { dr = p.bllloadreader(); } catch (Exception ee) { //lblMessage.Text = ee.Message.ToString(); } finally { p = null; } return(dr); }
public bool bllassignrole(ecprops p) { bool b = d.dllassignrole(p); return(b); }
protected void btnreg_Click(object sender, EventArgs e) { registerUser reg = new registerUser(); dbcon obj = new dbcon(); string querycount = "Select Count(*) FROM users where UserName ='******'"; //string querycount = "Select Count(*) FROM users where UserName ='******'"; //SqlCommand cmd = new SqlCommand(); // cmd.Parameters.AddWithValue("@UserName", txtUserName.Text); int count = obj.ohh(querycount); if (count > 0) { lblreg.Text = "The User Already Exits"; } else { //registerUser reg = new registerUser(); reg.UserName = txtUserName.Text; reg.Password = txtPassword.Text; reg.FirstName = txtfirstname.Text; reg.LastName = txtlastname.Text; reg.Email = txtemail.Text; reg.MobileNo = txtmobileno.Text; int b = reg.insertUser(reg); if (b == 1) { //lblreg.Text = "User Registration Successful"; //lblreg.Text = reg.result; } else { // lblreg.Text = "Oh Their is Some Problem, Come back Lator"; //lblreg.Text = reg.result; } ecprops _user = new ecprops(); dbcon dbo = new dbcon(); _user = dbo.CheckUser(txtUserName.Text); if (_user != null) { if (_user.Password == txtPassword.Text) { FormsAuthenticationTicket Authticket = new FormsAuthenticationTicket( 1, txtUserName.Text, DateTime.Now, DateTime.Now.AddMinutes(30), CheckBox1.Checked, _user.RoleName, FormsAuthentication.FormsCookiePath); string hash = FormsAuthentication.Encrypt(Authticket); HttpCookie Authcookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash); if (Authticket.IsPersistent) { Authcookie.Expires = Authticket.Expiration; } Response.Cookies.Add(Authcookie); string returnUrl = Request.QueryString["ReturnUrl"]; if (returnUrl == null) { returnUrl = "Default.aspx"; } Response.Redirect(returnUrl); } else { lblreg.Text = "Password does'nt match."; } } else { lblreg.Text = "User not exists."; } } }