public string InviteMembers(InviteContacts obj)
 {
     try
     {
         U_EVNT_WList_Pub_DAL oinvDAL = new U_EVNT_WList_Pub_DAL();
         U_EVNT_WList_Pub_Dtl oinv    = new U_EVNT_WList_Pub_Dtl();
         foreach (var item in obj.InvitedMembers)
         {
             if (string.IsNullOrEmpty(oinvDAL.Get_Evnt_Inv(obj.Event_Id, obj.wishlist_Id, item.EmailID)))
             {
                 oinv.Id               = Guid.NewGuid().ToString();
                 oinv.Contact_Id       = null;
                 oinv.Pub_Date         = DateTime.Now;
                 oinv.Pub_MediaType    = "";
                 oinv.Pub_Status       = "0";
                 oinv.Phone_No         = item.ContactNo;
                 oinv.Email_Id         = item.EmailID;
                 oinv.WList_CodeForPub = item.INV_Code;
                 oinv.WList_Id         = obj.wishlist_Id;
                 oinv.Event_Id         = obj.Event_Id;
                 oinv.Created_Date     = DateTime.Now;
                 oinv.Created_by       = item.UserId;
                 oinv.Updated_by       = "";
                 oinv.Updated_Date     = DateTime.Now;
                 oinvDAL.InsertU_EVNT_WList_Pub_Dtl(oinv);
             }
         }
         return("1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
         return("");
     }
 }
 private SqlParameter[] GetParameters(U_EVNT_WList_Pub_Dtl tobjU_EVNT_WList_Pub_Dtl)
 {
     SqlParameter[] objParamArray = SqlHelperParameterCache.GetCachedParameterSet(General.SQL_CONN_STRING, SQL_INSERT_U_EVNT_WList_Pub_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_Pub_Dtl.Id),
             new SqlParameter(PARAM_Event_Id, tobjU_EVNT_WList_Pub_Dtl.Event_Id),
             new SqlParameter(PARAM_WList_Id, tobjU_EVNT_WList_Pub_Dtl.WList_Id),
             new SqlParameter(PARAM_Pub_Date, tobjU_EVNT_WList_Pub_Dtl.Pub_Date),
             new SqlParameter(PARAM_Pub_MediaType, tobjU_EVNT_WList_Pub_Dtl.Pub_MediaType),
             new SqlParameter(PARAM_Pub_Status, tobjU_EVNT_WList_Pub_Dtl.Pub_Status),
             new SqlParameter(PARAM_Contact_Id, tobjU_EVNT_WList_Pub_Dtl.Contact_Id),
             new SqlParameter(PARAM_Email_Id, tobjU_EVNT_WList_Pub_Dtl.Email_Id),
             new SqlParameter(PARAM_Phone_No, tobjU_EVNT_WList_Pub_Dtl.Phone_No),
             new SqlParameter(PARAM_WList_CodeForPub, tobjU_EVNT_WList_Pub_Dtl.WList_CodeForPub),
             new SqlParameter(PARAM_Created_Date, tobjU_EVNT_WList_Pub_Dtl.Created_Date),
             new SqlParameter(PARAM_Updated_Date, tobjU_EVNT_WList_Pub_Dtl.Updated_Date),
             new SqlParameter(PARAM_Created_by, tobjU_EVNT_WList_Pub_Dtl.Created_by),
             new SqlParameter(PARAM_Updated_by, tobjU_EVNT_WList_Pub_Dtl.Updated_by),
         };
         SqlHelperParameterCache.CacheParameterSet(General.SQL_CONN_STRING, SQL_INSERT_U_EVNT_WList_Pub_Dtl, objParamArray);
     }
     return(objParamArray);
 }
 private void SetParameters(SqlParameter[] U_EVNT_WList_Pub_DtlParms, U_EVNT_WList_Pub_Dtl tobjU_EVNT_WList_Pub_Dtl)
 {
     U_EVNT_WList_Pub_DtlParms[0].Value  = tobjU_EVNT_WList_Pub_Dtl.Id;
     U_EVNT_WList_Pub_DtlParms[1].Value  = tobjU_EVNT_WList_Pub_Dtl.Event_Id;
     U_EVNT_WList_Pub_DtlParms[2].Value  = tobjU_EVNT_WList_Pub_Dtl.WList_Id;
     U_EVNT_WList_Pub_DtlParms[3].Value  = tobjU_EVNT_WList_Pub_Dtl.Pub_Date;
     U_EVNT_WList_Pub_DtlParms[4].Value  = tobjU_EVNT_WList_Pub_Dtl.Pub_MediaType;
     U_EVNT_WList_Pub_DtlParms[5].Value  = tobjU_EVNT_WList_Pub_Dtl.Pub_Status;
     U_EVNT_WList_Pub_DtlParms[6].Value  = tobjU_EVNT_WList_Pub_Dtl.Contact_Id;
     U_EVNT_WList_Pub_DtlParms[7].Value  = tobjU_EVNT_WList_Pub_Dtl.Email_Id;
     U_EVNT_WList_Pub_DtlParms[8].Value  = tobjU_EVNT_WList_Pub_Dtl.Phone_No;
     U_EVNT_WList_Pub_DtlParms[9].Value  = tobjU_EVNT_WList_Pub_Dtl.WList_CodeForPub;
     U_EVNT_WList_Pub_DtlParms[10].Value = tobjU_EVNT_WList_Pub_Dtl.Created_Date;
     U_EVNT_WList_Pub_DtlParms[11].Value = tobjU_EVNT_WList_Pub_Dtl.Updated_Date;
     U_EVNT_WList_Pub_DtlParms[12].Value = tobjU_EVNT_WList_Pub_Dtl.Created_by;
     U_EVNT_WList_Pub_DtlParms[13].Value = tobjU_EVNT_WList_Pub_Dtl.Updated_by;
 }
 public bool InsertU_EVNT_WList_Pub_Dtl(U_EVNT_WList_Pub_Dtl tobjU_EVNT_WList_Pub_Dtl)
 {
     if (tobjU_EVNT_WList_Pub_Dtl != null)
     {
         //Get the parameter list needed by the given object
         SqlParameter[] lParamArray = GetParameters(tobjU_EVNT_WList_Pub_Dtl);
         SetParameters(lParamArray, tobjU_EVNT_WList_Pub_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_Pub_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);
     }
 }