Example #1
0
        public static string GetNewQuotationNumber(QuotationDb dbContext)
        {
            string quotationNo = string.Empty;
            string errorMessage;
            var    qtndataset = dbContext.LoadComboDetails("QTN", out errorMessage);

            if (qtndataset != null && qtndataset.Tables.Count > 0)
            {
                var qtnDetails   = GetInsuranceDetail(qtndataset.Tables[0]);
                var quotationNos = qtnDetails.Select(q => int.Parse(q.InsuranceQtnNo));
                int max          = 10000;
                if (quotationNos != null && quotationNos.Count() == 0)
                {
                    max = 10000;
                }
                else
                {
                    max = quotationNos.Max();
                }
                quotationNo = (max + 1).ToString();
            }
            else
            {
                quotationNo = "1001";
            }
            return(quotationNo);
        }
Example #2
0
        public async Task <IHttpActionResult> LoadComboDetails(string flag)
        {
            try
            {
                DataSet details = await Task.Run(() => quotationDb.LoadComboDetails(flag));

                if (details == null)
                {
                    return(NotFound());
                }

                return(Ok(details));
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }