public async Task <ActionResult> AddUpdateFCR(FormCollection formCollection)
        {
            try
            {
                int WcIdentificationId       = Convert.ToInt16(formCollection["hdWcIdentificationIdFCR"] + "");
                int WcIdentificationDetailId = Convert.ToInt16(formCollection["hdWcIdentificationDetailsIdFCR"] + "");

                string  FCRApproved    = formCollection["ddlFCRApproved"] + "".Replace("--Select--", "");
                decimal FCRLinedlength = Convert.ToDecimal(formCollection["txtFCRLinedlength"]);
                decimal FCRLined       = Convert.ToDecimal(formCollection["txtFCRLined"]);
                int     FCRTotalCostOfCivilWorksVerified = Convert.ToInt16(formCollection["txtFCRTotalCostOfCivilWorksVerified"]);
                int     FCRLabourShareVerifiedEarthen    = Convert.ToInt16(formCollection["txtFCRLabourShareVerifiedEarthen"]);
                int     FCRLabourShareVerifiedMasonry    = Convert.ToInt16(formCollection["txtFCRLabourShareVerifiedMasonry"]);
                int     FCRTotalSchemeCost = Convert.ToInt16(formCollection["txtFCRTotalSchemeCost"]);
                string  FCRPCPSegmentSize  = formCollection["ddlFCRPCPSegmentSize"] + "".Replace("--Select--", "");

                int FCRPCPSegmentNo     = Convert.ToInt16(formCollection["txtFCRPCPSegmentNo"]);
                int FCRNakkas           = Convert.ToInt16(formCollection["txtFCRNakkas"]);
                int FCRCulverts         = Convert.ToInt16(formCollection["txtFCRCulverts"]);
                int FCRBuffaloWallow    = Convert.ToInt16(formCollection["txtFCRBuffaloWallow"]);
                int FCRDistributionBox  = Convert.ToInt16(formCollection["txtFCRDistributionBox"]);
                int FCRWaterStorageTank = Convert.ToInt16(formCollection["txtFCRWaterStorageTank"]);
                int FCRDropStructure    = Convert.ToInt16(formCollection["txtFCRDropStructure"]);
                int FCROthers           = Convert.ToInt16(formCollection["txtFCROthers"]);

                WcIdentificationDetail wcIdentificationDetail = new WcIdentificationDetail();
                wcIdentificationDetail.WcIdentificationId = WcIdentificationId;
                wcIdentificationDetail.Id = WcIdentificationDetailId;
                wcIdentificationDetail.FCRApprovedStatus          = FCRApproved;
                wcIdentificationDetail.FCRLinedLength             = FCRLinedlength;
                wcIdentificationDetail.LinedPercentage            = FCRLined;
                wcIdentificationDetail.TotalCostOfCivilWrkVerfied = FCRTotalCostOfCivilWorksVerified;
                wcIdentificationDetail.FCREarthenWorks            = FCRLabourShareVerifiedEarthen;
                wcIdentificationDetail.FCRMasonryWorks            = FCRLabourShareVerifiedMasonry;
                wcIdentificationDetail.TotalSchemeCost            = FCRTotalSchemeCost;
                wcIdentificationDetail.FCRPcpSegmentSize          = FCRPCPSegmentSize;
                wcIdentificationDetail.FCRPcpSegment       = FCRPCPSegmentNo;
                wcIdentificationDetail.FCRNakkas           = FCRNakkas;
                wcIdentificationDetail.FCRCulverts         = FCRCulverts;
                wcIdentificationDetail.FCRBuffaloWallow    = FCRBuffaloWallow;
                wcIdentificationDetail.FCRDistributionBox  = FCRDistributionBox;
                wcIdentificationDetail.FCRWaterStorageTank = FCRWaterStorageTank;
                wcIdentificationDetail.FCRDropStructure    = FCRDropStructure;
                wcIdentificationDetail.FCROthers           = FCROthers;


                IWaterCourseService waterCourseService = new WaterCourseService();
                var response = await waterCourseService.AddUpdateFCR(wcIdentificationDetail);

                if (response.ResponseCode == Entities.EnumStatus.Success)
                {
                }

                return(Json(new { FormId = 0, HttpStatusCode = (int)HttpStatusCode.OK }));
            }
            catch (Exception)
            {
                return(Json(new { FormId = 0, HttpStatusCode = HttpStatusCode.NotImplemented }));
            }
        }
        public async Task <ActionResult> AddUpdateICR1AndICR2(FormCollection formCollection)
        {
            try
            {
                int WcIdentificationId       = Convert.ToInt16(formCollection["hdWcIdentificationIdICR"]);
                int WcIdentificationDetailId = Convert.ToInt16(formCollection["hdWcIdentificationDetailsIdICR"]);

                string  ICR1Approved       = formCollection["ddlICR1"] + "".Replace("--Select--", "");
                decimal ICR1ReleasedAmount = Convert.ToDecimal(formCollection["txtICR1ReleasedAmount"]);
                string  ICR2Approved       = formCollection["ddlICR2"] + "".Replace("--Select--", "");
                decimal ICR2ReleasedAmount = Convert.ToDecimal(formCollection["txtICR2ReleasedAmount"]);

                WcIdentificationDetail wcIdentificationDetail = new WcIdentificationDetail();
                wcIdentificationDetail.WcIdentificationId = WcIdentificationId;
                wcIdentificationDetail.Id = WcIdentificationDetailId;
                wcIdentificationDetail.ICR1ApprovedStatus = ICR1Approved;
                wcIdentificationDetail.ICR1ReleasedAmount = ICR1ReleasedAmount;
                wcIdentificationDetail.ICR2ApprovedStatus = ICR2Approved;
                wcIdentificationDetail.ICR2ReleasedAmount = ICR2ReleasedAmount;

                IWaterCourseService waterCourseService = new WaterCourseService();
                var response = await waterCourseService.AddUpdateICR1AndICR2(wcIdentificationDetail);

                if (response.ResponseCode == Entities.EnumStatus.Success)
                {
                }

                return(Json(new { FormId = 0, HttpStatusCode = (int)HttpStatusCode.OK }));
            }
            catch (Exception)
            {
                return(Json(new { FormId = 0, HttpStatusCode = HttpStatusCode.NotImplemented }));
            }
        }
        public async Task <ActionResult> AddUpdateDesignParameters(FormCollection formCollection)
        {
            try
            {
                int WcIdentificationId       = Convert.ToInt16(formCollection["hdWcIdentificationIdDP"]);
                int WcIdentificationDetailId = Convert.ToInt16(formCollection["hdWcIdentificationDetailsIdDP"]);

                string  DesignApproved          = formCollection["ddlDesignApproved"] + "".Replace("--Select--", "");
                decimal TSAmount                = Convert.ToDecimal(formCollection["txtTSAmount"]);
                decimal LabourShareEarthenWorks = Convert.ToDecimal(formCollection["txtLabourShareEarthenWorks"]);
                decimal LabourShareMasonryWorks = Convert.ToDecimal(formCollection["txtLabourShareMasonryWorks"]);
                string  LiningType              = formCollection["ddlLiningType"] + "".Replace("--Select--", "");
                decimal EarthenLength           = Convert.ToDecimal(formCollection["txtEarthenLength"]);
                decimal LiningLength            = Convert.ToDecimal(formCollection["txtLiningLength"]);
                string  PCPSegmentSize          = formCollection["ddlPCPSegmentSize"] + "".Replace("--Select--", "");
                int     PCPSegment              = Convert.ToInt16(formCollection["txtPCPSegment"]);
                int     Nakkas           = Convert.ToInt16(formCollection["txtNakkas"]);
                int     Culverts         = Convert.ToInt16(formCollection["txtCulverts"]);
                int     BuffaloWallow    = Convert.ToInt16(formCollection["txtBuffaloWallow"]);
                int     DistributionBox  = Convert.ToInt16(formCollection["txtDistributionBox"]);
                int     WaterStorageTank = Convert.ToInt16(formCollection["txtWaterStorageTank"]);
                int     DropStructure    = Convert.ToInt16(formCollection["txtDropStructure"]);
                int     Others           = Convert.ToInt16(formCollection["txtOthers"]);

                WcIdentificationDetail wcIdentificationDetail = new WcIdentificationDetail();
                wcIdentificationDetail.WcIdentificationId = WcIdentificationId;
                wcIdentificationDetail.Id             = WcIdentificationDetailId;
                wcIdentificationDetail.DesignApproved = DesignApproved;
                wcIdentificationDetail.MaterialCost   = TSAmount;
                wcIdentificationDetail.EarthenWorks   = LabourShareEarthenWorks;
                wcIdentificationDetail.MasonryWorks   = LabourShareMasonryWorks;
                //wcIdentificationDetail.LiningType = LiningType;
                wcIdentificationDetail.EarthenLengthM   = EarthenLength;
                wcIdentificationDetail.LiningLengthM    = LiningLength;
                wcIdentificationDetail.PcpSegmentSize   = PCPSegmentSize;
                wcIdentificationDetail.PcpSegment       = PCPSegment;
                wcIdentificationDetail.Nakkas           = Nakkas;
                wcIdentificationDetail.Culverts         = Culverts;
                wcIdentificationDetail.BuffaloWallow    = BuffaloWallow;
                wcIdentificationDetail.DistributionBox  = DistributionBox;
                wcIdentificationDetail.WaterStorageTank = WaterStorageTank;
                wcIdentificationDetail.DropStructure    = DropStructure;
                wcIdentificationDetail.Others           = Others;

                IWaterCourseService waterCourseService = new WaterCourseService();
                var response = await waterCourseService.AddUpdateDesignParameters(wcIdentificationDetail);

                if (response.ResponseCode == Entities.EnumStatus.Success)
                {
                }

                return(Json(new { FormId = 0, HttpStatusCode = (int)HttpStatusCode.OK }));
            }
            catch (Exception)
            {
                return(Json(new { FormId = 0, HttpStatusCode = HttpStatusCode.NotImplemented }));
            }
        }
示例#4
0
        /// <summary>
        /// Step4: Add Update FCR
        /// </summary>
        /// <param name="wcIdentificationDetail"></param>
        /// <returns></returns>
        public async Task <WmsdsResponse <int> > AddUpdateFCR(WcIdentificationDetail wcIdentificationDetail)
        {
            var wmsdResponse = new WmsdsResponse <int>();

            if (wcIdentificationDetail == null)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Object is empty.";
                return(wmsdResponse);
            }

            if (wcIdentificationDetail.WcIdentificationId <= 0)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Parent Identification key is empty.";
                return(wmsdResponse);
            }
            if (wcIdentificationDetail.Id <= 0)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Id is missing.";
                return(wmsdResponse);
            }

            try
            {
                using (var _dbContext = new EntityContext())
                {
                    var basicInfoDb = await _dbContext.WcIdentificationDetails
                                      .Where(c => c.Id == wcIdentificationDetail.Id &&
                                             c.WcIdentificationId == wcIdentificationDetail.WcIdentificationId)
                                      .SingleOrDefaultAsync();

                    if (basicInfoDb != null)
                    {
                        basicInfoDb.FCRApprovedStatus = string.IsNullOrEmpty(wcIdentificationDetail.FCRApprovedStatus)
                            ? basicInfoDb.FCRApprovedStatus : wcIdentificationDetail.FCRApprovedStatus;

                        basicInfoDb.FCRLinedLength = wcIdentificationDetail.FCRLinedLength <= 0
                            ? basicInfoDb.FCRLinedLength : wcIdentificationDetail.FCRLinedLength;

                        basicInfoDb.LinedPercentage = wcIdentificationDetail.LinedPercentage <= 0
                            ? basicInfoDb.LinedPercentage : wcIdentificationDetail.LinedPercentage;

                        basicInfoDb.TotalCostOfCivilWrkVerfied = wcIdentificationDetail.TotalCostOfCivilWrkVerfied <= 0
                             ? basicInfoDb.TotalCostOfCivilWrkVerfied : wcIdentificationDetail.TotalCostOfCivilWrkVerfied;


                        basicInfoDb.FCREarthenWorks = wcIdentificationDetail.FCREarthenWorks <= 0
                             ? basicInfoDb.FCREarthenWorks : wcIdentificationDetail.FCREarthenWorks;

                        basicInfoDb.FCRMasonryWorks = wcIdentificationDetail.FCRMasonryWorks <= 0
                             ? basicInfoDb.FCRMasonryWorks : wcIdentificationDetail.FCRMasonryWorks;

                        basicInfoDb.TotalSchemeCost = wcIdentificationDetail.TotalSchemeCost <= 0
                             ? basicInfoDb.TotalSchemeCost : wcIdentificationDetail.TotalSchemeCost;

                        basicInfoDb.FCRPcpSegmentSize = string.IsNullOrEmpty(wcIdentificationDetail.FCRPcpSegmentSize)
                             ? basicInfoDb.FCRPcpSegmentSize : wcIdentificationDetail.FCRPcpSegmentSize;

                        basicInfoDb.FCRPcpSegment = wcIdentificationDetail.FCRPcpSegment <= 0
                             ? basicInfoDb.FCRPcpSegment : wcIdentificationDetail.FCRPcpSegment;

                        basicInfoDb.FCRPipeType = string.IsNullOrEmpty(wcIdentificationDetail.FCRPipeType)
                             ? basicInfoDb.FCRPipeType : wcIdentificationDetail.FCRPipeType;

                        basicInfoDb.FCRSizeOfPipeInch = wcIdentificationDetail.FCRSizeOfPipeInch <= 0
                             ? basicInfoDb.FCRSizeOfPipeInch : wcIdentificationDetail.FCRSizeOfPipeInch;

                        basicInfoDb.FCRLengthOfPipeM = wcIdentificationDetail.FCRLengthOfPipeM <= 0
                             ? basicInfoDb.FCRLengthOfPipeM : wcIdentificationDetail.FCRLengthOfPipeM;


                        basicInfoDb.FCRNakkas = wcIdentificationDetail.FCRNakkas <= 0
                             ? basicInfoDb.FCRNakkas : wcIdentificationDetail.FCRNakkas;

                        basicInfoDb.FCRCulverts = wcIdentificationDetail.FCRCulverts <= 0
                             ? basicInfoDb.FCRCulverts : wcIdentificationDetail.FCRCulverts;

                        basicInfoDb.FCRBuffaloWallow = wcIdentificationDetail.FCRBuffaloWallow <= 0
                             ? basicInfoDb.FCRBuffaloWallow : wcIdentificationDetail.FCRBuffaloWallow;

                        basicInfoDb.FCRDistributionBox = wcIdentificationDetail.FCRDistributionBox <= 0
                             ? basicInfoDb.FCRDistributionBox : wcIdentificationDetail.FCRDistributionBox;

                        basicInfoDb.FCRWaterStorageTank = wcIdentificationDetail.FCRWaterStorageTank <= 0
                             ? basicInfoDb.FCRWaterStorageTank : wcIdentificationDetail.FCRWaterStorageTank;

                        basicInfoDb.FCRDropStructure = wcIdentificationDetail.FCRDropStructure <= 0
                             ? basicInfoDb.FCRDropStructure : wcIdentificationDetail.FCRDropStructure;

                        basicInfoDb.FCROthers = wcIdentificationDetail.FCROthers <= 0
                             ? basicInfoDb.FCROthers : wcIdentificationDetail.FCROthers;


                        var response = await _dbContext.SaveChangesAsync();

                        if (response > 0)
                        {
                            wmsdResponse.ResponseCode    = EnumStatus.Success;;
                            wmsdResponse.ResponseMessage = "Record has been updated successfully.";
                            return(wmsdResponse);
                        }
                        else
                        {
                            wmsdResponse.ResponseCode    = EnumStatus.Failed;;
                            wmsdResponse.ResponseMessage = "Failed to update record.";
                            return(wmsdResponse);
                        }
                    }
                    else
                    {
                        wmsdResponse.ResponseCode    = EnumStatus.NotFound;;
                        wmsdResponse.ResponseMessage = "No Record found against given Ids.";
                        return(wmsdResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                wmsdResponse.ResponseCode    = EnumStatus.InternalServer;
                wmsdResponse.ResponseMessage = ex.Message;
                return(wmsdResponse);
            }
        }
示例#5
0
        /// <summary>
        /// Step3: Add/Update ICR1 & ICR2
        /// </summary>
        /// <param name="wcIdentificationDetail"></param>
        /// <returns></returns>
        public async Task <WmsdsResponse <int> > AddUpdateICR1AndICR2(WcIdentificationDetail wcIdentificationDetail)
        {
            var wmsdResponse = new WmsdsResponse <int>();

            if (wcIdentificationDetail == null)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Object is empty.";
                return(wmsdResponse);
            }

            if (wcIdentificationDetail.WcIdentificationId <= 0)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Parent Identification key is empty.";
                return(wmsdResponse);
            }
            if (wcIdentificationDetail.Id <= 0)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Id is missing.";
                return(wmsdResponse);
            }

            try
            {
                using (var _dbContext = new EntityContext())
                {
                    var basicInfoDb = await _dbContext.WcIdentificationDetails
                                      .Where(c => c.Id == wcIdentificationDetail.Id &&
                                             c.WcIdentificationId == wcIdentificationDetail.WcIdentificationId)
                                      .SingleOrDefaultAsync();

                    if (basicInfoDb != null)
                    {
                        basicInfoDb.ICR1ApprovedStatus = string.IsNullOrEmpty(wcIdentificationDetail.ICR1ApprovedStatus)
                            ? basicInfoDb.ICR1ApprovedStatus : wcIdentificationDetail.ICR1ApprovedStatus;

                        basicInfoDb.ICR1ReleasedAmount = wcIdentificationDetail.ICR1ReleasedAmount <= 0
                            ? basicInfoDb.ICR1ReleasedAmount : wcIdentificationDetail.ICR1ReleasedAmount;

                        basicInfoDb.ICR2ApprovedStatus = string.IsNullOrEmpty(wcIdentificationDetail.ICR2ApprovedStatus)
                            ? basicInfoDb.ICR2ApprovedStatus : wcIdentificationDetail.ICR2ApprovedStatus;

                        basicInfoDb.ICR2ReleasedAmount = wcIdentificationDetail.ICR2ReleasedAmount <= 0
                             ? basicInfoDb.ICR2ReleasedAmount : wcIdentificationDetail.ICR2ReleasedAmount;


                        var response = await _dbContext.SaveChangesAsync();

                        if (response > 0)
                        {
                            wmsdResponse.ResponseCode    = EnumStatus.Success;;
                            wmsdResponse.ResponseMessage = "Record has been updated successfully.";
                            return(wmsdResponse);
                        }
                        else
                        {
                            wmsdResponse.ResponseCode    = EnumStatus.Failed;;
                            wmsdResponse.ResponseMessage = "Failed to update record.";
                            return(wmsdResponse);
                        }
                    }
                    else
                    {
                        wmsdResponse.ResponseCode    = EnumStatus.NotFound;;
                        wmsdResponse.ResponseMessage = "No Record found against given Ids.";
                        return(wmsdResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                wmsdResponse.ResponseCode    = EnumStatus.InternalServer;
                wmsdResponse.ResponseMessage = ex.Message;
                return(wmsdResponse);
            }
        }
示例#6
0
        /// <summary>
        /// Step1: Update BasicInformation
        /// </summary>
        /// <param name="wcIdentificationDetail"></param>
        /// <returns></returns>
        public async Task <WmsdsResponse <int> > UpdateBasicInformation(WcIdentificationDetail wcIdentificationDetail)
        {
            var wmsdResponse = new WmsdsResponse <int>();

            if (wcIdentificationDetail == null)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Object is empty.";
                return(wmsdResponse);
            }

            if (wcIdentificationDetail.WcIdentificationId <= 0)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Parent Identification key is empty.";
                return(wmsdResponse);
            }
            if (wcIdentificationDetail.Id <= 0)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Id is missing.";
                return(wmsdResponse);
            }

            try
            {
                using (var _dbContext = new EntityContext())
                {
                    var basicInfoDb = await _dbContext.WcIdentificationDetails
                                      .Where(c => c.Id == wcIdentificationDetail.Id &&
                                             c.WcIdentificationId == wcIdentificationDetail.WcIdentificationId)
                                      .SingleOrDefaultAsync();

                    if (basicInfoDb != null)
                    {
                        basicInfoDb.ProjectId = wcIdentificationDetail.ProjectId <= 0
                            ? basicInfoDb.ProjectId: wcIdentificationDetail.ProjectId;

                        basicInfoDb.ProjectName = string.IsNullOrEmpty(wcIdentificationDetail.ProjectName)
                            ? basicInfoDb.ProjectName : wcIdentificationDetail.ProjectName;

                        basicInfoDb.VillageName = string.IsNullOrEmpty(wcIdentificationDetail.VillageName)
                            ? basicInfoDb.VillageName : wcIdentificationDetail.VillageName;

                        basicInfoDb.UC = string.IsNullOrEmpty(wcIdentificationDetail.UC)
                             ? basicInfoDb.UC : wcIdentificationDetail.UC;

                        basicInfoDb.GCA = wcIdentificationDetail.GCA <= 0
                              ? basicInfoDb.GCA : wcIdentificationDetail.GCA;

                        basicInfoDb.CCA = wcIdentificationDetail.CCA <= 0
                              ? basicInfoDb.CCA : wcIdentificationDetail.CCA;

                        basicInfoDb.SanctionedDischargeLPS = wcIdentificationDetail.SanctionedDischargeLPS <= 0
                             ? basicInfoDb.SanctionedDischargeLPS : wcIdentificationDetail.SanctionedDischargeLPS;

                        basicInfoDb.DesignDischargeLPS = wcIdentificationDetail.DesignDischargeLPS <= 0
                             ? basicInfoDb.DesignDischargeLPS : wcIdentificationDetail.DesignDischargeLPS;

                        basicInfoDb.MoghaType = string.IsNullOrEmpty(wcIdentificationDetail.MoghaType)
                             ? basicInfoDb.MoghaType : wcIdentificationDetail.MoghaType;

                        basicInfoDb.GroundwaterQuality = string.IsNullOrEmpty(wcIdentificationDetail.GroundwaterQuality)
                              ? basicInfoDb.GroundwaterQuality : wcIdentificationDetail.GroundwaterQuality;

                        basicInfoDb.WUAChairman = string.IsNullOrEmpty(wcIdentificationDetail.WUAChairman)
                               ? basicInfoDb.WUAChairman : wcIdentificationDetail.WUAChairman;

                        basicInfoDb.NoOfBeneficiaries = wcIdentificationDetail.NoOfBeneficiaries <= 0
                                ? basicInfoDb.NoOfBeneficiaries : wcIdentificationDetail.NoOfBeneficiaries;

                        basicInfoDb.TotalLengthM = wcIdentificationDetail.TotalLengthM <= 0
                                ? basicInfoDb.TotalLengthM : wcIdentificationDetail.TotalLengthM;

                        basicInfoDb.PreviousLinedLengthM = wcIdentificationDetail.PreviousLinedLengthM <= 0
                                ? basicInfoDb.PreviousLinedLengthM : wcIdentificationDetail.PreviousLinedLengthM;

                        basicInfoDb.Latitude = wcIdentificationDetail.Latitude <= 0
                                ? basicInfoDb.Latitude : wcIdentificationDetail.Latitude;

                        basicInfoDb.Longitude = wcIdentificationDetail.Longitude <= 0
                                ? basicInfoDb.Longitude : wcIdentificationDetail.Longitude;

                        var response = await _dbContext.SaveChangesAsync();

                        if (response > 0)
                        {
                            wmsdResponse.ResponseCode    = EnumStatus.Success;;
                            wmsdResponse.ResponseMessage = "Record has been added successfully.";
                            return(wmsdResponse);
                        }
                        else
                        {
                            wmsdResponse.ResponseCode    = EnumStatus.Failed;;
                            wmsdResponse.ResponseMessage = "Failed to update record.";
                            return(wmsdResponse);
                        }
                    }
                    else
                    {
                        wmsdResponse.ResponseCode    = EnumStatus.NotFound;;
                        wmsdResponse.ResponseMessage = "No Record found against given Ids.";
                        return(wmsdResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                wmsdResponse.ResponseCode    = EnumStatus.InternalServer;
                wmsdResponse.ResponseMessage = ex.Message;
                return(wmsdResponse);
            }
        }
示例#7
0
        //TODO: Add Step wise status in detail
        /// <summary>
        /// Step1: Add BasicInformation
        /// </summary>
        /// <param name="wcIdentificationDetail"></param>
        /// <returns></returns>
        public async Task <WmsdsResponse <WcIdentificationDetail> > AddBasicInformation(WcIdentificationDetail wcIdentificationDetail)
        {
            var wmsdResponse = new WmsdsResponse <WcIdentificationDetail>();

            if (wcIdentificationDetail == null)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Object is empty.";
                return(wmsdResponse);
            }

            if (wcIdentificationDetail.WcIdentificationId <= 0)
            {
                wmsdResponse.ResponseCode    = EnumStatus.EmptyObject;
                wmsdResponse.ResponseMessage = "Parent Identification key is empty.";
                return(wmsdResponse);
            }

            try
            {
                using (var _dbContext = new EntityContext())
                {
                    _dbContext.WcIdentificationDetails.Add(wcIdentificationDetail);
                    var response = await _dbContext.SaveChangesAsync();

                    if (response > 0)
                    {
                        wmsdResponse.ResponseCode    = EnumStatus.Success;
                        wmsdResponse.DataObject      = new WcIdentificationDetail();
                        wmsdResponse.DataObject.Id   = wcIdentificationDetail.Id;
                        wmsdResponse.ResponseMessage = "Record has been added successfully.";
                        return(wmsdResponse);
                    }
                    else
                    {
                        wmsdResponse.ResponseCode    = EnumStatus.Failed;;
                        wmsdResponse.ResponseMessage = "Failed to update record.";
                        return(wmsdResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                wmsdResponse.ResponseCode    = EnumStatus.InternalServer;
                wmsdResponse.ResponseMessage = ex.Message;
                return(wmsdResponse);
            }
        }
        public async Task <ActionResult> AddUpdateWatercourseDetails(FormCollection formCollection)
        {
            try
            {
                int WcIdentificationId       = Convert.ToInt16(formCollection["hdWcIdentificationIdBI"]);
                int WcIdentificationDetailId = Convert.ToInt16(formCollection["hdWcIdentificationDetailsIdBI"]);

                int    ImprovementYearId = Convert.ToInt16(formCollection["ddlImprovementYear"]);
                string ImprovementType   = formCollection["ddlImprovementType"] + "";

                double  Latitude             = Convert.ToDouble(formCollection["txtLatitude"]);
                double  Longitude            = Convert.ToDouble(formCollection["txtLongitude"]);
                string  ProjectName          = formCollection["ddlProjectName"] + "".Replace("--Select--", "");
                string  VillageName          = formCollection["txtVillageName"] + "";
                string  UC                   = formCollection["txtUC"] + "";
                decimal GCA                  = Convert.ToDecimal(formCollection["txtGCA"]);
                decimal CCA                  = Convert.ToDecimal(formCollection["txtCCA"]);
                decimal SanctionedDischarge  = Convert.ToDecimal(formCollection["txtSanctionedDischarge"]);
                decimal DesignDischarge      = Convert.ToDecimal(formCollection["txtDesignDischarge"]);
                string  MoghaType            = formCollection["ddlMoghaType"] + "".Replace("--Select--", "");
                string  GroundwaterQuality   = formCollection["ddlGroundwaterQuality"] + "".Replace("--Select--", "");
                string  NameOfWUAChairman    = formCollection["txtNameOfWUAChairman"] + "";
                string  ContactOfWUAChairman = formCollection["txtContactOfWUAChairman"] + "";
                int     NoOfBeneficiaries    = Convert.ToInt16(formCollection["txtNoOfBeneficiaries"]);
                decimal TotalLength          = Convert.ToDecimal(formCollection["txtTotalLength"]);

                WcIdentificationDetail wcIdentificationDetail = new WcIdentificationDetail();
                wcIdentificationDetail.WcIdentificationId = WcIdentificationId;
                wcIdentificationDetail.Id                     = WcIdentificationDetailId;
                wcIdentificationDetail.Latitude               = Latitude;
                wcIdentificationDetail.Longitude              = Longitude;
                wcIdentificationDetail.ProjectName            = ProjectName;
                wcIdentificationDetail.VillageName            = VillageName;
                wcIdentificationDetail.UC                     = UC;
                wcIdentificationDetail.GCA                    = GCA;
                wcIdentificationDetail.CCA                    = CCA;
                wcIdentificationDetail.SanctionedDischargeLPS = SanctionedDischarge;
                wcIdentificationDetail.DesignDischargeLPS     = DesignDischarge;
                wcIdentificationDetail.MoghaType              = MoghaType;
                wcIdentificationDetail.GroundwaterQuality     = GroundwaterQuality;
                wcIdentificationDetail.WUAChairman            = NameOfWUAChairman;
                wcIdentificationDetail.ChairmanContactNo      = ContactOfWUAChairman;
                wcIdentificationDetail.TotalLengthM           = TotalLength;
                wcIdentificationDetail.ImprovementYearId      = ImprovementYearId;
                wcIdentificationDetail.ImprovementType        = ImprovementType;



                IWaterCourseService waterCourseService = new WaterCourseService();
                var response       = new WmsdsResponse <WcIdentificationDetail>();
                var responseUpdate = new WmsdsResponse <int>();
                if (WcIdentificationDetailId == 0)
                {
                    response = await waterCourseService.AddBasicInformation(wcIdentificationDetail);

                    return(Json(response, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    responseUpdate = await waterCourseService.UpdateBasicInformation(wcIdentificationDetail);

                    return(Json(responseUpdate, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception)
            {
                return(Json(new { FormId = 0, HttpStatusCode = HttpStatusCode.NotImplemented }));
            }
        }