public ActionResult Save(tblChallanDTO tblChallanDTO) { if (ModelState.IsValid) { var resultDuplicateBllNo = ChallanBusinessLogic.CheckDuplicateChallanNo(tblChallanDTO.ChallanId, tblChallanDTO.ChallanNo ?? 0); if (resultDuplicateBllNo) { ModelState.AddModelError("ChallanNo", "Challan no already exists."); } else { if (tblChallanDTO.ChallanId == 0) { tblChallanDTO.ChallanEntryList = (List <tblChallanEntryDTO>)Session["ChallanEntrySession"]; } var result = ChallanBusinessLogic.Save(tblChallanDTO); return(RedirectToAction("Index")); } } return(View(tblChallanDTO)); }
private void btnSave_Click(object sender, EventArgs e) { if (IsFormValidate()) { if (CommonClass.tblChallanEntryDTO.Count() == 0) { MessageBox.Show("Enter Atlease On Challan Entry"); return; } tblChallanDTO dto = new tblChallanDTO(); if (ChallanId > 0) { dto.ChallanId = ChallanId; } dto.ChallanNo = Convert.ToInt32(txtLorryChallenNo.Text); dto.ChallanDateTime = dpChallanDate.Value; dto.VehicleNo = txtVehicleNo.Text; dto.VehicleType = txtVehicleType.Text; dto.VechicleMake = txtMake.Text; dto.VehicleModel = txtModel.Text; dto.VehicleNoOfPointLoading = txtLoading.Text; dto.Vehicle4NoOfPointUnLoading = txtUnloading.Text; dto.VehicleFleetCode = txtCompanyFeetCode.Text; dto.FromBrCode = txtFromBrCode.Text; dto.LoadedForm = txtLoadedFrom.Text; dto.ToBrCode = txtToBrCode.Text; dto.Destination = txtDestination.Text; dto.DistanceKM = txtDistance.Text; dto.ScheduleDateofActual = txtScheduleDateofArrival.Text; dto.VechicleEngineNo = txtVehicleEngineNo.Text; dto.VechicleChassisNo = txtVehicleChassisNo.Text; dto.DriverMobileNo = txtDriverMobileNo.Text; dto.DriverAddress = txtDriverAddress.Text; dto.TaxTokenNo = txtTaxTokenNumber.Text; dto.TaxTokenNoValidUpto = txtTaxtokenValidUpto.Text; dto.DriverLicenseNo = txtDriverLicenceNo.Text; dto.LicenseIssuedFrom = txtIssuedFrom.Text; dto.LicenseValidUpto = txtLicenceValidUpto.Text; dto.VechicleOwnerName = txtOwnerName.Text; dto.RoadPermitNo = txtRoadPermitNumber.Text; dto.RoadPermitValidUpto = txtRoadPermitValidUpto3.Text; dto.VechicleOwnerMobileNo = txtVehicleOwnerMobileMobileNo.Text; dto.VechicleOwnerAddress = txtVehicleOwnerAddress.Text; dto.InsPolicyNo = txtInsPolicyNo.Text; dto.VechicleOwnerPanNo = txtPANNo.Text; dto.VechicleAgentName = txtAgentName.Text; dto.VechicleEngagedByNameWithEmpCode1 = txtEngagedByEmpCode1.Text; dto.VechicleMobileNo = txtAgentMobileNumber.Text; dto.VechicleAgentAddress = txtAgentAddress.Text; dto.VechicleEngagedByNameWithEmpCode2 = txtEngagedByEmpCode2.Text; dto.VechicleFinancierDetails = txtVehicleFinancier.Text; dto.BrokerLoadingAdviceNoDate = txtLoadingAdviceNo.Text; dto.MaterialUnLoadingBy = txtMaterialUnloadingBy.Text; dto.PayableTotalPackages = txtTotalPackageNo.Text.Trim() == "" ? 0 : Convert.ToDouble(txtTotalPackageNo.Text); dto.PayableChargedWeight = txtChargedWeightKg.Text.Trim() == "" ? 0 : Convert.ToDouble(txtChargedWeightKg.Text); dto.PayableRatePerTon = txtRatePerTon.Text.Trim() == "" ? 0 : Convert.ToDouble(txtRatePerTon.Text); dto.TotalLorryHire = txtTotalLorryHire.Text.Trim() == "" ? 0 : Convert.ToDouble(txtTotalLorryHire.Text); dto.ITDSDeduction = txtITDC.Text.Trim() == "" ? 0 : Convert.ToDouble(txtITDC.Text); dto.PartyLorryHire = txtPartLorryHire.Text.Trim() == "" ? 0 : Convert.ToDouble(txtPartLorryHire.Text); dto.BalanceLorryHire = txtBalanceLorryHire.Text.Trim() == "" ? 0 : Convert.ToDouble(txtBalanceLorryHire.Text); dto.ChallanEntryList = CommonClass.tblChallanEntryDTO; var resultDuplicateBllNo = ChallanBusinessLogic.CheckDuplicateChallanNo(ChallanId, Convert.ToInt32(txtLorryChallenNo.Text)); if (resultDuplicateBllNo) { MessageBox.Show("Challan no already exists."); } else { var result = ChallanBusinessLogic.Save(dto); if (result > 0) { if (ChallanId > 0) { this.Close(); } else { clearData(); } } else { MessageBox.Show("Transaction Fail"); } } } }