Ejemplo n.º 1
0
        public async Task <CostsheetVerSetRes> UpdateCostsheetVersion(CostsheetVerSetReq costsheetVerSetReq, string ticket)
        {
            CostsheetVerSetRes costsheetVerSetRes = new CostsheetVerSetRes();

            costsheetVerSetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceCostsheet:UpdateCostsheetVersion"), costsheetVerSetReq, typeof(CostsheetVerSetRes), ticket);

            return(costsheetVerSetRes);
        }
Ejemplo n.º 2
0
        public JsonResult UpdateCostsheetVersion(string QRFID, string QRFPriceId)
        {
            CostsheetVerSetRes response = new CostsheetVerSetRes();
            CostsheetVerSetReq request  = new CostsheetVerSetReq();

            request.QRFID       = QRFID;
            request.QRFPriceId  = QRFPriceId;
            request.Create_User = ckUserEmailId;
            response            = coProviders.UpdateCostsheetVersion(request, token).Result;

            if (response != null)
            {
                return(Json(response.ResponseStatus));
            }
            return(Json("failure"));
        }
Ejemplo n.º 3
0
        public JsonResult SetCostsheetNewVersion(string QRFID, string Pipeline)
        {
            CostsheetVerSetRes response = new CostsheetVerSetRes();
            CostsheetVerSetReq request  = new CostsheetVerSetReq();

            request.QRFID       = QRFID;
            request.Pipeline    = Pipeline;
            request.Create_User = ckUserEmailId;
            response            = coProviders.SetCostsheetNewVersion(request, token).Result;

            if (response != null)
            {
                return(Json(response.ResponseStatus));
            }
            return(Json("failure"));
        }
Ejemplo n.º 4
0
        public async Task <CostsheetVerSetRes> SetCostsheetNewVersion([FromBody] CostsheetVerSetReq request)
        {
            var response = new CostsheetVerSetRes();

            try
            {
                if (!string.IsNullOrEmpty(request.QRFID) && request != null)
                {
                    if (request.Pipeline == "Guesstimate")
                    {
                        response.QRFPrice_Id = await _qRFSummaryRepository.SaveQRFPrice("Guesstimate", "Regenerated from Guesstimate", request.QRFID, request.Create_User);

                        response.ResponseStatus.Status       = !String.IsNullOrEmpty(response.QRFPrice_Id) ? "Success" : "Failure";
                        response.ResponseStatus.ErrorMessage = !String.IsNullOrEmpty(response.QRFPrice_Id) ? "Costsheet Data Saved Successfully." : "Details not updated.";
                    }
                    else if (request.Pipeline == "Amendment")
                    {
                        await _qRFSummaryRepository.SaveDefaultGuesstimate(request.QRFID, "Amendment", "Regenerated from Amendment", request.Create_User);

                        response.QRFPrice_Id = await _qRFSummaryRepository.SaveQRFPrice("Amendment", "Regenerated from Amendment", request.QRFID, request.Create_User);

                        await _qRFSummaryRepository.SaveDefaultItinerary(request.Create_User, request.QRFID, "", true);

                        response.ResponseStatus.Status       = !String.IsNullOrEmpty(response.QRFPrice_Id) ? "Success" : "Failure";
                        response.ResponseStatus.ErrorMessage = !String.IsNullOrEmpty(response.QRFPrice_Id) ? "Costsheet Data Saved Successfully." : "Details not updated.";
                    }
                }
                else
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "QRFId can not be Null/Zero.";
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message;
            }

            return(response);
        }
Ejemplo n.º 5
0
        public async Task <CostsheetVerSetRes> UpdateCostsheetVersion(CostsheetVerSetReq request)
        {
            CostsheetVerSetRes response = new CostsheetVerSetRes();

            try
            {
                List <mQRFPrice> qrfPriceList;
                qrfPriceList = _MongoContext.mQRFPrice.AsQueryable().Where(a => a.QRFID == request.QRFID && a.IsCurrentVersion == true).ToList();

                foreach (var objqrfprice in qrfPriceList)
                {
                    objqrfprice.IsCurrentVersion = false;
                    objqrfprice.EditUser         = request.Create_User;
                    objqrfprice.EditDate         = DateTime.Now;
                    ReplaceOneResult replaceResult = await _MongoContext.mQRFPrice.ReplaceOneAsync(Builders <mQRFPrice> .Filter.Eq("QRFPrice_Id", objqrfprice.QRFPrice_Id), objqrfprice);

                    response.ResponseStatus.Status       = replaceResult.MatchedCount > 0 ? "Success" : "Failure";
                    response.ResponseStatus.ErrorMessage = replaceResult.MatchedCount > 0 ? "Saved Successfully." : "Details not updated.";
                }

                mQRFPrice qrfPriceNew;
                qrfPriceNew = _MongoContext.mQRFPrice.AsQueryable().Where(a => a.QRFID == request.QRFID && a.QRFPrice_Id == request.QRFPriceId).FirstOrDefault();

                qrfPriceNew.IsCurrentVersion = true;
                qrfPriceNew.EditUser         = request.Create_User;
                qrfPriceNew.EditDate         = DateTime.Now;
                ReplaceOneResult replaceResultNew = await _MongoContext.mQRFPrice.ReplaceOneAsync(Builders <mQRFPrice> .Filter.Eq("QRFPrice_Id", qrfPriceNew.QRFPrice_Id), qrfPriceNew);

                response.ResponseStatus.Status       = replaceResultNew.MatchedCount > 0 ? "Success" : "Failure";
                response.ResponseStatus.ErrorMessage = replaceResultNew.MatchedCount > 0 ? "Version changed Successfully." : "Version not changed.";
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = ex.Message;
            }
            return(response);
        }
Ejemplo n.º 6
0
        public async Task <CostsheetVerSetRes> UpdateCostsheetVersion([FromBody] CostsheetVerSetReq request)
        {
            var response = new CostsheetVerSetRes();

            try
            {
                if (!string.IsNullOrEmpty(request.QRFID))
                {
                    response = await _costSheetRepository.UpdateCostsheetVersion(request);
                }
                else
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "Details can not be blank.";
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message;
            }
            return(response);
        }