コード例 #1
0
ファイル: clsLogin.cs プロジェクト: minhkhong1369/PO
 public DataTable tbLogin_Get()
 {
     string procname = "tbLogin_Get";
     DbAccess db = new DbAccess();
     db.CreateNewSqlCommand();
     db.AddParameter("@Username", Username);
     db.AddParameter("@Password", Password);
     return db.ExecuteDataTable(procname);
 }
コード例 #2
0
ファイル: clsMaterial.cs プロジェクト: minhkhong1369/PthOrder
        //store chèn dữ liệu vào table
        public bool Insert()
        {
            DbAccess db = new DbAccess();
            db.BeginTransaction();

            try
            {
                db.CreateNewSqlCommand();
                db.AddParameter("@MaterialCode", MaterialCode);
                db.AddParameter("@MaterialName", MaterialName);
                if (Images == null)
                {
                    db.AddParameter("@Images", DBNull.Value, "");
                }
                else
                {
                    db.AddParameter("@Images", Images);
                }
                db.AddParameter("@Quota", Quota);
                db.AddParameter("@Groups", Groups);
                db.AddParameter("@Minimum", Minimum);
                db.AddParameter("@Maximum", Maximum);
                db.AddParameter("@Active", Active);
                db.ExecuteNonQueryWithTransaction("tbMaterial_Insert");//thực thi store thêm
                db.CommitTransaction();
                return true;
            }
            catch
            {
                db.RollbackTransaction();
                return false;
            }
        }
コード例 #3
0
ファイル: clsLogin.cs プロジェクト: minhkhong1369/PO
        //Store cập nhật dữ liệu table
        public bool Update()
        {
            DbAccess db = new DbAccess();
            db.BeginTransaction();

            try
            {
                db.CreateNewSqlCommand();
                db.AddParameter("@Username", Username);
                db.AddParameter("@Password", Password);

                db.ExecuteNonQueryWithTransaction("tbLogin_UpdatePass");//thực thi store sửa
                db.CommitTransaction();
                return true;
            }
            catch
            {
                db.RollbackTransaction();
                return false;
            }
        }
コード例 #4
0
ファイル: clsStore.cs プロジェクト: minhkhong1369/PthOrder
        //store chèn dữ liệu vào table
        public bool Insert()
        {
            DbAccess db = new DbAccess();
            db.BeginTransaction();

            try
            {
                db.CreateNewSqlCommand();
                db.AddParameter("@StoreCode", StoreCode);
                db.AddParameter("@StoreName", StoreName);
                db.AddParameter("@Address", Address);
                db.AddParameter("@Telephone", Telephone);
                db.ExecuteNonQueryWithTransaction("tbStore_Insert");//thực thi store thêm
                db.CommitTransaction();
                return true;
            }
            catch
            {
                db.RollbackTransaction();
                return false;
            }
        }
コード例 #5
0
ファイル: clsMaterial.cs プロジェクト: minhkhong1369/PthOrder
 //Store xóa dữ liệu table
 public bool Delete()
 {
     DbAccess db = new DbAccess();
     db.BeginTransaction();
     try
     {
         db.CreateNewSqlCommand();
         db.AddParameter("@MaterialCode", MaterialCode);// xóa dựa vào trường khóa
         db.ExecuteNonQueryWithTransaction("tbMaterial_Delete");//thực thi store xóa
         db.CommitTransaction();
         return true;
     }
     catch
     {
         db.RollbackTransaction();
         return false;
     }
 }
コード例 #6
0
 public DataTable tbMaterialDetails_GetByYear()
 {
     string procname = "tbMaterialDetails_GetByYear";
     DbAccess db = new DbAccess();
     db.CreateNewSqlCommand();
     db.AddParameter("@Years", Years);
     return db.ExecuteDataTable(procname);
 }
コード例 #7
0
ファイル: clsMaterial.cs プロジェクト: minhkhong1369/PthOrder
 //edit du lieu tu ma kho
 public DataTable tbMaterial_GetbyCode()
 {
     string procname = "tbMaterial_GetbyCode";
     DbAccess db = new DbAccess();
     db.CreateNewSqlCommand();
     db.AddParameter("@MaterialCode", MaterialCode);
     return db.ExecuteDataTable(procname);
 }
コード例 #8
0
        //Store cập nhật dữ liệu table
        //update 2
        public bool Update(DataTable dtOrderDetail, DataTable dtOrderDetailTemp)
        {
            DbAccess db = new DbAccess();
            db.BeginTransaction();

            try
            {
                db.CreateNewSqlCommand();
                db.AddParameter("@OrderCode", OrderCode);
                db.AddParameter("@DateSuggest", DateSuggest);
                db.AddParameter("@Followers", Followers);
                db.AddParameter("@SupplierCode", SupplierCode);
                db.AddParameter("@DeliveryDate", DeliveryDate);
                db.AddParameter("@PlaceOfDelivery", PlaceOfDelivery);
                db.AddParameter("@PaymentConditions", PaymentConditions);
                db.AddParameter("@VAT", VAT);
                db.AddParameter("@CurrencyUnit", CurrencyUnit);
                db.ExecuteNonQueryWithTransaction("tbOrder_Update");//begin thực thi store cập nhật dữ liệu
                for (int i = 0; i < dtOrderDetail.Rows.Count; i++)
                {
                    if (dtOrderDetail.Rows[i]["OrderDetailCode"] == DBNull.Value)//dua vao OrderDetailCode de them or sua
                    {

                        Describe = dtOrderDetail.Rows[i]["Describe"].ToString();
                        Number = int.Parse(dtOrderDetail.Rows[i]["Number"].ToString());
                        Unit = dtOrderDetail.Rows[i]["Unit"].ToString();
                        Price = double.Parse(dtOrderDetail.Rows[i]["Price"].ToString());
                        if (dtOrderDetail.Rows[i]["Monetize"] == DBNull.Value)
                        {
                            Monetize = 0;
                        }
                        else
                        {
                            Monetize = double.Parse(dtOrderDetail.Rows[i]["Monetize"].ToString());
                        }
                        SupplierSuggest = dtOrderDetail.Rows[i]["SupplierSuggest"].ToString();
                        db.CreateNewSqlCommand();
                        db.AddParameter("@OrderCode", OrderCode);
                        db.AddParameter("@Describe", Describe);
                        db.AddParameter("@Number", Number);
                        db.AddParameter("@Unit", Unit);
                        db.AddParameter("@Price", Price);
                        db.AddParameter("@Monetize", Monetize);
                        db.AddParameter("@SupplierSuggest", SupplierSuggest);
                        db.ExecuteNonQueryWithTransaction("tbOrderDetail_Insert");
                    }
                    else
                    {
                        OrderDetailCode =int.Parse(dtOrderDetail.Rows[i]["OrderDetailCode"].ToString());
                        Describe = dtOrderDetail.Rows[i]["Describe"].ToString();
                        Number = int.Parse(dtOrderDetail.Rows[i]["Number"].ToString());
                        Unit = dtOrderDetail.Rows[i]["Unit"].ToString();
                        Price = double.Parse(dtOrderDetail.Rows[i]["Price"].ToString());
                        if (dtOrderDetail.Rows[i]["Monetize"] == DBNull.Value)
                        {
                            Monetize = 0;
                        }
                        else
                        {
                            Monetize = double.Parse(dtOrderDetail.Rows[i]["Monetize"].ToString());
                        }
                        SupplierSuggest = dtOrderDetail.Rows[i]["SupplierSuggest"].ToString();
                        db.CreateNewSqlCommand();
                        db.AddParameter("@OrderDetailCode", OrderDetailCode);
                        //db.AddParameter("@OrderCode", OrderCode);
                        db.AddParameter("@Describe", Describe);
                        db.AddParameter("@Number", Number);
                        db.AddParameter("@Unit", Unit);
                        db.AddParameter("@Price", Price);
                        db.AddParameter("@Monetize", Monetize);
                        db.AddParameter("@SupplierSuggest", SupplierSuggest);
                        db.ExecuteNonQueryWithTransaction("tbOrderDetail_Update");
                    }
                }
                //xoa het du lieu bang OrderDetails truyen tu OrderDetailCode bang tam, chi chinh sua moi xoa
                for (int i = 0; i < dtOrderDetailTemp.Rows.Count; i++)
                {
                    OrderDetailCode = int.Parse(dtOrderDetailTemp.Rows[i]["OrderDetailCode"].ToString());
                    db.CreateNewSqlCommand();
                    db.AddParameter("@OrderDetailCode", OrderDetailCode);
                    db.ExecuteNonQueryWithTransaction("tbOrderDetail_Delete");
                }
                db.CommitTransaction();//end
                return true;
            }
            catch
            {
                db.RollbackTransaction();
                return false;
            }
        }
コード例 #9
0
        //Store cập nhật trạng thái
        public bool UpdateStatus()
        {
            DbAccess db = new DbAccess();
            db.BeginTransaction();

            try
            {
                db.CreateNewSqlCommand();
                db.AddParameter("@OrderCode", OrderCode);
                db.AddParameter("@Status", Status);

                db.ExecuteNonQueryWithTransaction("tbOrder_Status");//thực thi store
                db.CommitTransaction();
                return true;
            }
            catch
            {
                db.RollbackTransaction();
                return false;
            }
        }
コード例 #10
0
 public DataTable tbOrder_GetAutocode()
 {
     string procname = "tbOrder_GetAutocode";
     DbAccess db = new DbAccess();
     db.CreateNewSqlCommand();
     db.AddParameter("@Year", Year);
     return db.ExecuteDataTable(procname);
 }
コード例 #11
0
 public DataTable tbOrder_Get()
 {
     string procname = "tbOrder_Get";
     DbAccess db = new DbAccess();
     db.CreateNewSqlCommand();
     db.AddParameter("@OrderCode", OrderCode);
     return db.ExecuteDataTable(procname);
 }
コード例 #12
0
 public DataTable tbOrderDetails_FindOrder()
 {
     string procname = "tbOrderDetails_FindOrder";
     DbAccess db = new DbAccess();
     db.CreateNewSqlCommand();
     db.AddParameter("@Describe", Describe);
     return db.ExecuteDataTable(procname);
 }
コード例 #13
0
        //store chèn dữ liệu vào table
        public bool Insert(DataTable dtOrderDetail)
        {
            DbAccess db = new DbAccess();
            db.BeginTransaction();

            try
            {
                db.CreateNewSqlCommand();
                db.AddParameter("@OrderCode", OrderCode);
                db.AddParameter("@DateSuggest", DateSuggest);
                db.AddParameter("@Followers", Followers);
                db.AddParameter("@SupplierCode", SupplierCode);
                db.AddParameter("@DeliveryDate", DeliveryDate);
                db.AddParameter("@PlaceOfDelivery", PlaceOfDelivery);
                db.AddParameter("@PaymentConditions", PaymentConditions);
                db.AddParameter("@VAT", VAT);
                db.AddParameter("@CurrencyUnit", CurrencyUnit);
                db.ExecuteNonQueryWithTransaction("tbOrder_Insert");//thực thi store chèn
                for (int i = 0; i < dtOrderDetail.Rows.Count; i++)
                {
                    Describe = dtOrderDetail.Rows[i]["Describe"].ToString();
                    Number = int.Parse(dtOrderDetail.Rows[i]["Number"].ToString());
                    Unit = dtOrderDetail.Rows[i]["Unit"].ToString();
                    Price = double.Parse(dtOrderDetail.Rows[i]["Price"].ToString());
                    if (dtOrderDetail.Rows[i]["Monetize"] == DBNull.Value)
                    {
                        Monetize = 0;
                    }else
                    {
                        Monetize = double.Parse(dtOrderDetail.Rows[i]["Monetize"].ToString());
                    }
                    SupplierSuggest = dtOrderDetail.Rows[i]["SupplierSuggest"].ToString();
                    db.CreateNewSqlCommand();
                    db.AddParameter("@OrderCode", OrderCode);
                    db.AddParameter("@Describe", Describe);
                    db.AddParameter("@Number", Number);
                    db.AddParameter("@Unit", Unit);
                    db.AddParameter("@Price", Price);
                    db.AddParameter("@Monetize", Monetize);
                    db.AddParameter("@SupplierSuggest", SupplierSuggest);
                    db.ExecuteNonQueryWithTransaction("tbOrderDetail_Insert");

                }

                db.CommitTransaction();
                return true;
            }
            catch
            {
                db.RollbackTransaction();
                return false;
            }
        }
コード例 #14
0
ファイル: clsListSupplier.cs プロジェクト: minhkhong1369/PO
        //store chèn dữ liệu vào table
        public bool Insert()
        {
            DbAccess db = new DbAccess();
            db.BeginTransaction();

            try
            {
                db.CreateNewSqlCommand();
                db.AddParameter("@SupplierCode", SupplierCode);
                db.AddParameter("@SupplierName", SupplierName);
                db.AddParameter("@Address", Address);
                db.AddParameter("@Telephone", Telephone);
                db.AddParameter("@Mail", Mail);
                db.AddParameter("@Group", Group);
                db.AddParameter("@Contact", Contact);
                db.AddParameter("@Note", Note);
                db.ExecuteNonQueryWithTransaction("tbSupplier_Insert");//thực thi store thêm
                db.CommitTransaction();
                return true;
            }
            catch
            {
                db.RollbackTransaction();
                return false;
            }
        }