コード例 #1
0
        //public static List<PostingJob> GetPendingPostingJobs(int companyId)
        //{
        //    List<PostingJob> pendingJobList = new List<PostingJob>();
        //    try
        //    {
        //        string strErr = "";
        //        CRSDAL dal = new CRSDAL();
        //        dal.AddParameter("p_CompanyID", companyId, ParameterDirection.Input);
        //        dal.AddParameter("p_StatusId", 1, ParameterDirection.Input);
        //        DataSet dstOutPut = dal.ExecuteSelect("spJainTallyGet_PostingStatus", CommandType.StoredProcedure, 0, ref strErr, "p_ErrMessage", false, "", false);
        //        if (dstOutPut != null && dstOutPut.Tables != null && dstOutPut.Tables.Count > 0)
        //        {
        //            for (int j = 0; j < dstOutPut.Tables.Count; j++)
        //            {
        //                if (dstOutPut.Tables[j] != null && dstOutPut.Tables[j].Rows != null && dstOutPut.Tables[j].Rows.Count > 0)
        //                {
        //                    for (int i = 0; i < dstOutPut.Tables[j].Rows.Count; i++)
        //                    {
        //                        PostingJob pJob = new PostingJob();
        //                        pJob.CompanyId = companyId;
        //                        pJob.JobId = Convert.ToInt32(dstOutPut.Tables[j].Rows[i]["jobid"].ToString());
        //                        pJob.JourneyDate = Convert.ToDateTime(dstOutPut.Tables[j].Rows[i]["journeydate"].ToString());
        //                        pendingJobList.Add(pJob);
        //                    }
        //                }
        //            }

        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Logger.WriteLog("PostingStatusAPI", "GetPendingPostingJobs", ex.Message);
        //    }
        //    return pendingJobList;
        //}

        public static List <PostingJob> GetPendingPostingJobsList(int companyId)
        {
            List <PostingJob> pendingJobList = new List <PostingJob>();

            try
            {
                string strErr = "";
                CRSDAL dal    = new CRSDAL();
                dal.AddParameter("p_CompanyID", companyId, ParameterDirection.Input);
                dal.AddParameter("p_StatusId", 1, ParameterDirection.Input);
                DataSet dstOutPut = dal.ExecuteSelect("spTallyGet_PostingStatus_20180130", CommandType.StoredProcedure, 0, ref strErr, "p_ErrMessage", false, "", false);
                if (dstOutPut != null && dstOutPut.Tables != null && dstOutPut.Tables.Count > 0)
                {
                    for (int j = 0; j < dstOutPut.Tables.Count; j++)
                    {
                        if (dstOutPut.Tables[j] != null && dstOutPut.Tables[j].Rows != null && dstOutPut.Tables[j].Rows.Count > 0)
                        {
                            for (int i = 0; i < dstOutPut.Tables[j].Rows.Count; i++)
                            {
                                PostingJob pJob = new PostingJob();
                                pJob.CompanyId   = companyId;
                                pJob.JobId       = Convert.ToInt32(dstOutPut.Tables[j].Rows[i]["jobid"].ToString());
                                pJob.JourneyDate = Convert.ToDateTime(dstOutPut.Tables[j].Rows[i]["journeydate"].ToString());
                                pendingJobList.Add(pJob);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog("PostingStatusAPI", "GetPendingPostingJobs", ex.Message);
            }
            return(pendingJobList);
        }
コード例 #2
0
        public static ValidationResult ValidateData(int companyId, PostingJob pJob)
        {
            ValidationResult vr = new ValidationResult();

            vr.Status = 1;
            try
            {
                Logger.WriteLog("Validation Started...");

                List <IValidate> validationCollection = new List <IValidate>();
                validationCollection.Add(new BranchBooking());
                validationCollection.Add(new OnlineAgentCollection());
                validationCollection.Add(new OfflineAgentCollection());



                for (int i = 0; i < validationCollection.Count; i++)
                {
                    vr = validationCollection[i].Validate(companyId, pJob.JourneyDate);
                    if (vr.Status == 0)
                    {
                        break;
                    }
                }

                Logger.WriteLog("Validation Ended...");
            }
            catch (Exception ex)
            {
                vr.Status       = 0;
                vr.ErrorMessage = vr.ErrorMessage + " Error in ValidateData";
                Logger.WriteLog("PostingCron", "ValidateData", ex.Message);
            }
            return(vr);
        }
コード例 #3
0
        public static void InsertPostingStatus(int companyId, List <PostingJob> postinglist)
        {
            try
            {
                CRSDAL dal    = new CRSDAL();
                string strErr = "";
                // DateTime BookingDate = Convert.ToDateTime(BookingDateTo);

                for (int i = 0; i < postinglist.Count; i++)
                {
                    PostingJob p = postinglist[i];

                    try
                    {
                        dal = new CRSDAL();
                        dal.AddParameter("p_CompanyId", companyId, ParameterDirection.Input);
                        dal.AddParameter("p_JourneyDate", postinglist[i].JourneyDate, ParameterDirection.Input);
                        dal.AddParameter("p_JobId", postinglist[i].JobId, ParameterDirection.Input);
                        dal.AddParameter("p_StatusId", postinglist[i].StatusId, ParameterDirection.Input);
                        dal.AddParameter("p_Remarks", postinglist[i].Remarks, 200, ParameterDirection.Input);
                        dal.AddParameter("p_UserId", 0, ParameterDirection.Input);
                        dal.AddParameter("p_ErrMsg", "", 100, ParameterDirection.Output);


                        int status = dal.ExecuteDML("spTallySet_PostingStatus", CommandType.StoredProcedure, 0, ref strErr);

                        if (strErr != "")
                        {
                            Logger.WriteLog("", "", "Error while upating posting status for CompanyId: " + companyId + "JourneyDate: " + postinglist[i].JourneyDate + " JobId: " + postinglist[i].JobId + " StatusId: " + postinglist[i].StatusId + " Error Is: " + strErr);
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteLog("BookingAPI", "InsertPostingStatus", " Error for JourneyDate: " + postinglist[i].JourneyDate + " " + ex.Message);
                        Logger.WriteLogAlert("BookingAPI " + "Error:InsertPostingStatus For JourneyDate: " + postinglist[i].JourneyDate + " " + ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog("PostingStatusAPI", "InsertPostingStatus", ex.Message);
            }
        }
コード例 #4
0
 public static void UpdatePostingStatus(PostingJob pJob)
 {
     try
     {
         CRSDAL dal    = new CRSDAL();
         string strErr = "";
         dal.AddParameter("p_CompanyId", pJob.CompanyId, ParameterDirection.Input);
         dal.AddParameter("p_JourneyDate", pJob.JourneyDate, ParameterDirection.Input);
         dal.AddParameter("p_JobId", pJob.JobId, ParameterDirection.Input);
         dal.AddParameter("p_StatusId", pJob.StatusId, ParameterDirection.Input);
         dal.AddParameter("p_Remarks", pJob.Remarks, 200, ParameterDirection.Input);
         dal.AddParameter("p_UserId", 0, ParameterDirection.Input);
         dal.AddParameter("p_ErrMsg", "", 100, ParameterDirection.Output);
         int status = dal.ExecuteDML("spTallySet_PostingStatus", CommandType.StoredProcedure, 0, ref strErr);
         if (strErr != "")
         {
             Logger.WriteLog("", "", "Error while upating posting status for CompanyId: " + pJob.CompanyId + "JourneyDate: " + pJob.JourneyDate.ToString("yyyy-MM-dd") + " JobId: " + pJob.JobId + " StatusId: " + pJob.StatusId + " Error Is: " + strErr);
         }
     }
     catch (Exception ex)
     {
         Logger.WriteLog("PostingStatusAPI", "UpdatePostingStatus", ex.Message);
     }
 }