Example #1
0
        private void GrabValuesFromUserControl(UserControl uc, ref AgreementModLog m)
        {
            #region User Controls
            //Grab the controls from the user controls
            var rcbMod = (uc.FindControl("rcbMod") as RadComboBox);
            var rdtpAgreementLogTime   = (uc.FindControl("rdtpAgreementLogTime") as RadDateTimePicker);
            var rcbActionAgreementLog  = (uc.FindControl("rcbActionAgreementLog") as RadComboBox);
            var rtbRemarksAgreementLog = (uc.FindControl("rtbRemarksAgreementLog") as RadTextBox);

            #endregion

            #region Assign Values
            m.AgreementModID = Convert.ToInt32(rcbMod.SelectedValue);
            if (rdtpAgreementLogTime.SelectedDate != null)
            {
                m.LoggedDate = Convert.ToDateTime(rdtpAgreementLogTime.SelectedDate);
            }
            else
            {
                m.LoggedDate = DateTime.Now;
            }
            m.AgreementLogTypeID = Convert.ToInt32(rcbActionAgreementLog.SelectedValue);
            m.ModifiedBy         = user.ID;
            m.ModifiedDate       = DateTime.Now;
            m.Remarks            = rtbRemarksAgreementLog.Text;
            if (String.IsNullOrEmpty(m.CreatedBy))
            {
                m.CreatedBy   = user.ID;
                m.CreatedDate = DateTime.Now;
            }
            #endregion
        }
Example #2
0
        protected void rgAgreementLog_InsertCommand(object sender, GridCommandEventArgs e)
        {
            //Cast the GridCommandEventArgs item as an editable item
            GridEditableItem editedItem = e.Item as GridEditableItem;
            //Find the user control used by that item save it as a UserControl
            UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
            var         modLog      = new AgreementModLog();

            GrabValuesFromUserControl(userControl, ref modLog);
            siftaDB.AgreementModLogs.InsertOnSubmit(modLog);
            siftaDB.SubmitChanges();
        }
 protected void rbSubmitAgreementLog_Click(object sender, EventArgs e)
 {
     try
     {
         if (rdtpAgreementLogTime.SelectedDate == null)
         {
             throw new ArgumentException("A Date Was Not Selected.");
         }
         var log = new AgreementModLog()
         {
             CreatedBy    = user.ID,
             ModifiedBy   = user.ID,
             CreatedDate  = DateTime.Now,
             ModifiedDate = DateTime.Now
         };
         log.LoggedDate = Convert.ToDateTime(rdtpAgreementLogTime.SelectedDate);
         log.Remarks    = rtbRemarksAgreementLog.Text;
         if (rcbActionAgreementLog.SelectedIndex != 0)
         {
             log.AgreementLogTypeID = Convert.ToInt32(rcbActionAgreementLog.SelectedValue);
         }
         else
         {
             throw new ArgumentException("An Action Was Not Selected.");
         }
         mod.AgreementModLogs.Add(log);
         siftaDB.SubmitChanges();
         pnlAgreementLog.Visible = false;
         pnlComplete.Visible     = true;
     }
     catch (Exception ex)
     {
         ltlError.Text           = ex.Message;
         pnlAgreementLog.Visible = false;
         pnlError.Visible        = true;
     }
 }
Example #4
0
        /// <summary>
        /// Takes a user control and maps the values from it to an Agreement and Mod object.
        /// The user control being used is the Agreement.ascx.
        /// Found at Controls/Agreement.ascx
        /// </summary>
        /// <param name="uc">The User Control for editing agreement information</param>
        /// <param name="a">The Agreement Object</param>
        /// <param name="m">The Agreement Mod Object</param>
        private void GrabValuesFromUserControl(UserControl uc, ref Agreement a, ref AgreementMod m)
        {
            #region User Controls
            //Grab the controls from the user controls
            var rtbPurchaseOrderNumber = (uc.FindControl("rtbPurchaseOrderNumber") as RadTextBox);
            var rtbSalesDocument       = (uc.FindControl("rtbSalesDocument") as RadTextBox);
            var rdpStartDate           = (uc.FindControl("rdpStartDate") as RadDatePicker);
            var rdpEndDate             = (uc.FindControl("rdpEndDate") as RadDatePicker);
            var rdpCustomerSigned      = (uc.FindControl("rdpCustomerSigned") as RadDatePicker);
            var rdpUSGSSigned          = (uc.FindControl("rdpUSGSSigned") as RadDatePicker);
            var rcbFundsType           = (uc.FindControl("rcbFundsType") as RadComboBox);

            var rcbAType = (uc.FindControl("rcbAType") as RadComboBox);

            var rcbBillingCycle       = (uc.FindControl("rcbBillingCycle") as RadComboBox);
            var rntbCustomerFunding   = (uc.FindControl("rntbCustomerFunding") as RadNumericTextBox);
            var rntbOtherFunding      = (uc.FindControl("rntbOtherFunding") as RadNumericTextBox);
            var rntbUSGSFunding       = (uc.FindControl("rntbUSGSFunding") as RadNumericTextBox);
            var rtbOtherFundingReason = (uc.FindControl("rtbOtherFundingReason") as RadTextBox);
            //Removed 11/4/2014 for to remove tags var racbTags = (uc.FindControl("racbTags") as RadAutoCompleteBox);
            #endregion

            #region Assign Values
            //Agreement Info
            a.BillingCycleFrequency = rcbBillingCycle.SelectedValue;
            a.FundsType             = rcbFundsType.SelectedValue;
            a.SalesDocument         = rtbSalesDocument.Text;
            a.PurchaseOrderNumber   = rtbPurchaseOrderNumber.Text;
            a.Customer2Group        = rcbAType.SelectedValue;
            //Mod Info
            a.StartDate = m.StartDate = rdpStartDate.SelectedDate;
            a.EndDate   = m.EndDate = rdpEndDate.SelectedDate;
            //Check to see if the usgs sign date has changed and it isn't null
            if (m.SignUSGSDate != rdpUSGSSigned.SelectedDate && rdpUSGSSigned.SelectedDate != null)
            {
                //Create USGS Signed Log
                var log = new AgreementModLog()
                {
                    AgreementLogTypeID = 6,
                    CreatedBy          = user.ID,
                    ModifiedBy         = user.ID,
                    CreatedDate        = DateTime.Now,
                    ModifiedDate       = DateTime.Now,
                    LoggedDate         = Convert.ToDateTime(rdpUSGSSigned.SelectedDate),
                    Remarks            = "Auto generated from changing or adding a USGS Sign date to the agreement or agreement mod."
                };
                m.AgreementModLogs.Add(log);
            }
            m.SignUSGSDate     = rdpUSGSSigned.SelectedDate;
            m.SignCustomerDate = rdpCustomerSigned.SelectedDate;
            m.FundingUSGSCMF   = rntbUSGSFunding.Value;
            m.FundingCustomer  = rntbCustomerFunding.Value;
            m.FundingOther     = rntbOtherFunding.Value;
            a.ModifiedBy       = m.ModifiedBy = user.ID;
            if (m.CreatedDate == null || a.CreatedDate == null)
            {
                //Set all of the created dates to be the current one
                a.CreatedDate = a.ModifiedDate = m.CreatedDate = m.ModifiedDate = DateTime.Now;
            }
            else
            {
                //Set modified fields for tracking purposes
                a.ModifiedDate = m.ModifiedDate = DateTime.Now;
                a.ModifiedBy   = m.ModifiedBy = user.ID;
            }
            #endregion
        }