private SqlParameter[] GetParameters(U_USR_WList tobjU_USR_WList) { SqlParameter[] objParamArray = SqlHelperParameterCache.GetCachedParameterSet(General.SQL_CONN_STRING, SQL_INSERT_U_USR_WList); 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_WList_Id, tobjU_USR_WList.WList_Id), new SqlParameter(PARAM_Event_Id, tobjU_USR_WList.Event_Id), new SqlParameter(PARAM_Event_Creator_Id, tobjU_USR_WList.Event_Creator_Id), new SqlParameter(PARAM_WList_Name, tobjU_USR_WList.WList_Name), new SqlParameter(PARAM_WList_Status, tobjU_USR_WList.WList_Status), new SqlParameter(PARAM_Media_Id_Img, tobjU_USR_WList.Media_Id_Img), new SqlParameter(PARAM_Comments, tobjU_USR_WList.Comments), new SqlParameter(PARAM_Created_Date, tobjU_USR_WList.Created_Date), new SqlParameter(PARAM_Updated_Date, tobjU_USR_WList.Updated_Date), new SqlParameter(PARAM_Created_by, tobjU_USR_WList.Created_by), new SqlParameter(PARAM_Updated_by, tobjU_USR_WList.Updated_by), }; SqlHelperParameterCache.CacheParameterSet(General.SQL_CONN_STRING, SQL_INSERT_U_USR_WList, objParamArray); } return(objParamArray); }
public string CreateWishlist(WishList obj) { U_USR_WListDAL owishlistDAL = new U_USR_WListDAL(); U_USR_WList owishlist = new U_USR_WList(); owishlist.WList_Id = Guid.NewGuid().ToString(); owishlist.WList_Name = obj.WList_Name; owishlist.WList_Status = "1"; owishlist.Media_Id_Img = "1"; owishlist.Event_Id = obj.Id; owishlist.Event_Creator_Id = ""; owishlist.Comments = ""; owishlist.Created_by = ""; owishlist.Created_Date = DateTime.Now; owishlist.Updated_by = ""; owishlist.Updated_Date = DateTime.Now; var status = owishlistDAL.InsertU_USR_WList(owishlist); if (status == true) { return("1"); } else { return("0"); } }
private void SetParameters(SqlParameter[] U_USR_WListParms, U_USR_WList tobjU_USR_WList) { U_USR_WListParms[0].Value = tobjU_USR_WList.WList_Id; U_USR_WListParms[1].Value = tobjU_USR_WList.Event_Id; U_USR_WListParms[2].Value = tobjU_USR_WList.Event_Creator_Id; U_USR_WListParms[3].Value = tobjU_USR_WList.WList_Name; U_USR_WListParms[4].Value = tobjU_USR_WList.WList_Status; U_USR_WListParms[5].Value = tobjU_USR_WList.Media_Id_Img; U_USR_WListParms[6].Value = tobjU_USR_WList.Comments; U_USR_WListParms[7].Value = tobjU_USR_WList.Created_Date; U_USR_WListParms[8].Value = tobjU_USR_WList.Updated_Date; U_USR_WListParms[9].Value = tobjU_USR_WList.Created_by; U_USR_WListParms[10].Value = tobjU_USR_WList.Updated_by; }
public bool InsertU_USR_WList(U_USR_WList tobjU_USR_WList) { if (tobjU_USR_WList != null) { //Get the parameter list needed by the given object SqlParameter[] lParamArray = GetParameters(tobjU_USR_WList); SetParameters(lParamArray, tobjU_USR_WList); //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_USR_WList, 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); } }