private CMS.AMS.Models.SVProgram CreatePointsProgram() { CMS.AMS.Models.SVProgram NewSVPointProgram = null; try { NewSVPointProgram = new CMS.AMS.Models.SVProgram { ProgramName = Logix.TrimAll(functioninput.Text) }; bool saved = CreateSVPointsProgram(NewSVPointProgram); if (saved) { return(NewSVPointProgram); } else { return(null); } } catch (Exception err) { ScriptManager.RegisterStartupScript(UpdatePanelMain, UpdatePanelMain.GetType(), "AlertMessage", " AlertMessage('" + err.Message + "');", true); return(null); } }
private bool CreateSVPointsProgram(CMS.AMS.Models.SVProgram SVPointsProgram) { bool result = false; SQLParametersList lst = new SQLParametersList(); try { if (SVPointsProgram.SVProgramID == 0) { lst.Add("@Name", SqlDbType.NVarChar, 200).Value = SVPointsProgram.ProgramName; lst.Add("@Description", SqlDbType.NVarChar, 200).Value = ""; lst.Add("@ExpirePeriod", SqlDbType.Int).Value = 1; lst.Add("@Value", SqlDbType.NVarChar, 200).Value = "1"; lst.Add("@OneUnitPerRec", SqlDbType.Bit).Value = 0; lst.Add("@SVExpireType", SqlDbType.Int).Value = 1; lst.Add("@SVExpirePeriodType", SqlDbType.Int).Value = 1; lst.Add("@ExpireTOD", SqlDbType.VarChar, 5).Value = ""; lst.Add("@ExpireDate", SqlDbType.DateTime).Value = Convert.ToDateTime("12/31/2025 23:59"); lst.Add("@ExpireCentralServerTZ", SqlDbType.Bit).Value = 0; lst.Add("@SVTypeID", SqlDbType.Int).Value = 1; lst.Add("@UOMLimit", SqlDbType.Int).Value = 1; lst.Add("@AllowReissue", SqlDbType.Int).Value = 0; lst.Add("@ScorecardID", SqlDbType.Int).Value = 0; lst.Add("@ScorecardDesc", SqlDbType.NVarChar, 100).Value = ""; lst.Add("@ScorecardBold", SqlDbType.Bit).Value = 1; lst.Add("@DisallowRedeemInEarnTrans", SqlDbType.Int).Value = 0; lst.Add("@AllowNegativeBal", SqlDbType.Int).Value = 0; lst.Add("@AdjustmentUPC", SqlDbType.NVarChar, 100).Value = ""; lst.Add("@RedemptionRestrictionID", SqlDbType.Int).Value = 0; lst.Add("@MemberRedemptionID", SqlDbType.Int).Value = 0; lst.Add("@SVProgramID", SqlDbType.BigInt).Direction = ParameterDirection.Output; m_dbAccess.ExecuteNonQuery(DataBases.LogixRT, CommandType.StoredProcedure, "pt_StoredValuePrograms_Insert", lst); SVPointsProgram.SVProgramID = lst["@SVProgramID"].Value.ConvertToLong(); result = true; if (MyCommon.LRTadoConn.State == ConnectionState.Closed) { MyCommon.Open_LogixRT(); } MyCommon.Activity_Log(26, SVPointsProgram.SVProgramID, CurrentUser.AdminUser.ID, Copient.PhraseLib.Lookup("history-sv-create", LanguageID)); } } catch (Exception ex) { throw ex; } finally { MyCommon.Close_LogixRT(); } lst = null; return(result); }