Beispiel #1
0
        public void Edit_Customer(string FIRST_NAME, string LAST_NAME, string TEL, string EMAIL, byte[] IMAGE_CUSTOMER, string Criterion, int ID)
        {
            DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
            dll.open();
            SqlParameter[] sqlparam = new SqlParameter[7];
            sqlparam[0]       = new SqlParameter("@FIRST_NAME", SqlDbType.VarChar, 25);
            sqlparam[0].Value = FIRST_NAME;
            sqlparam[1]       = new SqlParameter("@LAST_NAME", SqlDbType.VarChar, 25);
            sqlparam[1].Value = LAST_NAME;
            sqlparam[2]       = new SqlParameter("@TEL", SqlDbType.NVarChar, 15);
            sqlparam[2].Value = TEL;
            sqlparam[3]       = new SqlParameter("@EMAIL", SqlDbType.VarChar, 25);
            sqlparam[3].Value = EMAIL;
            sqlparam[4]       = new SqlParameter("@IMAGE_CUSTOMER", SqlDbType.Image);
            sqlparam[4].Value = IMAGE_CUSTOMER;

            sqlparam[5]       = new SqlParameter("@Criterion", SqlDbType.VarChar, 50);
            sqlparam[5].Value = Criterion;

            sqlparam[6]       = new SqlParameter("@ID", SqlDbType.Int);
            sqlparam[6].Value = ID;

            dll.ExecuteCommand("SP_Edit_CUSTOM", sqlparam);
            dll.close();
        }
Beispiel #2
0
        // this to initialize data to datat grid view
        public DataTable GET_ALL_PRODUCTS()
        {
            DAL.DataAcessLayer DLL = new DAL.DataAcessLayer();
            DataTable          dt  = new DataTable();

            dt = DLL.SelectData("SP_GET_ALL_PRODUCT", null);
            DLL.close();
            return(dt);
        }
Beispiel #3
0
        public DataTable GET_Last_Orders_ID_FOR_PRINT()
        {
            DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
            DataTable          dt  = new DataTable();

            dt = dll.SelectData("SP_GET_LAST_ORDER_FOR_PRINT", null);
            dll.close();
            return(dt);
        }
Beispiel #4
0
 //THIS code for delete any item in product
 public void DELETE_PRODUCT(string ID)
 {
     DAL.DataAcessLayer dl = new DAL.DataAcessLayer();
     dl.open();
     SqlParameter[] sqlparam = new SqlParameter[1];
     sqlparam[0]       = new SqlParameter("@ID", SqlDbType.VarChar, 50);
     sqlparam[0].Value = ID;
     dl.ExecuteCommand("SP_DELETE_PRODUCT", sqlparam);
     dl.close();
 }
Beispiel #5
0
 public void Delete_Customer(int id)
 {
     DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
     dll.open();
     SqlParameter[] param = new SqlParameter[1];
     param[0]       = new SqlParameter("@id", SqlDbType.Int);
     param[0].Value = id;
     dll.ExecuteCommand("SP_DELETE_CUSTOMER", param);
     dll.close();
 }
Beispiel #6
0
        public DataTable Select_customers()
        {
            DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
            dll.open();
            DataTable dt = new DataTable();

            dt = dll.SelectData("SP_SELECT_ALL_CUSTOMER", null);
            dll.close();
            return(dt);
        }
Beispiel #7
0
        //to get image
        public DataTable Select_Image(string id)
        {
            DAL.DataAcessLayer dl       = new DAL.DataAcessLayer();
            SqlParameter[]     sqlparam = new SqlParameter[1];
            sqlparam[0]       = new SqlParameter("@ID", SqlDbType.VarChar, 50);
            sqlparam[0].Value = id;
            DataTable dt = new DataTable();

            dt = dl.SelectData("SP_SELECT_IMAGE_PRODUCT", sqlparam);
            dl.close();
            return(dt);
        }
Beispiel #8
0
        public DataTable SEARCH_Users(string Criterion)
        {
            DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
            DataTable          dt  = new DataTable();

            SqlParameter[] sqlparam = new SqlParameter[1];
            sqlparam[0]       = new SqlParameter("@Criterion", SqlDbType.VarChar, 50);
            sqlparam[0].Value = Criterion;

            dt = dll.SelectData("SP_SEARCH_USER", sqlparam);
            dll.close();
            return(dt);
        }
Beispiel #9
0
        //to check if id product found 2 once or one once
        public DataTable VerifyProductID(string ID)
        {
            DAL.DataAcessLayer DLL = new DAL.DataAcessLayer();
            DLL.open();
            SqlParameter[] sqlparam = new SqlParameter[1];
            sqlparam[0]       = new SqlParameter("@ID", SqlDbType.VarChar, 50);
            sqlparam[0].Value = ID;
            DataTable dt = new DataTable();

            dt = DLL.SelectData("SP_VerifyProductID", sqlparam);
            DLL.close();
            return(dt);
        }
Beispiel #10
0
        public DataTable GetOrderDetails(int ID_Order)
        {
            DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
            DataTable          dt  = new DataTable();

            SqlParameter[] sqlparam = new SqlParameter[1];
            sqlparam[0]       = new SqlParameter("@ID_ORDER", SqlDbType.Int);
            sqlparam[0].Value = ID_Order;

            dt = dll.SelectData("SP_GetOrderDetails", sqlparam);
            dll.close();
            return(dt);
        }
Beispiel #11
0
        public DataTable Search_Customer(string criterion)
        {
            DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
            dll.open();
            SqlParameter[] param = new SqlParameter[1];
            param[0]       = new SqlParameter("@Criterion", SqlDbType.VarChar, 50);
            param[0].Value = criterion;
            DataTable dt = new DataTable();

            dt = dll.SelectData("SP_SEARCH_CUSTOMER", param);
            dll.close();
            return(dt);
        }
Beispiel #12
0
        public DataTable VERIFYQTY(string ID_PRODUCT, int QTY_ENTERED)
        {
            DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
            DataTable          dt  = new DataTable();

            SqlParameter[] sqlparam = new SqlParameter[2];
            sqlparam[0]       = new SqlParameter("@ID_PRODUCT", SqlDbType.VarChar, 30);
            sqlparam[0].Value = ID_PRODUCT;
            sqlparam[1]       = new SqlParameter("@QTY_ENTERED", SqlDbType.Int);
            sqlparam[1].Value = QTY_ENTERED;
            dt = dll.SelectData("SP_VERIFYQTY", sqlparam);
            dll.close();
            return(dt);
        }
Beispiel #13
0
        public void EDIT_User(string ID, string fULLNAME, string PWD, string USERTYPE)
        {
            DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
            dll.open();
            SqlParameter[] sqlparam = new SqlParameter[4];
            sqlparam[0]       = new SqlParameter("@ID", SqlDbType.VarChar, 50);
            sqlparam[0].Value = ID;
            sqlparam[1]       = new SqlParameter("@fULLNAME", SqlDbType.VarChar, 50);
            sqlparam[1].Value = fULLNAME;
            sqlparam[2]       = new SqlParameter("@PWD", SqlDbType.VarChar, 50);
            sqlparam[2].Value = PWD;
            sqlparam[3]       = new SqlParameter("@USERTYPE", SqlDbType.VarChar, 50);
            sqlparam[3].Value = USERTYPE;

            dll.ExecuteCommand("SP_EDIT_USERS", sqlparam);
            dll.close();
        }
Beispiel #14
0
        public void ADD_Orders(int ID_ORDER, DateTime DATE_ORDER, int CUSTOMER_ID, string DESCRIPTION_ORDER, string SALESMAN)
        {
            DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
            dll.open();
            SqlParameter[] sqlparam = new SqlParameter[5];
            sqlparam[0]       = new SqlParameter("@ID_ORDER", SqlDbType.Int);
            sqlparam[0].Value = ID_ORDER;
            sqlparam[1]       = new SqlParameter("@DATE_ORDER", SqlDbType.DateTime);
            sqlparam[1].Value = DATE_ORDER;
            sqlparam[2]       = new SqlParameter("@CUSTOMER_ID", SqlDbType.Int);
            sqlparam[2].Value = CUSTOMER_ID;
            sqlparam[3]       = new SqlParameter("@DESCRIPTION_ORDER", SqlDbType.VarChar, 75);
            sqlparam[3].Value = DESCRIPTION_ORDER;
            sqlparam[4]       = new SqlParameter("@SALESMAN", SqlDbType.VarChar, 75);
            sqlparam[4].Value = SALESMAN;

            dll.ExecuteCommand("SP_ADD_ORDER", sqlparam);
            dll.close();
        }
Beispiel #15
0
 // to inisialize to add product data
 public void ADD_PRODUCT(int ID_CAT, string ID_PRODUCT, int QTE, string LABEL_Product, int PRICE, byte[] IMG)
 {
     DAL.DataAcessLayer DAL = new DAL.DataAcessLayer();
     DAL.open();
     SqlParameter[] sqlparam = new SqlParameter[6];
     sqlparam[0]       = new SqlParameter("@ID_CAT", SqlDbType.Int);
     sqlparam[0].Value = ID_CAT;
     sqlparam[1]       = new SqlParameter("@ID_PRODUCT", SqlDbType.VarChar, 30);
     sqlparam[1].Value = ID_PRODUCT;
     sqlparam[2]       = new SqlParameter("@QTE", SqlDbType.Int);
     sqlparam[2].Value = QTE;
     sqlparam[3]       = new SqlParameter("@LABEL", SqlDbType.VarChar, 30);
     sqlparam[3].Value = LABEL_Product;
     sqlparam[4]       = new SqlParameter("@PRICE", SqlDbType.VarChar, 50);
     sqlparam[4].Value = PRICE;
     sqlparam[5]       = new SqlParameter("@IMG", SqlDbType.Image);
     sqlparam[5].Value = IMG;
     DAL.ExecuteCommand("SP_ADD_PRODUCT", sqlparam);
     DAL.close();
 }
Beispiel #16
0
        public void ADD_Order_Details(string ID_PRODUCT, int ID_ORDER, int QTE, string PRICE, float DISCOUNT, string AMOUNT, string TOTAL_AMOUNT)
        {
            DAL.DataAcessLayer dll = new DAL.DataAcessLayer();
            dll.open();
            SqlParameter[] sqlparam = new SqlParameter[7];
            sqlparam[0]       = new SqlParameter("@ID_PRODUCT", SqlDbType.VarChar, 30);
            sqlparam[0].Value = ID_PRODUCT;
            sqlparam[1]       = new SqlParameter("@ID_ORDER", SqlDbType.Int);
            sqlparam[1].Value = ID_ORDER;
            sqlparam[2]       = new SqlParameter("@QTE", SqlDbType.Int);
            sqlparam[2].Value = QTE;
            sqlparam[3]       = new SqlParameter("@PRICE", SqlDbType.VarChar, 50);
            sqlparam[3].Value = PRICE;
            sqlparam[4]       = new SqlParameter("@DISCOUNT", SqlDbType.Float);
            sqlparam[4].Value = DISCOUNT;
            sqlparam[5]       = new SqlParameter("@AMOUNT", SqlDbType.VarChar, 50);
            sqlparam[5].Value = AMOUNT;
            sqlparam[6]       = new SqlParameter("@TOTAL_AMOUNT", SqlDbType.VarChar, 50);
            sqlparam[6].Value = TOTAL_AMOUNT;

            dll.ExecuteCommand("SP_ADD_ORDER_DETAILS", sqlparam);
            dll.close();
        }