Beispiel #1
0
        public JobsGuidResponse EditJob(Guid guid, [FromBody] Job oJob)
        {
            JobsGuidResponse oJobsGuidResponse = new JobsGuidResponse();
            Guid             gJobGuid          = new Guid();

            ServerResponse.ResponseCodes eResponse = oJobsBL.EditJob(out gJobGuid, guid, oJob);
            oJobsGuidResponse.data = new singlejobguid {
                guid = gJobGuid
            };
            oJobsGuidResponse.meta.code          = Convert.ToInt32(eResponse);
            oJobsGuidResponse.meta.error_message = ServerResponse.GetResponse(eResponse);
            return(oJobsGuidResponse);
        }
Beispiel #2
0
 // [Route("{guid}")]
 public JobsResponse GetJobByGuid(Guid guid)
 {
     JobsResponse oMultipleJobResponse = new JobsResponse();
     {
         List <Jobs> liJobs = new List <Jobs>();
         ServerResponse.ResponseCodes eResponse = oJobsBL.GetJobByJobId(out liJobs, guid);
         oMultipleJobResponse.data = new multiplejobresponse {
             jobs = liJobs
         };
         oMultipleJobResponse.meta.error_message = ServerResponse.GetResponse(eResponse);
         oMultipleJobResponse.meta.code          = Convert.ToInt32(eResponse);
         return(oMultipleJobResponse);
     }
 }
 public ServerResponse.ResponseCodes GetTemplates(out List <Templates> liTemplates, bool?ActiveOnly = true, long?lCreatedFor = null, bool?bAutoGenerateOnly = null, int?iCategoryId = null, double?dMaxDuration = null, string SearchTerm = null, bool bCleanObject = true, [CallerMemberName] string callingMethod = "", [CallerLineNumber] int callingFileLineNumber = 0, int pageNo = 0, int pageSize = 9, string sortColumn = "created", string sortOrder = "DESC", string siteType = "web", int jobid = 0)
 {
     liTemplates = null;
     ServerResponse.ResponseCodes eResponse = ServerResponse.ResponseCodes.Internal_Error;
     liTemplates = GetTemplates(null, ActiveOnly, null, null, lCreatedFor, null, false, false, bAutoGenerateOnly, iCategoryId, null, dMaxDuration, SearchTerm, bCleanObject, callingMethod, callingFileLineNumber, pageNo, pageSize, sortColumn, sortOrder, siteType);
     if (liTemplates != null && liTemplates.Count > 0)
     {
         eResponse = ServerResponse.ResponseCodes.Success;
     }
     else
     {
         eResponse = ServerResponse.ResponseCodes.NoResultFound;
     }
     return(eResponse);
 }
Beispiel #4
0
        public JobElementsResponse GetJobElementsByJobGuid(Guid guid)
        {
            JobElementsResponse oJobElementsResponse = new JobElementsResponse();

            {
                JobElementsBL                oTemplateElementsBL = new JobElementsBL();
                List <JobElements>           liJobElements       = new List <JobElements>();
                ServerResponse.ResponseCodes eResponse           = oTemplateElementsBL.GetJobElementsByJobGuid(out liJobElements, guid);
                oJobElementsResponse.data = new multiplejobelementsresponse {
                    JobElements = liJobElements
                };
                oJobElementsResponse.meta.error_message = ServerResponse.GetResponse(eResponse);
                oJobElementsResponse.meta.code          = Convert.ToInt32(eResponse);
            }
            return(oJobElementsResponse);
        }
        public TemplateElementsResponse GetTemplateElementsByTemplateGuid(Guid guid)
        {
            TemplateElementsResponse oTemplateElementsResponse = new TemplateElementsResponse();

            {
                TemplatesBL                  oTemplateElementsBL = new TemplatesBL();
                List <TemplateElements>      liTemplateElements  = new List <TemplateElements>();
                ServerResponse.ResponseCodes eResponse           = oTemplateElementsBL.GetTemplateElementsByTemplateGuid(out liTemplateElements, guid);
                oTemplateElementsResponse.data = new multipletemplateelementsresponse {
                    TemplateElements = liTemplateElements
                };
                oTemplateElementsResponse.meta.error_message = ServerResponse.GetResponse(eResponse);
                oTemplateElementsResponse.meta.code          = Convert.ToInt32(eResponse);
            }
            return(oTemplateElementsResponse);
        }
        public TemplateResponse GetTemplateByGuid(Guid id)
        {
            TemplateResponse oSingleTemplateResponse = new TemplateResponse();

            {
                TemplatesBL oTemplatesBL = new TemplatesBL();
                Templates   oTemplates   = new Templates();
                ServerResponse.ResponseCodes eResponse = oTemplatesBL.GetTemplateByTemplateGuid(out oTemplates, id);
                oSingleTemplateResponse.data = new singleTemplateresponse {
                    Template = oTemplates
                };
                oSingleTemplateResponse.meta.error_message = ServerResponse.GetResponse(eResponse);
                oSingleTemplateResponse.meta.code          = Convert.ToInt32(eResponse);
            }
            return(oSingleTemplateResponse);
        }
        public ServerResponse.ResponseCodes EditJob(out Guid gJobGuid, Guid guid, Job oJob)
        {
            ServerResponse.ResponseCodes eResponse = ServerResponse.ResponseCodes.Internal_Error;
            gJobGuid = Guid.Empty;
            try
            {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DemoVideoBurstConnection"].ConnectionString))
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection  = conn;
                        cmd.CommandType = CommandType.Text;
                        cmd.CommandText = @"Update [tblJobs] set [title]= @Title,[callback]=@CallBack,[clickurl]=@ClickUrl,[templateguid]=@templateguid where guid=@jobguid IF(@@ROWCOUNT>0)
		                    BEGIN
			                    SELECT [guid] FROM [tblJobs] WHERE guid=@jobguid
                            END
                           ";
                        cmd.Parameters.AddWithValue("@Title", oJob.title);
                        cmd.Parameters.AddWithValue("@CallBack", oJob.callback.ToString());
                        cmd.Parameters.AddWithValue("@ClickUrl", oJob.clickurl);
                        cmd.Parameters.AddWithValue("@templateguid", oJob.templateguid);
                        cmd.Parameters.AddWithValue("@jobguid", guid);

                        conn.Open();
                        object oReturnValue = cmd.ExecuteScalar();

                        JobElementsBL oJobElementsBL = new JobElementsBL();
                        // Newly Added Code

                        if (oReturnValue != null && !String.IsNullOrEmpty(Convert.ToString(oReturnValue)) && oJobElementsBL.EditJobElements(oJob.elements, guid))
                        {
                            gJobGuid  = new Guid(Convert.ToString(oReturnValue));
                            eResponse = ServerResponse.ResponseCodes.Success;
                        }
                        else
                        {
                            eResponse = ServerResponse.ResponseCodes.DatabaseInsertionError;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                eResponse = ServerResponse.ResponseCodes.Internal_Error;
            }
            return(eResponse);
        }
        public TemplatesResponse GetTemplates()
        {
            TemplatesResponse oTemplatesResponse = new TemplatesResponse();

            {
                TemplatesBL                  oTemplatesBL = new TemplatesBL();
                List <Templates>             liTemplates  = new List <Templates>();
                ServerResponse.ResponseCodes eResponse    = ServerResponse.ResponseCodes.Internal_Error;
                eResponse = oTemplatesBL.GetAllTemplates(out liTemplates);
                oTemplatesResponse.data = new multipleTemplateresponse {
                    Templates = liTemplates
                };
                oTemplatesResponse.meta.error_message = ServerResponse.GetResponse(eResponse);
                oTemplatesResponse.meta.code          = Convert.ToInt32(eResponse);
            }
            return(oTemplatesResponse);
        }
Beispiel #9
0
        public ServerResponse.ResponseCodes GetAllTemplates(out List <Templates> pTemplates)
        {
            pTemplates = null;
            ServerResponse.ResponseCodes eResponse = ServerResponse.ResponseCodes.Internal_Error;

            List <Templates> liTemplates = GetAllTemplates();

            if (liTemplates != null && liTemplates.Count > 0)
            {
                pTemplates = liTemplates;
                eResponse  = ServerResponse.ResponseCodes.Success;
            }
            else
            {
                eResponse = ServerResponse.ResponseCodes.NoResultFound;
            }

            return(eResponse);
        }
Beispiel #10
0
        public ServerResponse.ResponseCodes GetTemplateByTemplateGuid(out Templates pTemplates, Guid id)
        {
            pTemplates = null;
            ServerResponse.ResponseCodes eResponse = ServerResponse.ResponseCodes.Internal_Error;

            List <Templates> liTemplates = GetTemplates(id);

            if (liTemplates != null && liTemplates.Count > 0)
            {
                pTemplates = liTemplates[0];
                eResponse  = ServerResponse.ResponseCodes.Success;
            }
            else
            {
                eResponse = ServerResponse.ResponseCodes.NoResultFound;
            }

            return(eResponse);
        }
Beispiel #11
0
 public ServerResponse.ResponseCodes GetTemplateElementsByTemplateGuid(out List <TemplateElements> liTemplateElements, Guid?gTemplateGuid)
 {
     liTemplateElements = null;
     ServerResponse.ResponseCodes eResponse = ServerResponse.ResponseCodes.Internal_Error;
     if (gTemplateGuid != null)
     {
         liTemplateElements = GetTemplatesElements(gTemplateGuid);
         if (liTemplateElements != null && liTemplateElements.Count > 0)
         {
             eResponse = ServerResponse.ResponseCodes.Success;
         }
         else
         {
             eResponse = ServerResponse.ResponseCodes.NoResultFound;
         }
     }
     else
     {
         eResponse = ServerResponse.ResponseCodes.InvalidParams;
     }
     return(eResponse);
 }
 public ServerResponse.ResponseCodes GetJobByJobId(out List <Jobs> oJob, Guid lJobId)
 {
     ServerResponse.ResponseCodes eResponse = ServerResponse.ResponseCodes.Internal_Error;
     oJob = null;
     if (lJobId != null)
     {
         oJob = GetJobs(lJobId);
         if (oJob != null && oJob.Count > 0)
         {
             eResponse = ServerResponse.ResponseCodes.Success;
             //oJob = liJobs[0];
         }
         else
         {
             eResponse = ServerResponse.ResponseCodes.NoResultFound;
         }
     }
     else
     {
         eResponse = ServerResponse.ResponseCodes.InvalidParams;
     }
     return(eResponse);
 }
 public ServerResponse.ResponseCodes GetTemplateByTemplateGuid(out Templates pTemplates, Guid?gTemplateGuid, bool?ActiveOnly = true, int?iStatus = null, bool bCleanObject = true, [CallerMemberName] string callingMethod = "", [CallerLineNumber] int callingFileLineNumber = 0, long jobid = 0, string jobStatus = "")
 {
     pTemplates = null;
     ServerResponse.ResponseCodes eResponse = ServerResponse.ResponseCodes.Internal_Error;
     if (gTemplateGuid != null)
     {
         if (oStats != null && oStats.contentid == null)
         {
             Templates oTemplatesTemp = null;
             ServerResponse.ResponseCodes eResponseCode = GetTemplateByTemplateGuid(out oTemplatesTemp, null, lUserId, gTemplateGuid, ActiveOnly, iStatus);
             if (eResponseCode == ServerResponse.ResponseCodes.Success && oTemplatesTemp != null)
             {
                 oStats.contentid = oTemplatesTemp.id;
             }
         }
         if (oStats != null && oStats.details != null)
         {
             oStats.details.jsonobjectname = "gTemplateGuid";
             oStats.details.json           = Newtonsoft.Json.JsonConvert.SerializeObject(gTemplateGuid);
         }
         List <Templates> liTemplates = GetTemplates(oStats, lUserId, iStatus, ActiveOnly, gTemplateGuid, null, null, null, false, false, null, null, null, null, null, bCleanObject, callingMethod, callingFileLineNumber, 0, 9, "created", "DESC", "web", jobid, jobStatus);
         if (liTemplates != null && liTemplates.Count > 0)
         {
             pTemplates = liTemplates[0];
             eResponse  = ServerResponse.ResponseCodes.Success;
         }
         else
         {
             eResponse = ServerResponse.ResponseCodes.NoResultFound;
         }
     }
     else
     {
         eResponse = ServerResponse.ResponseCodes.InvalidParams;
     }
     return(eResponse);
 }
        public ServerResponse.ResponseCodes AddJob(out Guid gJobGuid, Job oJob)
        {
            ServerResponse.ResponseCodes eResponse = ServerResponse.ResponseCodes.Internal_Error;
            gJobGuid = Guid.Empty;
            try
            {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DemoVideoBurstConnection"].ConnectionString))
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection  = conn;
                        cmd.CommandType = CommandType.Text;
                        cmd.CommandText = @"INSERT INTO [tblJobs] ( [title],[callback],[clickurl],[callbackformat],[templateguid],[companyid],[createdby]) VALUES (@Title, @CallBack, @ClickUrl, 'JSON', @templateguid, 817, 10721) IF(@@ROWCOUNT>0)
		                    BEGIN
			                    SELECT [guid] FROM [tblJobs] WHERE id=SCOPE_IDENTITY() 
                            END
                           ";
                        cmd.Parameters.AddWithValue("@Title", oJob.title);
                        cmd.Parameters.AddWithValue("@CallBack", oJob.callback.ToString());
                        cmd.Parameters.AddWithValue("@ClickUrl", oJob.clickurl);
                        cmd.Parameters.AddWithValue("@templateguid", oJob.templateguid);

                        conn.Open();
                        object oReturnValue = cmd.ExecuteScalar();

                        JobElementsBL oJobElementsBL = new JobElementsBL();
                        // Newly Added Code

                        if (oReturnValue != null && !String.IsNullOrEmpty(Convert.ToString(oReturnValue)) && oJobElementsBL.AddJobElements(oJob.elements, oJob.templateguid, new Guid(oReturnValue.ToString())))
                        {
                            //oJobElementsBL.AddJobElements(oJob.elements, oJob.templateguid, new Guid(oReturnValue.ToString()));
                            gJobGuid  = new Guid(Convert.ToString(oReturnValue));
                            eResponse = ServerResponse.ResponseCodes.Success;
                        }
                        else
                        {
                            eResponse = ServerResponse.ResponseCodes.DatabaseInsertionError;
                        }

                        //Previous Code
                        //if (oReturnValue != null
                        //    && !String.IsNullOrEmpty(Convert.ToString(oReturnValue))
                        //    && oJobElementsBL.EditJobElements(oJob.elements, new Guid(oReturnValue.ToString())))
                        //{
                        //    gJobGuid = new Guid(Convert.ToString(oReturnValue));
                        //    eResponse = ServerResponse.ResponseCodes.Success;

                        //    ServerResponse.ResponseCodes eResponseCode = GetJobByJobGuid(out oJob, null, lUserId, gJobGuid);
                        //    //Add Stats
                        //    if (oStats != null && oStats.contentid == null)
                        //    {
                        //        if (eResponseCode == ServerResponse.ResponseCodes.Success && oJob != null)
                        //            oStats.contentid = oJob.id;
                        //    }
                        //}
                        //else
                        //{
                        //    eResponse = ServerResponse.ResponseCodes.DatabaseInsertionError;
                        //    if (oStats != null && oStats.details != null)
                        //    {
                        //        oStats.details.message = "Failed to add the job.";
                        //    }
                        //}
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(eResponse);
        }