Exemple #1
0
        public static int Insert(ConfigItem p_configItem, DataRow p_row)
        {
            int ma = 0;

            try
            {
                object[] arrValue = new object[] {
                    p_row["Name"],
                    p_row["Group_Pk"],
                    p_configItem.Login_UserName,
                    p_row["Remark"],
                    p_row["Unit_Pk"],
                    p_row["slton"]
                };
                string[] arrParaName = new string[] {
                    "@Name",
                    "@Group_Pk",
                    "@Crt_By",
                    "@Remark",
                    "@Unit_Pk",
                    "@number_in"
                };

                COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_configItem);
                ma = _sql.ExecuteInsert("USP_INS_ITEM", arrNames: arrParaName, arrValues: arrValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ma);
        }
Exemple #2
0
 public static int Insert(ConfigItem p_ConfigItem, object[] parramValue)
 {
     COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem);
     try
     {
         string[] arrParaName = new string[] {
             "@Name",
             "@Phone",
             "@Address",
             "@Fax",
             "@Email",
             "@Website",
             "@Crt_By",
             "@TaxCode",
             "@Credit",
             "@Debit"
         };
         _sql.Connect(p_ConfigItem);
         return(_sql.ExecuteInsert("USP_INS_SUPPLIER", arrParaName, parramValue));
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         _sql.Disconnect();
     }
 }
Exemple #3
0
        private bool InsertData(DataTable tbDetail, int _id_WareHouse, int _TotalAMT, int _iId_Supplier_Pk, DateTime _iTake_In_Date, int _User_Pk, string _BillNumber, string _Remark, DateTime _billdate)
        {
            System.Data.SqlClient.SqlConnection _sqlConnection = new System.Data.SqlClient.SqlConnection(_ConfigItem.StrConnection);
            if (_sqlConnection.State != ConnectionState.Open)
            {
                _sqlConnection.Open();
            }
            System.Data.SqlClient.SqlTransaction _sqlTransaction = _sqlConnection.BeginTransaction();
            try
            {
                int _iNumberItem = tbDetail.Rows.Count;

                string[] arrName  = new string[] { "@Supplier_Pk", "@Take_In_Date", "@Number_Item", "@TotalAMT", "@Crt_By", "@WareHouse_Pk", "@Remark", "@BillNumber", "@BillDate", "@User_Pk" };
                object[] arrValue = new object[] { _iId_Supplier_Pk, _iTake_In_Date, _iNumberItem, _TotalAMT, _ConfigItem.Login_UserName, _id_WareHouse, _Remark, _BillNumber, _billdate, _User_Pk };
                _providerSQL = new COREBASE.COMMAND.SQL.AccessSQL();
                int _idMaster = _providerSQL.ExecuteInsert(_sqlConnection, _sqlTransaction, "USP_INS_TAKE_IN", arrName, arrValue);
                for (int i = 0; i < _iNumberItem; i++)
                {
                    arrName = new string[] {
                        "@Take_In_Pk",
                        "@Crt_By",
                        "@Remark",
                        "@Number_Bill",
                        "@Number_Real",
                        "@Price",
                        "@Vat",
                        "@Item_Pk",
                        "@UnitStyle_Pk"
                    };
                    arrValue = new object[] {
                        _idMaster,
                        _ConfigItem.Login_UserName,
                        string.Empty,
                        tbDetail.Rows[i]["Number_Bill"],
                        tbDetail.Rows[i]["Number_Real"],
                        tbDetail.Rows[i]["Price"],
                        tbDetail.Rows[i]["Vat"],
                        tbDetail.Rows[i]["Item_Pk"],
                        tbDetail.Rows[i]["UnitStyle_Pk"]
                    };
                    _providerSQL.ExecuteNonQuery(_sqlConnection, _sqlTransaction, "USP_INS_TAKE_IN_DETAIL", arrName, arrValue);
                }
                _sqlTransaction.Commit();
                _providerSQL.Disconnect(_sqlConnection);
                return(true);
            }
            catch (Exception ex)
            {
                _sqlTransaction.Rollback();
                AppDebug(ex);
                if (_providerSQL != null)
                {
                    if (_sqlConnection != null)
                    {
                        _providerSQL.Disconnect(_sqlConnection);
                    }
                }
                return(false);
            }
        }
Exemple #4
0
        public static int Insert(ConfigItem p_configItem, DataRow p_dtRow)
        {
            int ma = 0;

            try
            {
                object[] arrValue = new object[] {
                    p_dtRow["Unit_In_Pk"],
                    p_dtRow["Unit_Out_Pk"],
                    p_dtRow["Remark"],
                    p_dtRow["Num"],
                    p_configItem.Login_UserName
                };
                string[] arrParaName = new string[] {
                    "@Unit_In_Pk",
                    "@Unit_Out_Pk",
                    "@Remark",
                    "@Num",
                    "@Crt_By"
                };

                COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_configItem);
                ma = _sql.ExecuteInsert("USP_INS_UNIT_STYLE", arrParaName, arrValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ma);
        }
Exemple #5
0
        public static int Insert(ConfigItem p_ConfigItem, object[] arrValue)
        {
            int ma = 0;

            COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem);
            try
            {
                string[] arrParaName = new string[] {
                    "@Name_Dis",
                    "@Name",
                    "@Password",
                    "@Crt_By",
                    "@Remark",
                    "@Phone",
                    "@Address",
                    "@Department_Pk"
                };
                _sql.Connect(p_ConfigItem);
                ma = _sql.ExecuteInsert("USP_INS_USER", arrNames: arrParaName, arrValues: arrValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _sql.Disconnect();
            }
            return(ma);
        }
Exemple #6
0
 public static int Insert(ConfigItem p_ConfigItem, Supplier p_Supplier)
 {
     COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem);
     try
     {
         string[] arrParaName = new string[] {
             "@Name",
             "@Phone",
             "@Phone1",
             "@Address",
             "@Address1",
             "@Fax",
             "@Email",
             "@Website",
             "@Crt_By",
             "@TaxCode",
             "@Credit",
             "@Debit"
         };
         object[] arrParaValue = new object[] {
             p_Supplier.Name,
             p_Supplier.Phone,
             p_Supplier.Phone1,
             p_Supplier.Address,
             p_Supplier.Address1,
             p_Supplier.Fax,
             p_Supplier.Email,
             p_Supplier.Website,
             p_ConfigItem.Login_UserName,
             p_Supplier.TaxCode,
             p_Supplier.Credit,
             p_Supplier.Debit
         };
         _sql.Connect(p_ConfigItem);
         return(_sql.ExecuteInsert("USP_INS_SUPPLIER", arrParaName, arrParaValue));
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         _sql.Disconnect();
     }
 }
Exemple #7
0
        public int Insert(object[] arrValue)
        {
            int ma = 0;

            try
            {
                string[] arrParaName = new string[] {
                    "@Item_Pk",
                    "@Department_Form_Pk",
                    "@Department_To_Pk",
                    "@Number_Item"
                };
                COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(confItem);
                ma = _sql.ExecuteInsert("USP_INS_TRANFERITEM", arrNames: arrParaName, arrValues: arrValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ma);
        }
Exemple #8
0
 public static int Insert(ConfigItem p_ConfigItem, object[] arrValue)
 {
     COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem);
     try
     {
         string[] arrParaName = new string[] {
             "@Name",
             "@Crt_Dt",
             "@Crt_By",
             "@Remark"
         };
         _sql.Connect(p_ConfigItem);
         return(_sql.ExecuteInsert("USP_INS_UNIT", arrNames: arrParaName, arrValues: arrValue));
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         _sql.Disconnect();
     }
 }
Exemple #9
0
        public int Insert(object [] arrValue)
        {
            int ma = 0;

            try
            {
                string[] arrParaName = new string[] {
                    "@Name",
                    "@Crt_Dt",
                    "@Crt_By",
                    "@Is_Del",
                    "@Remark",
                    "@Id_Cat"
                };

                COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(confItem);
                ma = _sql.ExecuteInsert("usp_InsertVPP_GROUP", arrNames: arrParaName, arrValues: arrValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ma);
        }
        public int Insert(object[] arrValue)
        {
            int ma = 0;

            try
            {
                string[] arrParaName = new string[] {
                    "@Id_Dis",
                    "@Name",
                    "@Crt_By",
                    "@Remark",
                    "@Phone",
                    "@LeaderId"
                };

                COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(confItem);
                ma = _sql.ExecuteInsert("USP_INS_DEPARTMENT", arrNames: arrParaName, arrValues: arrValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ma);
        }
Exemple #11
0
 public static int Insert(ConfigItem p_configItem, DataRow p_drGroup)
 {
     COREBASE.COMMAND.SQL.AccessSQL l_sql = new COREBASE.COMMAND.SQL.AccessSQL(p_configItem);
     try
     {
         string[] l_arrName  = new string[] { "@Name", "@Crt_By", "@Remark", "@ID_Cat" };
         object[] l_arrValue = new object[] {
             p_drGroup["Name"],
             p_configItem.Login_UserName,
             p_drGroup["Remark"],
             p_drGroup["Id_Cat"]
         };
         l_sql.Connect(p_configItem);
         return(l_sql.ExecuteInsert("USP_INS_GROUP", l_arrName, l_arrValue));
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         l_sql.Disconnect();
     }
 }
Exemple #12
0
        public static bool Insert(ConfigItem p_ConfigItem, DataRow p_drValue, DataTable p_dtValue)
        {
            bool l_rs = false;

            System.Data.SqlClient.SqlConnection _sqlConnection = new System.Data.SqlClient.SqlConnection(p_ConfigItem.StrConnection);
            if (_sqlConnection.State != ConnectionState.Open)
            {
                _sqlConnection.Open();
            }
            System.Data.SqlClient.SqlTransaction _sqlTransaction = _sqlConnection.BeginTransaction();
            COREBASE.COMMAND.SQL.AccessSQL       _providerSQL    = new COREBASE.COMMAND.SQL.AccessSQL();
            try
            {
                string[] arrParaName = new string[] {
                    "@Number_Item",
                    "@Remark",
                    "@Crt_By",
                    "@Department_pk",
                    "@PriceTotal",
                    "@Take_Out_Date",
                    "@User_Pk"
                };
                object[] arrValue = new object[] {
                    p_drValue["Number_Item"],
                    p_drValue["Remark"],
                    p_ConfigItem.Login_ID,
                    p_drValue["Department_pk"],
                    p_drValue["PriceTotal"],
                    p_drValue["Take_Out_Date"],
                    p_drValue["User_Pk"]
                };
                int _idMaster = _providerSQL.ExecuteInsert(_sqlConnection, _sqlTransaction, "USP_INS_TAKE_OUT", arrParaName, arrValue);
                arrParaName = new string[] {
                    "@Take_Out_Pk",
                    "@Crt_By",
                    "@Remark",
                    "@Take_Out_Number",
                    "@Price",
                    "@Item_Pk",
                    "@UnitStyle_Pk"
                };
                for (int i = 0; i < p_dtValue.Rows.Count; i++)
                {
                    DataRow l_drValue = p_dtValue.Rows[i];
                    arrValue = new object[] {
                        _idMaster,
                        p_ConfigItem.Login_ID,
                        l_drValue["Remark"],
                        l_drValue["Number_Real"],
                        l_drValue["Price"],
                        l_drValue["Item_Pk"],
                        l_drValue["UnitStyle_Pk"]
                    };
                    _providerSQL.ExecuteNonQuery(_sqlConnection, _sqlTransaction, "USP_INS_TAKE_OUT_DETAIL", arrParaName, arrValue);
                }
                _sqlTransaction.Commit();
                l_rs = true;
            }
            catch (Exception ex)
            {
                _sqlTransaction.Rollback();
                throw ex;
            }
            finally
            {
                _providerSQL.Disconnect(_sqlConnection);
            }
            return(l_rs);
        }