Exemple #1
0
 public static Subscription GetCompSubscription(Member member)
 {
     Subscription compsubscription = new Subscription();
     compsubscription.Category = SubscriptionCategory.Publication;
     compsubscription.SubscribingMember = member.MemberId;
     compsubscription.StatusFlag = "p";
     string sql = "svcs_GetCompMember";
     using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     using (SqlCommand comm = new SqlCommand(sql, conn))
     {
         conn.Open();
         comm.CommandType = System.Data.CommandType.StoredProcedure;
         comm.Parameters.Add(new SqlParameter("@cusid", member.CusId));
         SqlDataReader reader = comm.ExecuteReader();
         if (reader.HasRows)
         {
             while (reader.Read())
             {
                 compsubscription.PublicationCode = Utilities.GetStringFromDB(reader["mtycode"]);
                 compsubscription.DateEntered = Utilities.GetStringFromDB(reader["nmbdatestart"]);
                 compsubscription.ExpireDate = Utilities.GetStringFromDB(reader["nmbdateend"]);
             }
         }
         reader.Close();
     }            
     return compsubscription;
 }
        private static List<Subscription> GetSubscriptions(orderhistorytype[] orders)
        {
            EventLogger.LogEvent("ENTERING -> SFGWrapper.GateKeeperTranslators.GetSubscription()");
            List<Subscription> subs = new List<Subscription>();
            try
            {
                foreach (orderhistorytype order in orders)
                {
                    Subscription sub = new Subscription();
                    sub.Category = SubscriptionCategory.Publication;
                    if (order.CATEGORY == "Catalog")
                        sub.Category = SubscriptionCategory.Catalog;
                    sub.PublicationCode = order.PROD_CODE;
                    sub.Description = order.DESCRIPTION;
                    sub.Qty = Convert.ToInt32(order.QTY);
                    sub.DateEntered = order.DATE;
                    sub.ExpireDate = order.EXPIRE_DATE;
                    sub.IssuesRemaining = Convert.ToInt32(order.ISS_REM);
                    sub.RenewalKeycode = order.RENEWAL_KEYCODE;
                    sub.EPub = (order.EPUB == "Y");
                    sub.SubscribingMember = order.H_CUST;
                    sub.GiftRecipient = order.G_CUST;
                    sub.StatusFlag = order.STATUS_FLAG.Length > 0 ? order.STATUS_FLAG : "Y";
                    sub.IsGift = (order.IS_GIFT == "Y");
                    sub.IsDonor = (order.IS_DONOR == "Y");
                    subs.Add(sub);
                }
            }
            catch { }
            EventLogger.LogEvent("LEAVING -> SFGWrapper.GateKeeperTranslators.GetSubscription()");

            return subs;
        }