public static Object SUBMITSUBSCRIPTION(NameValueCollection Parameters)
        {
            try
            {
                //notes:    only POST method processing
                if (Parameters["PageFormMethod"] == "POST")
                {
                    //notes:    FORM PARAMETERS
                    //          SubscriptionID:   int, required
                    //          EmployeeID:       int, required
                    //          Address:          string, not required
                    //          City:             string, not required
                    //          State:            string, not required
                    //          Zip:              int, not required
                    //          AccountNumber:    int, not required
                    //          BillingNumber:    string, not required
                    //          StartDate:        datetime, not required
                    //          EndDate:          datetime, not required
                    //          Paid:             string, not required
                    //          HomeAddress:      bool, not required
                    //          Notes:            string, not required

                    //notes:    verify that correct parameters were passed in
                    SubscriptionItem objItem = new SubscriptionItem();

                    objItem.SubscriptionID = Convert.ToInt32(Parameters["txtSubscriptionID"]);
                    objItem.EmployeeID = Convert.ToInt32(Parameters["txtPerson"]);
                    objItem.VendorID = Convert.ToInt32(Parameters["ddlVendor"]);
                    objItem.Address = Parameters["txtAddress"];
                    objItem.City = Parameters["txtCity"];
                    objItem.State = Parameters["txtState"];
                    objItem.Zip = Convert.ToInt32(Parameters["txtZip"]);
                    objItem.AccountNumber = Convert.ToInt32(Parameters["txtAccountNumber"]);
                    objItem.BillingNumber = Parameters["txtBillingNumber"];
                    objItem.StartDate = Convert.ToDateTime(Parameters["txtStartDate"]);
                    objItem.EndDate = Convert.ToDateTime(Parameters["txtEndDate"]);
                    objItem.Paid = Parameters["txtPaid"];
                    objItem.HomeAddress = Convert.ToBoolean(Convert.ToInt32(Parameters["rblAddress"]));
                    objItem.Notes = Parameters["txtNotes"];

                    ResponseStatus objStatus = new ResponseStatus();

                    new FlowManager.SubscriptionItemFlow().Update(objItem, out objStatus);

                    //if (objStatus.ResponseStatusResult == ResponseStatusResult.Fail)
                    //    return objStatus;
                    //else
                        return objStatus;
                }
                else
                    return new ResponseStatus("Submit Subscription failed.", "Only POST method allowed.", ResponseStatusResult.Fail);
            }
            catch (Exception ex)
            {
                return new ResponseStatus("Submit Subscription failed.", ex.Message, ResponseStatusResult.Fail);
            }
        }
示例#2
0
 //notes:    insert, update, delete
 public void Update(SubscriptionItem ObjectSubscriptionItem, out ResponseStatus StatusResult)
 {
     if (ObjectSubscriptionItem.SubscriptionID > 0)
         base.UpdateItem(ObjectSubscriptionItem, out StatusResult);
     else
     {
         //notes:    TODO: insert
         base.UpdateItem(ObjectSubscriptionItem, out StatusResult);
     }
 }
        protected void UpdateItem(SubscriptionItem SubscriptionItemObject, out ResponseStatus StatusResult)
        {
            string strStoredProcName = "jsp_Subscription_ExecuteResult";

            //notes:    ListValue options
            //          20 = UPDATE_ITEM
            try
            {
                //notes:    set the parameters to use for this query
                ParameterCollection objParamCollection = this.GetBaseParams(SubscriptionItemObject);
                objParamCollection.Add((20).GetParameterListValue());
                objParamCollection.Add(SubscriptionItemObject.SubscriptionID.GetParameterInt("@SubscriptionID"));

                //notes:    call data tier to update
                DataHelper.ExecuteDB(objParamCollection, strStoredProcName, base.GetConnectionString());

                //notes:    set out parameter
                StatusResult = new ResponseStatus("Update successful.", "ID = " + SubscriptionItemObject.SubscriptionID.ToString(), ResponseStatusResult.Success);
            }
            catch (Exception ex)
            {
                StatusResult = new ResponseStatus("Update failed.", ex.Message, ex.StackTrace, ResponseStatusResult.Fail);
            }
        }