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.");
     }
 }
 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.");
     }
 }
 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.");
     }
 }
Example #4
0
        /// <summary>Deletes a Digital Libary file with the specified id</summary>
        /// <param name="fileId">The id of the file to delete</param>
        /// <param name="fileExtension">The extension of the file to delete</param>
        public static void DeleteDigitalLibraryFile(int fileId, string fileExtension)
        {
            string path = string.Format("{0}{1}/{2}.{3}", DigitalLibraryImaging.ImageFilePath, GetDigitalLibraryFileFolder(fileId), fileId, fileExtension);

            WebCommon.DeleteFile(HttpContext.Current.Server.MapPath(path));
            //if this is an image, delete the corresponding thumbnail as well
            if (fileExtension.ToUpper() == "JPG")
            {
                string thumbPath = string.Format("{0}{1}/{2}_t.JPG", DigitalLibraryImaging.ThumbnailImageFilePath, GetDigitalLibraryFileFolder(fileId), fileId);
                WebCommon.DeleteFile(HttpContext.Current.Server.MapPath(thumbPath));
            }
        }
Example #5
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.");
     }
 }
 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.");
     }
 }
 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.");
     }
 }
Example #8
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));
     }
 }
Example #9
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.");
     }
 }
Example #10
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);
        }
 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.");
     }
 }
 public void DeleteMultipleSpots(List <int> spotIdsToDelete)
 {
     try
     {
         foreach (int spotId in spotIdsToDelete)
         {
             Spot.DeleteSpot(spotId);
         }
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(new Exception(string.Format("Could not Delete the following list of IDs: {0}", String.Join(",", Array.ConvertAll <int, string>(spotIdsToDelete.ToArray(), new Converter <int, string>(Convert.ToString))), ex)));
         throw new Exception("An error occurred while trying to delete the spot(s).");
     }
 }
Example #13
0
        public bool IsUserInRole(string roleName)
        {
            object isUserInRole = WebCommon.GetSessionValue(string.Format("is{0}User", roleName), null);

            if (isUserInRole == null)
            {
                isUserInRole = TitanADService.CheckRoleForUser(Security.GetCurrentUserId, roleName);
                WebCommon.SetSessionState(string.Format("is{0}User", roleName), isUserInRole);
                return((bool)isUserInRole);
            }
            else
            {
                return((bool)isUserInRole);
            }
        }
Example #14
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.");
     }
 }
Example #15
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.");
     }
 }
 public List <SelectListItem> AgencyAutoComplete(string companyId, string term)
 {
     try
     {
         //Hashtable paramList = new Hashtable();
         //paramList.Add("COMPANYID", Convert.ToInt32(companyId));
         List <System.Data.SqlClient.SqlParameter> paramList = new List <System.Data.SqlClient.SqlParameter>();
         paramList.Add(Param.CreateParam("companyId", SqlDbType.Int, companyId));
         Context.Response.ContentType = "application/json";
         return(GetSelectList(term, 10, "DigitalLibrary_AutocompleteAgencies", paramList));
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         return(new List <SelectListItem>());
     }
 }
Example #17
0
 /// <summary>TBD</summary>
 /// <param name="sender">TBD</param>
 /// <param name="e">TBD</param>
 protected void excelExport_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         WebCommon.WriteDebugMessage(string.Format("Customer Rollup List Exported by: {0}", Security.GetCurrentUserId));
         Hashtable spParams     = new Hashtable();
         DataSet   customerData = DataIO.ExecuteDataSetQuery(DataIO.GetCommandFromStoredProc("MASTERDATA_GETCUSTOMERROLLUP", spParams));
         WebCommon.ExportHtmlToExcel("CustomerRollupList", WebCommon.DataTableToHtmlTable(customerData.Tables[0], "Customer Rollup"));
     }
     catch (System.Threading.ThreadAbortException)
     {
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
     }
 }
 /// <summary>Purges information from the Exception Log</summary>
 /// <param name="sender">Object firing the event</param>
 /// <param name="e">EventArgs</param>
 protected void flushLog_Click(object sender, EventArgs e)
 {
     try
     {
         DataIO.ExecuteActionQuery(DataIO.GetCommandFromStoredProc("App_DeleteStatusLog"));
         labelStatus.Text = "The Status Log has been purged.<br/><br/>";
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         labelStatus.Text = "An error occurred while trying to purge the Status Log.<br/><br/>";
     }
     finally
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ReloadGrid", "setTimeout('RefreshGrid()',200);", true);
     }
 }
Example #19
0
        public void AddUpdateBooking(Booking booking)
        {
            bool isAdding    = (booking.bookingId == -1);
            int  successCode = 0;

            try
            {
                List <System.Data.SqlClient.SqlParameter> spParams = new List <System.Data.SqlClient.SqlParameter>();
                spParams.Add(Param.CreateParam("LOCATIONID", SqlDbType.Int, booking.locationId));
                spParams.Add(Param.CreateParam("BOOKINGID", SqlDbType.Int, booking.bookingId));
                spParams.Add(Param.CreateParam("BOOKINGDESC", SqlDbType.VarChar, booking.bookingDesc));
                spParams.Add(Param.CreateParam("STARTDATE", SqlDbType.DateTime, booking.bookingStartDate));
                spParams.Add(Param.CreateParam("ENDDATE", SqlDbType.DateTime, booking.bookingEndDate));
                spParams.Add(Param.CreateParam("AENTID", SqlDbType.VarChar, booking.aeNtId));
                if (booking.bookingStatusId != -1)
                {
                    spParams.Add(Param.CreateParam("BOOKINGSTATUSID", SqlDbType.Int, booking.bookingStatusId));
                }
                if (!String.IsNullOrEmpty(booking.bookingComments))
                {
                    spParams.Add(Param.CreateParam("BOOKINGCOMMENTS", SqlDbType.VarChar, booking.bookingComments));
                }
                spParams.Add(Param.CreateParam("ENTEREDBY", SqlDbType.VarChar, Security.GetCurrentUserId));
                using (IO io = new IO(WebCommon.ConnectionString))
                {
                    successCode = Convert.ToInt32(io.ExecuteScalarQuery(IO.CreateCommandFromStoredProc("Production_AddUpdateBooking", spParams)));
                }
                if (successCode == -1)
                {
                    throw new Exception("Booking date collision");
                }
            }
            catch (Exception ex)
            {
                WebCommon.LogExceptionInfo(ex);
                if (successCode == -1)
                {
                    throw new Exception(string.Format("An error occurred while trying to {0} the Booking. The dates conflicted with an existing Booking.", (isAdding ? "Add" : "Update")));
                }
                else
                {
                    throw new Exception(string.Format("An error occurred while trying to {0} the Booking.", (isAdding ? "Add" : "Update")));
                }
            }
        }
Example #20
0
 public bool AddMTAInvoiceNote(int id, string invoiceNumber, string notes)
 {
     try
     {
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             io.ExecuteScalarQuery(IO.CreateCommandFromStoredProc("COLLECTIONS_ADDMTAINVOICENOTE",
                                                                  Param.CreateParam("INVOICENUMBER", SqlDbType.Int, Convert.ToInt32(invoiceNumber)),
                                                                  Param.CreateParam("NOTES", SqlDbType.VarChar, notes),
                                                                  Param.CreateParam("ENTEREDBY", SqlDbType.VarChar, Security.GetCurrentUserId)));
         }
         return(true);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         return(false);
     }
 }
 public Spot UpdateMultipleSpots(Spot currentSpot, List <int> spotIdsToUpdate)
 {
     try
     {
         currentSpot.LastUpdatedBy = Security.GetCurrentUserId;
         currentSpot.LastUpdatedOn = DateTime.Now;
         foreach (int spotId in spotIdsToUpdate)
         {
             currentSpot.SpotId = spotId;
             currentSpot.Update();
         }
         return(currentSpot);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(new Exception(string.Format("Could not Update the following list of IDs: {0}", String.Join(",", Array.ConvertAll <int, string>(spotIdsToUpdate.ToArray(), new Converter <int, string>(Convert.ToString))), ex)));
         throw new Exception("An error occurred while trying to delete the spot(s).");
     }
 }
Example #22
0
 /// <summary>TBD</summary>
 /// <param name="uidCmpgn">TBD</param>
 /// <param name="attachmentId">TBD</param>
 /// <param name="isCompletion">TBD</param>
 /// <returns>TBD</returns>
 public bool IsCCNEMailSent(int uidCmpgn, int attachmentId, bool isCompletion)
 {
     try
     {
         string storedProcName = (isCompletion ? "QUATTRO_CCNREPORT_CHECKFORCOMPLETIONEMAIL" : "QUATTRO_CCNREPORT_CHECKFORNOTIFICATIONEMAIL");
         int    result;
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             result = Convert.ToInt32(io.ExecuteScalarQuery(IO.CreateCommandFromStoredProc(storedProcName,
                                                                                           Param.CreateParam("UIDCMPGN", SqlDbType.Int, uidCmpgn),
                                                                                           Param.CreateParam("ATTACHMENTID", SqlDbType.Int, attachmentId))));
         }
         return(result != 0);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         return(false);
     }
 }
Example #23
0
 public bool AddUpdateUninvoicedContractNote(int id, int uidCmpgn, string companyId, string notes)
 {
     try
     {
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             io.ExecuteActionQuery(IO.CreateCommandFromStoredProc("QUATTRO_ADDUPDATEUNINVOICEDNOTE",
                                                                  Param.CreateParam("UID_CMPGN", SqlDbType.Int, uidCmpgn),
                                                                  Param.CreateParam("NOTETEXT", SqlDbType.VarChar, notes),
                                                                  Param.CreateParam("COMPANYID", SqlDbType.Int, Convert.ToInt32(companyId)),
                                                                  Param.CreateParam("ADDEDBY", SqlDbType.VarChar, Security.GetFullUserNameFromId(Security.GetCurrentUserId))));
         }
         return(true);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         return(false);
     }
 }
        public List <SelectListItem> MediaFormAutoComplete(string companyId, string mediaTypeId, string term)
        {
            try
            {
                List <System.Data.SqlClient.SqlParameter> paramList = new List <System.Data.SqlClient.SqlParameter>();
                paramList.Add(Param.CreateParam("companyId", SqlDbType.Int, Convert.ToInt32(companyId)));
                if (!String.IsNullOrEmpty(mediaTypeId))
                {
                    paramList.Add(Param.CreateParam("MEDIATYPEID", SqlDbType.VarChar, mediaTypeId));
                }

                Context.Response.ContentType = "application/json";
                return(GetSelectList(term, 10, "AutoCompleteMediaForms", paramList));
            }
            catch (Exception ex)
            {
                WebCommon.LogExceptionInfo(ex);
                return(new List <SelectListItem>());
            }
        }
 public SpotConflict SaveSpot(Spot spot)
 {
     try
     {
         //return InnerSaveSpot(spot);
         SpotConflict spotContflicts = new SpotConflict();
         try
         {
             InnerSaveSpot(spot);
         }
         catch (SpotConflictException)
         {
             spotContflicts = new SpotConflict(spot.SpotDate);
         }
         return(spotContflicts);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to save the spot.");
     }
 }
Example #26
0
 public CascadingDropDownNameValue[] GetAttachmentTypes(int companyId)
 {
     try
     {
         List <CascadingDropDownNameValue> attachmentTypes = new List <CascadingDropDownNameValue>();
         DataSet attachmentTypeData;
         using (IO io = new IO(WebCommon.ConnectionString))
         {
             attachmentTypeData = io.ExecuteDataSetQuery(IO.CreateCommandFromStoredProc("QUATTRO_GETATTACHMENTTYPES", Param.CreateParam("COMPANYID", SqlDbType.Int, companyId)));
         }
         attachmentTypes.Add(new CascadingDropDownNameValue(" - All Attachment Types - ", "", true));
         foreach (DataRow row in attachmentTypeData.Tables[0].Rows)
         {
             attachmentTypes.Add(new CascadingDropDownNameValue(Convert.ToString(row["str_name"]), Convert.ToString(row["uid_object_type"])));
         }
         return(attachmentTypes.ToArray());
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("The Attachment Type List could not be retrieved.");
     }
 }
 public List <SpotConflict> SaveMultipleSpots(Spot spot, int numberOfWeeks)
 {
     try
     {
         DateTime            spotDate      = spot.SpotDate;
         List <Spot>         spots         = new List <Spot>();
         List <SpotConflict> spotConflicts = new List <SpotConflict>();
         //This *should* not need to be checked as a user can not add a spot into a non-empty cell
         spots.Add(InnerSaveSpot(spot));
         Spot newSpot;
         int  prevMonth = spot.Month;
         int  week      = spot.Week;
         for (int i = 1; i < numberOfWeeks; i++)
         {
             spotDate = spotDate.AddDays(7);
             week     = (spotDate.Month == prevMonth ? week + 1 : 1);
             newSpot  = new Spot(spot.StationId, spot.StationSpotId, spot.SpotTypeId
                                 , spotDate, spotDate.Year, spotDate.Month, week
                                 , spot.CampaignName, spot.CampaignNumber, spot.Description);
             prevMonth = spotDate.Month;
             try
             {
                 spots.Add(InnerSaveSpot(newSpot));
             }
             catch (SpotConflictException)
             {
                 spotConflicts.Add(new SpotConflict(spotDate));
             }
         }
         return(spotConflicts);
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to save the spot.");
     }
 }
Example #28
0
        public void AddUpdateLocation(Location location)
        {
            bool isAdding = (location.locationId == -1);

            try
            {
                List <System.Data.SqlClient.SqlParameter> spParams = new List <System.Data.SqlClient.SqlParameter>();
                spParams.Add(Param.CreateParam("LOCATIONID", SqlDbType.Int, location.locationId));
                spParams.Add(Param.CreateParam("LOCATIONMARKET", SqlDbType.VarChar, location.locationMarket));
                spParams.Add(Param.CreateParam("LOCATIONDESC", SqlDbType.VarChar, location.locationDesc));
                spParams.Add(Param.CreateParam("FOURWEEKRATE", SqlDbType.VarChar, location.fourWeekRate));
                spParams.Add(Param.CreateParam("PRODINSTALLRATE", SqlDbType.VarChar, location.prodInstallRate));
                spParams.Add(Param.CreateParam("RESERVEWINTERMONTHS", SqlDbType.Int, (location.reserveWinterMonths ? -1 : 0)));
                if (location.locationStatusId != -1)
                {
                    spParams.Add(Param.CreateParam("LOCATIONSTATUSID", SqlDbType.Int, location.locationStatusId));
                }
                if (!String.IsNullOrEmpty(location.locationComments))
                {
                    spParams.Add(Param.CreateParam("LOCATIONCOMMENTS", SqlDbType.VarChar, location.locationComments));
                }
                if (!String.IsNullOrEmpty(location.prodInstallRateAdditional))
                {
                    spParams.Add(Param.CreateParam("PRODINSTALLRATEADDITIONAL", SqlDbType.VarChar, location.prodInstallRateAdditional));
                }
                using (IO io = new IO(WebCommon.ConnectionString))
                {
                    io.ExecuteActionQuery(IO.CreateCommandFromStoredProc("Production_AddUpdateLocation", spParams));
                }
            }
            catch (Exception ex)
            {
                WebCommon.LogExceptionInfo(ex);
                throw new Exception(string.Format("An error occurred while trying to {0} the Location.", (isAdding ? "Add" : "Update")));
            }
        }
Example #29
0
        public XmlDocument GetCreditCheckInfo(string fromDate, string toDate, string customerType, string companyId, string contractValue, string status, int page, int rows, string sidx, string sord, bool _search)
        {
            List <System.Data.SqlClient.SqlParameter> spParams = new List <System.Data.SqlClient.SqlParameter>();
            string searchField  = string.Empty;
            string searchString = string.Empty;
            string searchFilter = string.Empty;
            string filter       = 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);
                }
            }
            if (!String.IsNullOrEmpty(sidx))
            {
                spParams.Add(Param.CreateParam("SORTBY", SqlDbType.VarChar, sidx));
            }
            if (!String.IsNullOrEmpty(sord))
            {
                spParams.Add(Param.CreateParam("SORTDIR", SqlDbType.VarChar, sord));
            }
            if (!String.IsNullOrEmpty(fromDate))
            {
                spParams.Add(Param.CreateParam("STARTDATE", SqlDbType.Date, Convert.ToDateTime(fromDate)));
            }
            if (!String.IsNullOrEmpty(toDate))
            {
                spParams.Add(Param.CreateParam("ENDDATE", SqlDbType.Date, Convert.ToDateTime(toDate)));
            }
            if (!String.IsNullOrEmpty(customerType))
            {
                spParams.Add(Param.CreateParam("CUSTOMERTYPE", SqlDbType.VarChar, customerType));
            }
            if (!String.IsNullOrEmpty(companyId))
            {
                spParams.Add(Param.CreateParam("COMPANYID", SqlDbType.Int, Convert.ToInt32(companyId)));
            }
            if (!String.IsNullOrEmpty(contractValue))
            {
                spParams.Add(Param.CreateParam("CONTRACTVALUE", SqlDbType.VarChar, contractValue));
            }
            if (!String.IsNullOrEmpty(status))
            {
                spParams.Add(Param.CreateParam("STATUS", SqlDbType.VarChar, status));
            }
            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                DataSet ds;
                using (IO io = new IO(WebCommon.ConnectionString))
                {
                    ds = io.ExecuteDataSetQuery(IO.CreateCommandFromStoredProc("Collections_CreditCheckingDashboard", spParams));
                }
                filter = string.Format("(1=1) {0}", searchFilter);
                //if the text box contained a search string, apply it:
                DataTable table = ds.Tables[0];
                //Sort the table based on the sort index and sort direction
                DataView sortedView = new DataView(table);
                xmlDoc.LoadXml(WebCommon.GetGridData(sortedView.ToTable(), filter, page, rows));
            }
            catch (Exception ex)
            {
                WebCommon.LogExceptionInfo(ex);
            }
            return(xmlDoc);
        }
Example #30
0
        /// <summary>TBD</summary>
        /// <param name="isCompletion">TBD</param>
        /// <param name="contractNumber">TBD</param>
        /// <param name="attachmentUserId">TBD</param>
        public void SendCCNEmail(bool isCompletion, string contractNumber, string attachmentUserId)
        {
            string  subject   = string.Format("{1}CCN - Contract #: {0}", contractNumber, (WebCommon.InTestingEnvironment() ? "DISREGARD - EMAIL ORIGINATED FROM TEST SYSTEM" : ""));
            string  userName  = Security.GetFullUserNameFromId(attachmentUserId);
            string  userEmail = Security.GetUserEmailFromId(attachmentUserId);
            string  body      = string.Format(@"<span style=""font-size:12px;font-family:Arial;"">{0},<br/><br/>The CCN you have submitted for this contract has been {1} by the Contract Administration team.<br/><br/>Please make sure to notify all markets affected by this CCN.</span>", userName, (isCompletion ? "processed" : "received"));
            Message ccnEmail  = new Message(WebCommon.SmtpAddress);

            //Email ccnEmail = new Email();
            if (WebCommon.InTestingEnvironment())
            {
                ccnEmail.AddRecipient("*****@*****.**");
                ccnEmail.AddRecipient("*****@*****.**");
            }
            else
            {
                ccnEmail.AddRecipient(userEmail);
            }
            ccnEmail.From    = "*****@*****.**";
            ccnEmail.Subject = subject;
            ccnEmail.Body    = body;
            ccnEmail.AddCC("*****@*****.**");
            ccnEmail.AddBCC("*****@*****.**");
            ccnEmail.SendEmail();
        }