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); } }
public static bool Update(ConfigItem p_ConfigItem, object[] arrValue) { COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { string[] arrParaName = new string[] { "@Id", "@Name", "@Crt_Dt", "@Crt_By", "@Remark" }; _sql.Connect(p_ConfigItem); _sql.ExecuteNonQuery("USP_UPD_UNIT", arrParaName, arrValue); return(true); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } }
public static bool Update(ConfigItem p_configItem, DataRow p_dtRow) { COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_configItem); try { object[] arrValue = new object[] { p_dtRow["Id"], p_dtRow["Unit_In_Pk"], p_dtRow["Unit_Out_Pk"], p_dtRow["Remark"], p_dtRow["Num"] }; string[] arrParaName = new string[] { "@Id", "@Unit_In_Pk", "@Unit_Out_Pk", "@Remark", "@Num" }; _sql.Connect(p_configItem); _sql.ExecuteNonQuery("USP_UPD_UNIT_STYLE", arrParaName, arrValue); return(true); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } }
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(); } }
public static bool Update(ConfigItem p_ConfigItem, object[] arrValue) { COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { string[] arrParaName = new string[] { "@Id", "@Name_Dis", "@Name", "@Password", "@Mod_By", "@Remark", "@Phone", "@Address", "@Department_Pk" }; _sql.Connect(p_ConfigItem); _sql.ExecuteNonQuery("USP_UPD_USER", arrNames: arrParaName, arrValues: arrValue); return(true); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } }
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); }
public static bool Update(ConfigItem p_ConfigItem, object[] parramValue) { COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { string[] arrParaName = new string[] { "@Id", "@Name", "@Phone", "@Address", "@Fax", "@Email", "@Website", "@Mod_By", "@TaxCode", "@Credit", "@Debit" }; _sql.Connect(p_ConfigItem); _sql.ExecuteNonQuery("USP_UPD_SUPPLIER", arrNames: arrParaName, arrValues: parramValue); return(true); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } }
public static bool Update(ConfigItem p_ConfigItem, Supplier p_Supplier) { COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { string[] arrParaName = new string[] { "@Id", "@Name", "@Phone", "@Phone1", "@Address", "@Address1", "@Fax", "@Email", "@Website", "@Mod_By", "@TaxCode", "@Credit", "@Debit" }; object[] arrParaValue = new object[] { p_Supplier.Id, 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); _sql.ExecuteNonQuery("USP_UPD_SUPPLIER", arrNames: arrParaName, arrValues: arrParaValue); return(true); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } }
public static DataTable GetList(ConfigItem p_ConfigItem) { COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { _sql.Connect(p_ConfigItem); return(_sql.GetDataByStoredProcedure("USP_SEL_GROUP_All")); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } }
public static DataTable GetList_1(ConfigItem p_configItem) { COREBASE.COMMAND.SQL.AccessSQL l_sql = new COREBASE.COMMAND.SQL.AccessSQL(p_configItem); try { l_sql.Connect(); return(l_sql.GetDataByStoredProcedure("USP_SEL_UNIT_STYLE_1")); } catch (Exception ex) { throw ex; } finally { l_sql.Disconnect(); } }
public static DataTable GetList(ConfigItem p_ConfigItem, int p_Catalog_Pk) { COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { string[] arrParaName = new string[] { "@Id" }; object[] arrValue = new object[] { p_Catalog_Pk }; _sql.Connect(p_ConfigItem); return(_sql.GetDataByStoredProcedure("USP_SEL_CATALOG_BY_ID", arrParaName, arrValue)); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } }
public static int Update(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[] { "@Id", "@Name", "@Mod_By", "@Remark", "@ID_Cat" }; object[] l_arrValue = new object[] { p_drGroup["Id"], p_drGroup["Name"], p_configItem.Login_UserName, p_drGroup["Remark"], p_drGroup["Id_Cat"] }; l_sql.Connect(p_configItem); return(l_sql.ExecuteNonQuery("USP_UPD_GROUP", l_arrName, l_arrValue)); } catch (Exception ex) { throw ex; } finally { l_sql.Disconnect(); } }
public static int Delete(ConfigItem p_configItem, int p_Group_Pk) { COREBASE.COMMAND.SQL.AccessSQL l_sql = new COREBASE.COMMAND.SQL.AccessSQL(p_configItem); try { string[] l_arrName = new string[] { "@Id" }; object[] l_arrValue = new object[] { p_Group_Pk }; l_sql.Connect(p_configItem); return(l_sql.ExecuteNonQuery("USP_DEL_GROUP", l_arrName, l_arrValue)); } catch (Exception ex) { throw ex; } finally { l_sql.Disconnect(); } }
public static DataTable GetList_1(ConfigItem p_configItem, int p_Unit_Out_Pk) { COREBASE.COMMAND.SQL.AccessSQL l_sql = new COREBASE.COMMAND.SQL.AccessSQL(p_configItem); try { l_sql.Connect(); string[] l_arrName = new string[] { "@Unit_Out_Pk" }; object[] l_arrValue = new object[] { p_Unit_Out_Pk }; return(l_sql.GetDataByStoredProcedure("USP_SEL_UNIT_STYLE_1", l_arrName, l_arrValue)); } catch (Exception ex) { throw ex; } finally { l_sql.Disconnect(); } }
public static DataTable GetList(ConfigItem p_configItem, int p_GroupID) { COREBASE.COMMAND.SQL.AccessSQL l_sql = new COREBASE.COMMAND.SQL.AccessSQL(p_configItem); try { l_sql.Connect(); string[] l_arrName = new string[] { "@Group_Pk" }; object[] l_arrValue = new object[] { p_GroupID }; return(l_sql.GetDataByStoredProcedure("USP_SEL_ITEM_BY_GROUP_ID", l_arrName, l_arrValue)); } catch (Exception ex) { throw ex; } finally { l_sql.Disconnect(); } }
public static DataSet GetListTakeOut(int p_Take_Out_Pk, ConfigItem p_ConfigItem) { COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { _sql.Connect(p_ConfigItem); string[] arrParaName = new string[] { "@Take_Out_Pk" }; object[] arrParaValue = new object[] { p_Take_Out_Pk }; return(_sql.GetDataByStoredProcedure_DS("USP_RPT_TAKE_OUT", arrParaName, arrParaValue)); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } }
public static DataTable GetListTable(ConfigItem p_ConfigItem) { DataTable dt; COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { _sql.Connect(p_ConfigItem); dt = _sql.GetDataByStoredProcedure("USP_SEL_SUPPLIER"); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } return(dt); }
public static bool Delete(ConfigItem p_ConfigItem, int _idSuppiler) { COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { string[] arrParaName = new string[] { "@Id" }; object[] arrParaValue = new object[] { _idSuppiler }; _sql.Connect(p_ConfigItem); _sql.ExecuteNonQuery("USP_DEL_SUPPLIER", arrParaName, arrParaValue); return(true); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } }
public static IList <Supplier> GetList(ConfigItem p_ConfigItem) { IList <Supplier> lUser = null; COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { _sql.Connect(p_ConfigItem); DataTable dt = _sql.GetDataByStoredProcedure("USP_SEL_SUPPLIER"); lUser = COREBASE.COMMAND.SQL.CMapping.MapList <Supplier>(dt); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } return(lUser); }
public DataSet GetData(int type) { DataSet ds = null; string store = "USP_RPT_NHAPKHO"; if (type == 1) { store = "USP_RPT_XUATKHO"; } else if (type == 0) { store = "USP_RPT_NHAPKHO"; } else if (type == 2) { store = "USP_RPT_PB_HH"; } else { store = "USP_RPT_XUAT_PB"; } COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(_ConfigItem); try { string[] arrParaName = new string[] { "@Item_Id", "@From", "@To" }; object[] arrValue = new object[] { 79, dateFrom.EditValue, dateTo.EditValue }; _sql.Connect(_ConfigItem); ds = _sql.GetDataByStoredProcedure_DS(store, arrParaName, arrValue); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } return(ds); }
public static DataTable GetListRoleByUID(ConfigItem p_ConfigItem, object[] arrValue) { DataTable dt = null; COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { string[] arrParaName = new string[] { "@UserId" }; _sql.Connect(p_ConfigItem); dt = _sql.GetDataByStoredProcedure("USP_SEL_USER_ROLE_ByUser", arrParaName, arrValue); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } return(dt); }
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(); } }
public static void Restore(ConfigItem p_ConfigItem, string file) { COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); try { string[] arrParaName = new string[] { "@Path" }; string[] arrParaValue = new string[] { file }; _sql.Connect(p_ConfigItem); _sql.ExecuteNonQuery("[USP_SYS_Restore]", arrParaName, arrParaValue); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } }
public DataSet GetDataDetail() { DataSet ds = null; string store = "USP_RptTonKhoDetail"; COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(_ConfigItem); try { string[] arrParaName = new string[] { "@fromMonth", "@toMonth" }; object[] arrValue = new object[] { dateFrom.EditValue, dateTo.EditValue }; _sql.Connect(_ConfigItem); ds = _sql.GetDataByStoredProcedure_DS(store, arrParaName, arrValue); } catch (Exception ex) { throw ex; } finally { _sql.Disconnect(); } return(ds); }
public static bool DeleteDetail(ConfigItem p_ConfigItem, DataRow p_drValue) { bool l_rs = false; COREBASE.COMMAND.SQL.AccessSQL _sql = new COREBASE.COMMAND.SQL.AccessSQL(p_ConfigItem); string[] arrParaName = new string[] { "@Id", "@Crt_By" }; object[] arrParaValue = new object[] { p_drValue["Id"], p_ConfigItem.Login_ID }; try { _sql.Connect(p_ConfigItem); _sql.ExecuteNonQuery("USP_DEL_TAKE_OUT_DETAIL", arrParaName, arrParaValue); l_rs = true; } catch (Exception ex) { l_rs = false; throw ex; } finally { _sql.Disconnect(); } return(l_rs); }
public static bool Update(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[] { "@Id", "@Number_Item", "@Remark", "@Crt_By", "@Department_pk", "@PriceTotal", "@Take_Out_Date", "@User_Pk" }; object[] arrValue = new object[] { p_drValue["Id"], 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.ExecuteNonQuery(_sqlConnection, _sqlTransaction, "USP_UPD_TAKE_OUT", arrParaName, arrValue); arrParaName = new string[] { "@Id", "@Take_Out_Pk", "@Number_Item", "@Remark", "@Crt_By", "@Price", "@Item_Pk", "@UnitStyle_Pk" }; for (int i = 0; i < p_dtValue.Rows.Count; i++) { DataRow l_drValue = p_dtValue.Rows[i]; if (p_dtValue.Rows[i].RowState == DataRowState.Added) { arrValue = new object[] { l_drValue["Take_Out_Pk"], 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); } if (p_dtValue.Rows[i].RowState == DataRowState.Modified) { arrValue = new object[] { l_drValue["Id"], l_drValue["Take_Out_Pk"], l_drValue["Number_Real"], l_drValue["Remark"], p_ConfigItem.Login_ID, l_drValue["Price"], l_drValue["Item_Pk"], l_drValue["UnitStyle_Pk"] }; _providerSQL.ExecuteNonQuery(_sqlConnection, _sqlTransaction, "USP_UPD_TAKE_OUT_DETAIL", arrParaName, arrValue); } } _sqlTransaction.Commit(); l_rs = true; } catch (Exception ex) { l_rs = false; _sqlTransaction.Rollback(); throw ex; } finally { _providerSQL.Disconnect(_sqlConnection); } return(l_rs); }