private void SetParameters(SqlParameter[] U_EVNT_WList_DtlParms, U_EVNT_WList_Dtl tobjU_EVNT_WList_Dtl) { U_EVNT_WList_DtlParms[0].Value = tobjU_EVNT_WList_Dtl.Id; U_EVNT_WList_DtlParms[1].Value = tobjU_EVNT_WList_Dtl.Event_Id; U_EVNT_WList_DtlParms[2].Value = tobjU_EVNT_WList_Dtl.WList_Id; U_EVNT_WList_DtlParms[3].Value = tobjU_EVNT_WList_Dtl.Item_Id; U_EVNT_WList_DtlParms[4].Value = tobjU_EVNT_WList_Dtl.Item_Cost_Entered_ByUser; U_EVNT_WList_DtlParms[5].Value = tobjU_EVNT_WList_Dtl.Created_Date; U_EVNT_WList_DtlParms[6].Value = tobjU_EVNT_WList_Dtl.Updated_Date; U_EVNT_WList_DtlParms[7].Value = tobjU_EVNT_WList_Dtl.Created_by; U_EVNT_WList_DtlParms[8].Value = tobjU_EVNT_WList_Dtl.Updated_by; }
public bool InsertU_EVNT_WList_Dtl(U_EVNT_WList_Dtl tobjU_EVNT_WList_Dtl) { if (tobjU_EVNT_WList_Dtl != null) { //Get the parameter list needed by the given object SqlParameter[] lParamArray = GetParameters(tobjU_EVNT_WList_Dtl); SetParameters(lParamArray, tobjU_EVNT_WList_Dtl); //Get the connection SqlConnection con = General.GetConnection(); if (con == null) { //Connection is not created return(false); } //Execute the insertion int i = SqlHelper.ExecuteNonQuery( con, CommandType.Text, SQL_INSERT_U_EVNT_WList_Dtl, lParamArray); //Dispose the Sql connection con.Dispose(); if (i == 1) { //Done and insert the object to the table return(true); } else { //Fail to execute the insertion return(false); } } else { //No object found to insert return(false); } }
private SqlParameter[] GetParameters(U_EVNT_WList_Dtl tobjU_EVNT_WList_Dtl) { SqlParameter[] objParamArray = SqlHelperParameterCache.GetCachedParameterSet(General.SQL_CONN_STRING, SQL_INSERT_U_EVNT_WList_Dtl); if (objParamArray == null) { //Represents a parameter to a System.Data.SqlClient.SqlCommand, //and optionally, its mapping to System.Data.DataSet columns. objParamArray = new SqlParameter[] { new SqlParameter(PARAM_Id, tobjU_EVNT_WList_Dtl.Id), new SqlParameter(PARAM_Event_Id, tobjU_EVNT_WList_Dtl.Event_Id), new SqlParameter(PARAM_WList_Id, tobjU_EVNT_WList_Dtl.WList_Id), new SqlParameter(PARAM_Item_Id, tobjU_EVNT_WList_Dtl.Item_Id), new SqlParameter(PARAM_Item_Cost_Entered_ByUser, tobjU_EVNT_WList_Dtl.Item_Cost_Entered_ByUser), new SqlParameter(PARAM_Created_Date, tobjU_EVNT_WList_Dtl.Created_Date), new SqlParameter(PARAM_Updated_Date, tobjU_EVNT_WList_Dtl.Updated_Date), new SqlParameter(PARAM_Created_by, tobjU_EVNT_WList_Dtl.Created_by), new SqlParameter(PARAM_Updated_by, tobjU_EVNT_WList_Dtl.Updated_by), }; SqlHelperParameterCache.CacheParameterSet(General.SQL_CONN_STRING, SQL_INSERT_U_EVNT_WList_Dtl, objParamArray); } return(objParamArray); }
public string AddItemsToWishlist(ItemsList[] obj) { U_EVNT_WList_DtlDAL oeventDAL = new U_EVNT_WList_DtlDAL(); U_EVNT_WList_Dtl oevent = new U_EVNT_WList_Dtl(); foreach (var items in obj) { if (string.IsNullOrEmpty(oeventDAL.IsItemExist(items.WList_Id, items.Item_Id))) { oevent.Id = Guid.NewGuid().ToString(); oevent.Event_Id = items.Event_Id; oevent.Item_Id = items.Item_Id; oevent.WList_Id = items.WList_Id; oevent.Item_Cost_Entered_ByUser = items.Item_Tentative_Cost; oevent.Created_by = ""; oevent.Created_Date = DateTime.Now; oevent.Updated_by = ""; oevent.Updated_Date = DateTime.Now; oeventDAL.InsertU_EVNT_WList_Dtl(oevent); } } return("1"); }