Esempio n. 1
0
        public bool ToggleUninvoicedApproval(int approvalId, int uidCmpgn)
        {
            List <System.Data.SqlClient.SqlParameter> spParams = new List <System.Data.SqlClient.SqlParameter>();

            if (approvalId != -1)
            {
                spParams.Add(Param.CreateParam("APPROVALID", SqlDbType.Int, approvalId));
            }
            else
            {
                spParams.Add(Param.CreateParam("UID_CMPGN", SqlDbType.Int, uidCmpgn));
                spParams.Add(Param.CreateParam("APPROVEDBY", SqlDbType.VarChar, Security.GetFullUserNameFromId(Security.GetCurrentUserId)));
            }
            try
            {
                using (IO io = new IO(WebCommon.ConnectionString))
                {
                    io.ExecuteActionQuery(IO.CreateCommandFromStoredProc("QUATTRO_TOGGLEUNINVOICEDAPPROVAL", spParams));
                }
                return(true);
            }
            catch (Exception ex)
            {
                WebCommon.LogExceptionInfo(ex);
                return(false);
            }
        }
Esempio n. 2
0
 public string GetInvoicesByContract(string contractNumber, string companyId)
 {
     try
     {
         StringBuilder invoiceNumberList = new StringBuilder();
         DataSet       invoiceNumbers;
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             invoiceNumbers = io.ExecuteDataSetQuery(IO.CreateCommandFromStoredProc("QUATTRO_GETINVOICENUMBERSBYCONTRACT",
                                                                                    Param.CreateParam("CONTRACTNUMBER", SqlDbType.VarChar, contractNumber),
                                                                                    Param.CreateParam("COMPANYID", SqlDbType.Int, companyId)));
         }
         if (invoiceNumbers.Tables[0].Rows.Count == 0)
         {
             return(string.Empty);
         }
         foreach (DataRow row in invoiceNumbers.Tables[0].Rows)
         {
             if (!String.IsNullOrEmpty(invoiceNumberList.ToString()))
             {
                 invoiceNumberList.Append(",");
             }
             invoiceNumberList.Append(Convert.ToString(row[0]));
         }
         return(invoiceNumberList.ToString());
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception(string.Format("An error occurred while trying to retrieve the Invoice Numbers for Contract: {0}", contractNumber));
     }
 }
Esempio n. 3
0
 public bool AddCreditCheckNote(int id, string contractNumber, string companyId, string creditAppReq, string creditChecked, string notes)
 {
     try
     {
         string enteredBy = Security.GetCurrentUserId;
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             using (System.Data.SqlClient.SqlCommand cmd = IO.CreateCommandFromStoredProc("COLLECTIONS_ADDCREDITCHECKNOTE"))
             {
                 cmd.Parameters.Add(Param.CreateParam("CONTRACTNUMBER", SqlDbType.Int, Convert.ToInt32(contractNumber)));
                 cmd.Parameters.Add(Param.CreateParam("COMPANYID", SqlDbType.Int, Convert.ToInt32(companyId)));
                 cmd.Parameters.Add(Param.CreateParam("CREDITAPPPREPAY", SqlDbType.VarChar, creditAppReq));
                 cmd.Parameters.Add(Param.CreateParam("CREDITCHECKED", SqlDbType.VarChar, creditChecked));
                 cmd.Parameters.Add(Param.CreateParam("NOTES", SqlDbType.NText, notes));
                 cmd.Parameters.Add(Param.CreateParam("ENTEREDBY", SqlDbType.VarChar, enteredBy));
                 io.ExecuteActionQuery(cmd);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         return(false);
     }
 }
 public List <SpotConflict> SaveMultiStationSpot(Spot spot, int numberOfWeeks, List <int> stationIds)
 {
     try
     {
         spot.EnteredBy     = Security.GetCurrentUserId;
         spot.EnteredOn     = DateTime.Now;
         spot.LastUpdatedBy = Security.GetCurrentUserId;
         spot.LastUpdatedOn = DateTime.Now;
         DataTable           stations  = PopulateStationIdTable(stationIds);
         List <SpotConflict> conflicts = Spot.SaveMultiStationSpot(spot, stations);
         int prevMonth = spot.Month;
         for (int i = 1; i < numberOfWeeks; i++)
         {
             spot.SpotDate = spot.SpotDate.AddDays(7);
             spot.Year     = spot.SpotDate.Year;
             spot.Month    = spot.SpotDate.Month;
             spot.Week     = (spot.SpotDate.Month == prevMonth ? spot.Week + 1 : 1);
             prevMonth     = spot.SpotDate.Month;
             foreach (SpotConflict conflict in Spot.SaveMultiStationSpot(spot, stations))
             {
                 conflicts.Add(conflict);
             }
             //conflicts.Add(Spot.SaveMultiStationSpot(spot, stations));
         }
         return(conflicts);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to add the spot.");
     }
 }
Esempio n. 5
0
 public bool SendCCNNotificationEmail(int uidCmpgn, int companyId, string contractNumber, string attachmentUserId, int attachmentId)
 {
     //Make sure a notification email hasn't already been sent.
     if (IsCCNEMailSent(uidCmpgn, attachmentId, true))
     {
         WebCommon.LogExceptionInfo(new Exception(string.Format("A notification email has already been sent for this contract: {0}. Please refresh your grid.", uidCmpgn)));
         return(false);
     }
     try
     {
         List <System.Data.SqlClient.SqlParameter> spParams = new List <System.Data.SqlClient.SqlParameter>();
         spParams.Add(Param.CreateParam("UIDCMPGN", SqlDbType.Int, uidCmpgn));
         spParams.Add(Param.CreateParam("COMPANYID", SqlDbType.Int, companyId));
         spParams.Add(Param.CreateParam("ADDEDBY", SqlDbType.VarChar, Security.GetFullUserNameFromId(Security.GetCurrentUserId)));
         spParams.Add(Param.CreateParam("ISNOTIFICATIONEMAILSENT", SqlDbType.Int, -1));
         spParams.Add(Param.CreateParam("ATTACHMENTID", SqlDbType.Int, attachmentId));
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             io.ExecuteActionQuery(IO.CreateCommandFromStoredProc("QUATTRO_CCNREPORT_TOGGLENOTIFICATIONEMAILFLAG", spParams));
         }
         SendCCNEmail(false, contractNumber, attachmentUserId);
         return(true);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to send the Notification email.");
     }
 }
Esempio n. 6
0
 public Booking LoadBookingById(int bookingId)
 {
     try
     {
         DataSet bookingData;
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             bookingData = io.ExecuteDataSetQuery(IO.CreateCommandFromStoredProc("Production_GetBookingById", Param.CreateParam("BOOKINGID", SqlDbType.Int, bookingId)));
         }
         return(new Booking(Convert.ToInt32(IO.GetDataRowValue(bookingData.Tables[0].Rows[0], "LOCATION_ID", -1))
                            , bookingId
                            , Convert.ToString(IO.GetDataRowValue(bookingData.Tables[0].Rows[0], "BOOKING_DESC", ""))
                            , Convert.ToDateTime(IO.GetDataRowValue(bookingData.Tables[0].Rows[0], "BOOKING_START_DATE", DateTime.MinValue))
                            , Convert.ToDateTime(IO.GetDataRowValue(bookingData.Tables[0].Rows[0], "BOOKING_END_DATE", DateTime.MaxValue))
                            , Convert.ToInt32(IO.GetDataRowValue(bookingData.Tables[0].Rows[0], "BOOKING_STATUS_ID", -1))
                            , Convert.ToString(IO.GetDataRowValue(bookingData.Tables[0].Rows[0], "BOOKING_STATUS_DESC", ""))
                            , Convert.ToString(IO.GetDataRowValue(bookingData.Tables[0].Rows[0], "BOOKING_COMMENTS", ""))
                            , Convert.ToString(IO.GetDataRowValue(bookingData.Tables[0].Rows[0], "AE_NTID", "-1"))
                            ));
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to retrieve Booking data.");
     }
 }
Esempio n. 7
0
        public XmlDocument GetInvoiceLineGlOverrideAuditGrid(int page, int rows, string sidx, string sord, bool _search, string contractNumber, string companyId)
        {
            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                DataSet ds;
                using (IO io = new IO(WebCommon.ConnectionString))
                {
                    ds = io.ExecuteDataSetQuery(IO.CreateCommandFromStoredProc("Quattro_GetInvoiceLineGLOverrideAudit",
                                                                               Param.CreateParam("CONTRACTNUMBER", SqlDbType.VarChar, contractNumber),
                                                                               Param.CreateParam("COMPANYID", SqlDbType.Int, Convert.ToInt32(companyId))));
                }
                DataTable table = ds.Tables[0];
                //Sort the table based on the sort index and sort direction
                DataView sortedView = new DataView(table);
                table = sortedView.ToTable();
                table.DefaultView.RowFilter = "";
                xmlDoc.LoadXml(WebCommon.GetGridData(table, string.Empty, page, rows));
            }
            catch (Exception ex)
            {
                WebCommon.LogExceptionInfo(ex);
            }
            return(xmlDoc);
        }
Esempio n. 8
0
 public List <AEFlatRate> GetAEFlatRates(string aeId, int companyId)
 {
     try
     {
         return(AEFlatRate.GetAEFlatRates(aeId, companyId));
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to retrieve the Flat Rate data.");
     }
 }
Esempio n. 9
0
 public AEFlatRate GetAEFlatRateRecord(int aeFlatRateId)
 {
     try
     {
         return(new AEFlatRate(aeFlatRateId));
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to retrieve the Flat Rate record.");
     }
 }
Esempio n. 10
0
 public AEDrawPayment GetAEDrawPaymentRecord(int aeDrawPaymentId)
 {
     try
     {
         return(new AEDrawPayment(aeDrawPaymentId));
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to retrieve the Draw/Payment record.");
     }
 }
Esempio n. 11
0
 public void DeleteAEFlatRateRecord(int aeFlatRateId)
 {
     try
     {
         AEFlatRate.DeleteRecord(aeFlatRateId);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to delete the Flat Rate record.");
     }
 }
Esempio n. 12
0
 public void AddAEFlatRateRecord(AEFlatRate aeFlatRate)
 {
     try
     {
         aeFlatRate.Save();
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to retrieve the Flat Rate record.");
     }
 }
Esempio n. 13
0
 public void DeleteSpot(int spotId)
 {
     try
     {
         Spot.DeleteSpot(spotId);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to delete the spot.");
     }
 }
Esempio n. 14
0
 public SpotCampaignDetail GetSpotCampaignDetail(Spot spot)
 {
     try
     {
         return(SpotCampaignDetail.GetSpotCampaignDetail(spot.StationId, spot.StationSpotId, spot.SpotDate, spot.CampaignName, spot.CampaignNumber));
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occured while trying to retrieve the Campaign detail for the selected spot.");
     }
 }
Esempio n. 15
0
 public List <CampaignSearchResult> ExecuteCampaignSearch(string campaignSearchText)
 {
     try
     {
         return(CampaignSearchResult.ExecuteCampaignSearch(campaignSearchText));
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(new Exception(string.Format("An error occurred while trying to execute a Campaign search for the following text: {0}.", campaignSearchText), ex));
         throw new Exception("An error occurred while trying to execute the Campaign search.");
     }
 }
Esempio n. 16
0
 public void AddAEDrawPaymentRecord(AEDrawPayment aeDrawPayment)
 {
     try
     {
         aeDrawPayment.Save();
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to retrieve the Draw/Payment record.");
     }
 }
Esempio n. 17
0
 public bool CheckExistingFlatRateEffectiveDate(string aeId, int companyId, DateTime flatRateEffectiveDate)
 {
     try
     {
         return(AEFlatRate.CheckExistingFlatRateEffectiveDate(aeId, companyId, flatRateEffectiveDate));
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while checking for existing effective dates.");
     }
 }
Esempio n. 18
0
 public bool CheckExistingCommissionAmountYear(string aeId, int companyId, int year)
 {
     try
     {
         return(AECommissionAmount.CheckExistingCommissionAmountYear(aeId, companyId, year));
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while checking for existing commission amount years.");
     }
 }
Esempio n. 19
0
 public void DeleteAEDrawPaymentRecord(int aeDrawPaymentId)
 {
     try
     {
         AEDrawPayment.DeleteRecord(aeDrawPaymentId);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to delete the Draw/Payment record.");
     }
 }
Esempio n. 20
0
 public List <AEDrawPayment> GetAEDrawPayments(string aeId, int companyId)
 {
     try
     {
         return(AEDrawPayment.GetAEDrawPayments(aeId, companyId));
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to retrieve the Draw/Payment data.");
     }
 }
Esempio n. 21
0
 public void AddAECommissionAmountRecord(AECommissionAmount aeCommissionAmount)
 {
     try
     {
         aeCommissionAmount.Save();
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to add the Commission Amount record.");
     }
 }
Esempio n. 22
0
 public Spot LoadSpot(int spotId)
 {
     try
     {
         Spot spot = new Spot(spotId);
         return(spot);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to load the spot.");
     }
 }
Esempio n. 23
0
 public Station GetStationInfoWithMatrix(StationOptions stationOptions)
 {
     try
     {
         Station station = new Station(stationOptions);
         return(station);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(new Exception(string.Format("An error occurred while trying to load info for StationId: {0}", stationOptions.stationId), ex));
         throw new Exception("An error occurred while trying to load the Station info.");
     }
 }
Esempio n. 24
0
 public List <Avails> GetAvails(int year, string market)
 {
     try
     {
         List <Avails> availsList = Avails.GetAvails(year, market);
         return(availsList);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occured while trying to retrieve the Avails List.");
     }
 }
Esempio n. 25
0
 /// <summary>Deletes the file at the specified path if it exists</summary>
 /// <param name="path">The path to the file to be deleted</param>
 public static void DeleteFile(string path)
 {
     try
     {
         if (File.Exists(path))
         {
             File.Delete(path);
         }
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(new Exception("An attempt to delete a file failed.", ex));
     }
 }
Esempio n. 26
0
        public XmlDocument GetMTAInvoiceNotesGrid(int page, int rows, string sidx, string sord, bool _search)
        {
            XmlDocument xmlDoc       = new XmlDocument();
            string      searchField  = string.Empty;
            string      searchString = string.Empty;
            string      searchFilter = string.Empty;

            if (_search)
            {
                searchField  = HttpContext.Current.Request["searchField"];
                searchString = HttpContext.Current.Request["searchString"];
                //spParams.Add(searchField, searchString);
                if (String.IsNullOrEmpty(searchString))
                {
                    searchFilter = string.Format("AND [{0}] IS NULL", searchField);
                }
                else
                {
                    searchFilter = string.Format("AND [{0}] LIKE '%{1}%'", searchField, searchString);
                }
            }
            try
            {
                DataSet ds;
                using (IO io = new IO(WebCommon.ConnectionString))
                {
                    using (System.Data.SqlClient.SqlCommand cmd = IO.CreateCommandFromStoredProc("Collections_GetMTAInvoiceNotesGrid"))
                    {
                        if (!String.IsNullOrEmpty(sidx))
                        {
                            cmd.Parameters.Add(Param.CreateParam("SORTBY", SqlDbType.VarChar, sidx));
                        }
                        if (!String.IsNullOrEmpty(sord))
                        {
                            cmd.Parameters.Add(Param.CreateParam("SORTDIR", SqlDbType.VarChar, sord));
                        }
                        ds = io.ExecuteDataSetQuery(cmd);
                    }
                }
                DataTable table  = ds.Tables[0];
                string    filter = string.Format("(1=1) {0}", searchFilter);
                xmlDoc.LoadXml(WebCommon.GetGridData(table, filter, page, rows));
            }
            catch (Exception ex)
            {
                WebCommon.LogExceptionInfo(ex);
            }
            return(xmlDoc);
        }
Esempio n. 27
0
 public List <Quattro.Attachment> ExecuteAttachmentSearch(Quattro.AttachmentSearchParams searchParams)
 {
     try
     {
         List <System.Data.SqlClient.SqlParameter> spParams = new List <System.Data.SqlClient.SqlParameter>();
         if (searchParams.contractNumber != null && searchParams.contractNumber.Count > 0)
         {
             spParams.Add(Param.CreateParam("CONTRACTNUMBERS", SqlDbType.Structured, GetContractNumberTable(searchParams.contractNumber)));
         }
         if (searchParams.invoiceNumber != null && searchParams.invoiceNumber.Count > 0)
         {
             spParams.Add(Param.CreateParam("INVOICENUMBERS", SqlDbType.Structured, GetInvoiceNumberTable(searchParams.invoiceNumber)));
         }
         if (!String.IsNullOrEmpty(searchParams.advertiser))
         {
             spParams.Add(Param.CreateParam("ADVERTISER", SqlDbType.VarChar, searchParams.advertiser));
         }
         if (searchParams.uidObjectType != -1 && searchParams.uidObjectType != 0)
         {
             spParams.Add(Param.CreateParam("UIDOBJECTTYPE", SqlDbType.Int, searchParams.uidObjectType));
         }
         spParams.Add(Param.CreateParam("COMPANYID", SqlDbType.Int, searchParams.companyId));
         DataSet attachmentData;
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             attachmentData = io.ExecuteDataSetQuery(IO.CreateCommandFromStoredProc("Quattro_ExecuteAttachmentSearch", spParams));
         }
         List <Quattro.Attachment> attachments = new List <Quattro.Attachment>();
         foreach (DataRow row in attachmentData.Tables[0].Rows)
         {
             attachments.Add(new Quattro.Attachment(Convert.ToString(row["ATTACHMENT_ID"])
                                                    , Convert.ToString(row["ATTACHMENT_EXT"])
                                                    , Convert.ToString(row["ATTACHMENT_NAME"])
                                                    , Convert.ToString(row["ATTACHMENT_TITLE"])
                                                    , Convert.ToString(row["ATTACHMENT_DESC"])
                                                    , Convert.ToString(row["ATTACHMENT_TYPE"])
                                                    , Convert.ToInt32(row["ATTACHMENT_TYPE_ID"])
                                                    , Convert.ToDateTime(row["ATTACHMENT_DATE"])
                                                    , Convert.ToString(row["CONTRACT_NUMBER"])
                                                    , searchParams.companyId));
         }
         return(attachments);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to search for attachments.");
     }
 }
Esempio n. 28
0
 public Spot UpdateSpot(Spot spot)
 {
     try
     {
         spot.LastUpdatedBy = Security.GetCurrentUserId;
         spot.LastUpdatedOn = DateTime.Now;
         spot.Update();
         return(spot);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to update the spot.");
     }
 }
Esempio n. 29
0
 public void DeleteBooking(int bookingId)
 {
     try
     {
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             io.ExecuteActionQuery(IO.CreateCommandFromStoredProc("PRODUCTION_DELETEBOOKING", Param.CreateParam("BOOKINGID", SqlDbType.Int, bookingId)));
         }
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to delete the Booking.");
     }
 }
Esempio n. 30
0
 public void DeleteLocation(int locationId)
 {
     try
     {
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             io.ExecuteActionQuery(IO.CreateCommandFromStoredProc("Production_DeleteLocation", Param.CreateParam("LOCATIONID", SqlDbType.Int, locationId)));
         }
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(new Exception(string.Format("An error occurred while trying to delete location id: {0}. Inner Exception: {1}", locationId, ex.InnerException)));
         throw new Exception("An error occurred while trying to delete the location.");
     }
 }