//search Flower Id one record public int flowerSearch() { try { String SelectStatement = " SELECT code FROM [BlackLotusDB].[dbo].[FlowerTable] WHERE [code] = '" + flowerId + "' "; //check valid primary key value or not using IsEmptyClass-->isValidColumData(sqlSelectStatement, Checking, databaseColumName) method String Coluame = "code"; String Check = flowerId; ////Check primary key colum value == input value IsEmptyClass obj = new IsEmptyClass(); if (obj.IsValidColumData(SelectStatement, Check, Coluame) == 1) { //if CheckValidusername() return value = 1 String sql = " SELECT code,name,description,quentity,categoryNameOrCode,price FROM [BlackLotusDB].[dbo].[FlowerTable] WHERE [code] = '" + flowerId + "' "; SqlDataReader dr = DBClass.DataAdapterMethod(sql); if (dr.HasRows) { while (dr.Read()) { //database colum value assign to new variable flowerId = dr["code"].ToString(); flowerName = dr["name"].ToString(); flowerDescription = dr["description"].ToString(); flowerQuentity = dr["quentity"].ToString(); //out put int value flowerCategory = dr["categoryNameOrCode"].ToString(); flowerPriceone = dr["price"].ToString(); //flowerNo = dr["id"].ToString(); //Image read //MemoryStream mss = new MemoryStream((byte[])dr["image"]); //Img = new Bitmap(mss); } x = 1; } else { x = 0; } } else { x = 0; } return(x); } catch (Exception) { throw; } }
public int orderDelete() { try { //check valid primary key value or not using IsEmptyClass-->isValidColumData(sqlSelectStatement, Checking, databaseColumName) method String SelectStatement = " SELECT [OrderC] FROM [BlackLotusDB].[dbo].[OrderTable] WHERE OrderC= " + Convert.ToInt32(orderId) + " "; String Coluame = "OrderC"; String Check = orderId.ToString(); ////Check primary key colum value == input value IsEmptyClass obj = new IsEmptyClass(); if (obj.IsValidColumData(SelectStatement, Check, Coluame) == 1) { //if Check Valid true if return value = 1 // 1--customer Table Row delete becourse order id is a primary key // customerDelete(); //2-- Shipind details row delete order id is a primary key // shipinDelatilsDelete(); //3-- order table delete order id is a primary key //String sql = "UPDATE se //code = '" + categoryId + "' , string sql = " DELETE FROM [OrderTable] WHERE OrderC = " + Convert.ToInt32(orderId) + " "; //executenonquery return true=1 false 0 DATALAYER if (DBClass.ExecuteMethod(sql) > 0) { x = 1; } else { x = 0; } } else { x = 0; } return(x); } catch (Exception) { throw; } }
//search category public int CategorySearch() { try { String SelectStatement = " SELECT code FROM [BlackLotusDB].[dbo].[CategoryTable] WHERE code= '" + CategoryId + "' "; String Coluame = "code"; String Check = CategoryId; ////Check primary key colum value == input value IsEmptyClass obj = new IsEmptyClass(); if (obj.IsValidColumData(SelectStatement, Check, Coluame) == 1) { //if CheckValidusername() return value = 1 String sql = " SELECT code,name FROM [BlackLotusDB].[dbo].[CategoryTable] WHERE code= '" + CategoryId + "' OR name='" + CategoryName + "' "; SqlDataReader dr = DBClass.DataAdapterMethod(sql); if (dr.HasRows) { while (dr.Read()) { //database colum value assign to new variable //dataReader Obj[String DataBaseTablecolumName].ToString(); CategoryId = dr["code"].ToString(); CategoryName = dr["name"].ToString(); // CategoryNo = dr["id"].ToString(); } x = 1; } else { x = 0; } } else { x = 0; } return(x); } catch (Exception) { throw; } }
//order id pass public int orderIdChec() { try { String SelectStatement = " SELECT OrderC FROM [BlackLotusDB].[dbo].[OrderTable] WHERE OrderC = '" + orderId + "' "; String Coluame = "OrderC"; String Check = orderId; ////Check primary key colum value == input value IsEmptyClass obj = new IsEmptyClass(); if (obj.IsValidColumData(SelectStatement, Check, Coluame) == 1) { //if CheckValidusername() return value = 1 String sql = " SELECT OrderC FROM [BlackLotusDB].[dbo].[OrderTable] WHERE OrderC = '" + orderId + "' "; SqlDataReader dr = DBClass.DataAdapterMethod(sql); if (dr.HasRows) { while (dr.Read()) { //database colum value assign to new variable //dataReader Obj[String DataBaseTablecolumName].ToString(); orderId = dr["order"].ToString(); } x = 1; } else { x = 0; } } else { x = 0; } return(x); } catch (Exception) { throw; } }
public int shipinDelatilsDelete() { try { //check valid primary key value or not using IsEmptyClass-->isValidColumData(sqlSelectStatement, Checking, databaseColumName) method String SelectStatement = " SELECT shiOrder FROM [BlackLotusDB].[dbo].[ShipinTable] WHERE shiOrder= " + Convert.ToInt32(orderId) + " "; String Coluame = "shiOrder"; String Check = orderId; ////Check primary key colum value == input value IsEmptyClass obj = new IsEmptyClass(); if (obj.IsValidColumData(SelectStatement, Check, Coluame) == 1) { //if CheckValidusername() return value = 1 //String sql = "UPDATE se //code = '" + categoryId + "' , string sql = "DELETE From ShipinTable WHERE shiOrder= " + Convert.ToInt32(orderId) + " "; //executenonquery return true=1 false 0 DATALAYER if (DBClass.ExecuteMethod(sql) > 0) { x = 1; Console.WriteLine("Deleted"); } else { x = 0; } } else { x = 0; } return(x); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }
public int flowerUpdate() { try { //check valid primary key value or not using IsEmptyClass-->isValidColumData(sqlSelectStatement, Checking, databaseColumName) method String SelectStatement = " SELECT code FROM [BlackLotusDB].[dbo].[FlowerTable] WHERE code= '" + flowerId + "' "; String Coluame = "code"; String Check = flowerId; ////Check primary key colum value == input value IsEmptyClass obj = new IsEmptyClass(); if (obj.IsValidColumData(SelectStatement, Check, Coluame) == 1) { //if CheckValidusername() return value = 1 //String sql = "UPDATE se //code = '" + categoryId + "' , String sql = " UPDATE FlowerTable SET name='" + flowerName + "' ,description='" + flowerDescription + "' ,quentity=" + Convert.ToInt32(flowerQuentity) + " , categoryNameOrCode='" + flowerCategory + "' ,price=" + Convert.ToDouble(flowerPriceone) + " WHERE code= '" + flowerId + "' "; //executenonquery return true=1 false 0 DATALAYER //image='" + flowerImageFile + "', if (DBClass.ExecuteMethod(sql) > 0) { x = 1; Console.WriteLine("updated"); } else { x = 0; } } else { x = 0; } return(x); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }
public int CategoryUpdate() { try { //check valid primary key value or not using IsEmptyClass-->isValidColumData(sqlSelectStatement, Checking, databaseColumName) method String SelectStatement = " SELECT code FROM [BlackLotusDB].[dbo].[CategoryTable] WHERE code= '" + CategoryId + "' "; String Coluame = "code"; String Check = CategoryId; ////Check primary key colum value == input value IsEmptyClass obj = new IsEmptyClass(); if (obj.IsValidColumData(SelectStatement, Check, Coluame) == 1) { //if CheckValidusername() return value = 1 //String sql = "UPDATE se //code = '" + categoryId + "' , String sql = " UPDATE CategoryTable SET name= '" + CategoryName + "' WHERE code= '" + CategoryId + "' "; //executenonquery return true=1 false 0 DATALAYER if (DBClass.ExecuteMethod(sql) > 0) { x = 1; Console.WriteLine("updated"); } else { x = 0; } } else { x = 0; } return(x); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }
public int customerUpdate() { try { //check valid primary key value or not using IsEmptyClass-->isValidColumData(sqlSelectStatement, Checking, databaseColumName) method String SelectStatement = " SELECT cusOrder FROM [BlackLotusDB].[dbo].[CustomerTable] WHERE cusOrder= " + Convert.ToInt32(orderId) + " "; String Coluame = "cusOrder"; String Check = orderId; ////Check primary key colum value == input value IsEmptyClass obj = new IsEmptyClass(); if (obj.IsValidColumData(SelectStatement, Check, Coluame) == 1) { //if CheckValidusername() return value = 1 //String sql = "UPDATE se //code = '" + categoryId + "' , String sql = " UPDATE CustomerTable SET firstName='" + firstName + "',lastName='" + lastName + "' , mobileNumber='" + mobileNumber + "' ,email='" + email + "' WHERE cusOrder=" + Convert.ToInt32(orderId) + " )"; //executenonquery return true=1 false 0 DATALAYER if (DBClass.ExecuteMethod(sql) > 0) { x = 1; Console.WriteLine("updated"); } else { x = 0; } } else { x = 0; } return(x); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }