private tblConsignmentNoteDTO FillDropDown(tblConsignmentNoteDTO tblConsignmentNoteDTO)
        {
            var partyList = ConsignorBusinessLogic.GetAll();

            foreach (var item in partyList)
            {
                item.PartyNameWithCode = item.Code + "-" + item.ConsignorName;
            }
            tblConsignmentNoteDTO.ConsigneeList = partyList.Where(type => type.Type == 1).ToList();
            tblConsignmentNoteDTO.ConsignorList = partyList.Where(type => type.Type == 2).ToList();

            //-------------------
            tblConsignmentNoteDTO.ServiceTaxisPayableByList = new List <SelectListItem>();
            tblConsignmentNoteDTO.ServiceTaxisPayableByList.Add(new SelectListItem {
                Value = "CONSIGNOR", Text = "CONSIGNOR"
            });
            tblConsignmentNoteDTO.ServiceTaxisPayableByList.Add(new SelectListItem {
                Value = "CONSIGNEE", Text = "CONSIGNEE"
            });
            tblConsignmentNoteDTO.ServiceTaxisPayableByList.Add(new SelectListItem {
                Value = "Transport", Text = "Transport"
            });

            return(tblConsignmentNoteDTO);
        }
        public ActionResult Save(int id)
        {
            tblConsignmentNoteDTO tblConsignmentNoteDTO;

            if (id == 0)
            {
                tblConsignmentNoteDTO = new tblConsignmentNoteDTO();
            }
            else
            {
                tblConsignmentNoteDTO = ConsignmentNoteBusinessLogic.Get(id);
            }
            tblConsignmentNoteDTO = FillDropDown(tblConsignmentNoteDTO);
            return(View(tblConsignmentNoteDTO));
        }
        public ActionResult Save(tblConsignmentNoteDTO tblConsignmentNoteDTO)
        {
            if (ModelState.IsValid)
            {
                var resultCheckDuplicateConsignmentNoteNo = ConsignmentNoteBusinessLogic.CheckDuplicateConsignmentNoteNo(tblConsignmentNoteDTO.ConsignmentId, tblConsignmentNoteDTO.ConsignmentNoteNo ?? 0);
                if (resultCheckDuplicateConsignmentNoteNo)
                {
                    ModelState.AddModelError("ConsignmentNoteNo", "Consignment Note No already exists.");
                }
                else
                {
                    tblConsignmentNoteDTO.FinalAmount = (tblConsignmentNoteDTO.Amount1
                                                         + tblConsignmentNoteDTO.Amount2
                                                         + tblConsignmentNoteDTO.Amount3
                                                         + tblConsignmentNoteDTO.Amount4
                                                         + tblConsignmentNoteDTO.Amount5);

                    var result = ConsignmentNoteBusinessLogic.Save(tblConsignmentNoteDTO);
                    return(RedirectToAction("Index"));
                }
            }
            tblConsignmentNoteDTO = FillDropDown(tblConsignmentNoteDTO);
            return(View(tblConsignmentNoteDTO));
        }
Beispiel #4
0
 public static int Save(tblConsignmentNoteDTO tblConsignmentNoteDTO)
 {
     return(ConsignmentNoteRepository.Save(tblConsignmentNoteDTO));
 }
Beispiel #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                if (txtAmount1.Text.Trim() == "")
                {
                    txtAmount1.Text = "0";
                }
                if (txtAmount2.Text.Trim() == "")
                {
                    txtAmount2.Text = "0";
                }
                if (txtAmount3.Text.Trim() == "")
                {
                    txtAmount3.Text = "0";
                }
                if (txtAmount4.Text.Trim() == "")
                {
                    txtAmount4.Text = "0";
                }
                if (txtAmount5.Text.Trim() == "")
                {
                    txtAmount5.Text = "0";
                }

                tblConsignmentNoteDTO consignNoteDTO = new tblConsignmentNoteDTO();
                consignNoteDTO.CompanyName              = txtCompanyName.Text;
                consignNoteDTO.PolicyNo                 = txtPolicyNo.Text;
                consignNoteDTO.CompanyDate              = Convert.ToDateTime(dpCompanyDate.Value);
                consignNoteDTO.CompanyAmount            = txtCompanyAmount.Text.Trim() == "" ? 0 : Convert.ToDouble(txtCompanyAmount.Text);
                consignNoteDTO.ConsigneeId              = Convert.ToInt32(cmbConsineeName.SelectedValue);
                consignNoteDTO.ConsigneeInvoiceNo       = txtInvoiceNo.Text;
                consignNoteDTO.ConsigneeServiceTaxRegNo = txtConsigneeServiceTaxRegNo.Text;
                consignNoteDTO.ConsignorId              = Convert.ToInt32(cmbConsignorName.SelectedValue);
                consignNoteDTO.ConsignorPurchaseOrderNo = txtPurchaseOrderNo.Text;
                consignNoteDTO.ConsignorServiceTaxRegNo = txtConsignorServiceTaxRegNo.Text;
                consignNoteDTO.PanNo = txtPanNo.Text;
                consignNoteDTO.CentralisedServiceTaxRegnNo = txtCentralisedServiceTaxRegNo.Text;
                consignNoteDTO.FromCode          = txtFromCodeName.Text;
                consignNoteDTO.ConsignmentNoteNo = txtConsignmentNoteNo.Text.Trim() == "" ? 0 : Convert.ToInt32(txtConsignmentNoteNo.Text);
                consignNoteDTO.ConsignmentDate   = Convert.ToDateTime(dpConsignmentDate.Value);
                consignNoteDTO.AddressofIssuing  = txtAddressOfIssueOffice.Text;
                consignNoteDTO.ToCode            = txtToCodeName.Text;
                consignNoteDTO.CompanyPhone      = txtCompanyPhoneNo.Text;
                consignNoteDTO.NoofPackages      = txtNoOfPackages.Text;
                consignNoteDTO.MethodOfPacking   = txtMethodOfPacking.Text;
                consignNoteDTO.ActualWtInKGS     = txtActualWeightInKg.Text;
                consignNoteDTO.CategoryOfLoad    = txtChargeWeightInKg.Text;
                consignNoteDTO.Rate                            = txtRate.Text;
                consignNoteDTO.Charges1                        = txtCharges1.Text;
                consignNoteDTO.Amount1                         = double.Parse(txtAmount1.Text);
                consignNoteDTO.LoadType                        = txtLoadType.Text;
                consignNoteDTO.Distance                        = txtDistance.Text;
                consignNoteDTO.KMS                             = txtKms.Text;
                consignNoteDTO.Charges1                        = txtCharges1.Text;
                consignNoteDTO.Charges2                        = txtCharges2.Text;
                consignNoteDTO.Amount2                         = double.Parse(txtAmount2.Text);
                consignNoteDTO.Charges3                        = txtCharges3.Text;
                consignNoteDTO.Charges4                        = txtCharges4.Text;
                consignNoteDTO.AdvancedPaymentDate             = Convert.ToDateTime(dpAdvancePaymentDate.Value);
                consignNoteDTO.Charges5                        = txtCharges5.Text;
                consignNoteDTO.Amount3                         = txtAmount3.Text.Trim() == "" ? 0 : Convert.ToDouble(txtAmount3.Text);
                consignNoteDTO.Amount4                         = txtAmount4.Text.Trim() == "" ? 0 : Convert.ToDouble(txtAmount4.Text);
                consignNoteDTO.Amount5                         = txtAmount5.Text.Trim() == "" ? 0 : Convert.ToDouble(txtAmount5.Text);
                txtFinalAmount.Text                            = (Convert.ToDouble(txtAmount1.Text) + Convert.ToDouble(txtAmount2.Text) + Convert.ToDouble(txtAmount3.Text) + Convert.ToDouble(txtAmount4.Text) + Convert.ToDouble(txtAmount5.Text)).ToString();
                consignNoteDTO.FinalAmount                     = Convert.ToDouble(txtFinalAmount.Text);
                consignNoteDTO.PrivateMarketOtherIdentificaion = txtPrivateMarks.Text;
                consignNoteDTO.AdvancedPaymentAmount           = txtAdvancePaymentAmount.Text;
                consignNoteDTO.BusinessType                    = txtBusinessType.Text;
                consignNoteDTO.DeclarationNo                   = txtDeclaredValueGoods.Text;
                consignNoteDTO.DimensionLength                 = txtLength.Text;
                consignNoteDTO.DimensionWidth                  = txtWidth.Text;
                consignNoteDTO.DimensionHeight                 = txtHeight.Text;
                consignNoteDTO.DimensionNoOfPKGS               = txtDiamentionNoOfPkgs.Text;
                consignNoteDTO.DimensionTotalCFTCMT            = txtTotalCFT.Text;
                consignNoteDTO.DimensionSinglePieceWeight      = txtSinglePiece.Text;
                consignNoteDTO.ValidType                       = txtValidType.Text;
                consignNoteDTO.DeclaredValueOfGoods            = txtDeclaredValueGoods.Text;
                consignNoteDTO.ServicetaxThrough               = txtServiceTaxThrough.Text;
                consignNoteDTO.BasicOfBooking                  = txtBasicOfBooking.Text;
                consignNoteDTO.BilledWithMs                    = txtBilledWith.Text;
                consignNoteDTO.BranchCode                      = txtBranchCode.Text;
                consignNoteDTO.PartyCode                       = txtPartyCode.Text;
                consignNoteDTO.ToPay                           = txtToPay.Text;
                consignNoteDTO.Rebooking                       = txtRebooking.Text;
                consignNoteDTO.MainConsignmentNo               = txtMainConsignment.Text;
                consignNoteDTO.ServiceTaxisPayableBy           = (cmbServiceTaxisPaybleBy.SelectedItem).ToString();
                consignNoteDTO.ConsignmentId                   = Consignmentid;


                var resultCheckDuplicateConsignmentNoteNo = ConsignmentNoteBusinessLogic.CheckDuplicateConsignmentNoteNo(Consignmentid, Convert.ToInt32(txtConsignmentNoteNo.Text));
                if (resultCheckDuplicateConsignmentNoteNo)
                {
                    MessageBox.Show("Consignment Number already exists.");
                    txtConsignmentNoteNo.Focus();
                }
                else
                {
                    var result = ConsignmentNoteBusinessLogic.Save(consignNoteDTO);
                    if (result > 0)
                    {
                        MessageBox.Show("LR Note Successfully Generate");
                        if (Consignmentid > 0)
                        {
                            this.Close();
                        }
                        else
                        {
                            clearData();
                        }
                    }
                }
            }
        }
 public static int Save(tblConsignmentNoteDTO tblConsignmentNoteDTO)
 {
     using (var dbObject = new BRCTransportDBEntities())
     {
         var tblConsignmentNoteObject = tblConsignmentNoteDTO.ToEntity();
         if (tblConsignmentNoteDTO.ConsignmentId == 0)
         {
             dbObject.tblConsignmentNotes.Add(tblConsignmentNoteObject);
         }
         else
         {
             tblConsignmentNoteObject = dbObject.tblConsignmentNotes.Find(tblConsignmentNoteDTO.ConsignmentId);
             tblConsignmentNoteObject.ConsignmentNoteNo        = tblConsignmentNoteDTO.ConsignmentNoteNo;
             tblConsignmentNoteObject.CompanyName              = tblConsignmentNoteDTO.CompanyName;
             tblConsignmentNoteObject.PolicyNo                 = tblConsignmentNoteDTO.PolicyNo;
             tblConsignmentNoteObject.CompanyDate              = tblConsignmentNoteDTO.CompanyDate;
             tblConsignmentNoteObject.CompanyAmount            = tblConsignmentNoteDTO.CompanyAmount;
             tblConsignmentNoteObject.CompanyPhone             = tblConsignmentNoteDTO.CompanyPhone;
             tblConsignmentNoteObject.ConsigneeId              = tblConsignmentNoteDTO.ConsigneeId;
             tblConsignmentNoteObject.ConsignorId              = tblConsignmentNoteDTO.ConsignorId;
             tblConsignmentNoteObject.ConsigneeInvoiceNo       = tblConsignmentNoteDTO.ConsigneeInvoiceNo;
             tblConsignmentNoteObject.ConsigneeServiceTaxRegNo = tblConsignmentNoteDTO.ConsigneeServiceTaxRegNo;
             tblConsignmentNoteObject.ConsignorPurchaseOrderNo = tblConsignmentNoteDTO.ConsignorPurchaseOrderNo;
             tblConsignmentNoteObject.ConsignorServiceTaxRegNo = tblConsignmentNoteDTO.ConsignorServiceTaxRegNo;
             tblConsignmentNoteObject.FromCode                 = tblConsignmentNoteDTO.FromCode;
             tblConsignmentNoteObject.ToCode                          = tblConsignmentNoteDTO.ToCode;
             tblConsignmentNoteObject.NoofPackages                    = tblConsignmentNoteDTO.NoofPackages;
             tblConsignmentNoteObject.MethodOfPacking                 = tblConsignmentNoteDTO.MethodOfPacking;
             tblConsignmentNoteObject.ActualWtInKGS                   = tblConsignmentNoteDTO.ActualWtInKGS;
             tblConsignmentNoteObject.CategoryOfLoad                  = tblConsignmentNoteDTO.CategoryOfLoad;
             tblConsignmentNoteObject.Rate                            = tblConsignmentNoteDTO.Rate;
             tblConsignmentNoteObject.LoadType                        = tblConsignmentNoteDTO.LoadType;
             tblConsignmentNoteObject.Distance                        = tblConsignmentNoteDTO.Distance;
             tblConsignmentNoteObject.KMS                             = tblConsignmentNoteDTO.KMS;
             tblConsignmentNoteObject.DescriptionSaidToContain        = tblConsignmentNoteDTO.DescriptionSaidToContain;
             tblConsignmentNoteObject.PrivateMarketOtherIdentificaion = tblConsignmentNoteDTO.PrivateMarketOtherIdentificaion;
             tblConsignmentNoteObject.BusinessType                    = tblConsignmentNoteDTO.BusinessType;
             tblConsignmentNoteObject.AdvancedPaymentMRNo             = tblConsignmentNoteDTO.AdvancedPaymentMRNo;
             tblConsignmentNoteObject.AdvancedPaymentDate             = tblConsignmentNoteDTO.AdvancedPaymentDate;
             tblConsignmentNoteObject.AdvancedPaymentAmount           = tblConsignmentNoteDTO.AdvancedPaymentAmount;
             tblConsignmentNoteObject.DimensionLength                 = tblConsignmentNoteDTO.DimensionLength;
             tblConsignmentNoteObject.DimensionWidth                  = tblConsignmentNoteDTO.DimensionWidth;
             tblConsignmentNoteObject.DimensionHeight                 = tblConsignmentNoteDTO.DimensionHeight;
             tblConsignmentNoteObject.DimensionNoOfPKGS               = tblConsignmentNoteDTO.DimensionNoOfPKGS;
             tblConsignmentNoteObject.DimensionTotalCFTCMT            = tblConsignmentNoteDTO.DimensionTotalCFTCMT;
             tblConsignmentNoteObject.DimensionSinglePieceWeight      = tblConsignmentNoteDTO.DimensionSinglePieceWeight;
             tblConsignmentNoteObject.DeclarationNo                   = tblConsignmentNoteDTO.DeclarationNo;
             tblConsignmentNoteObject.ValidUpto                       = tblConsignmentNoteDTO.ValidUpto;
             tblConsignmentNoteObject.DeclaredValueOfGoods            = tblConsignmentNoteDTO.DeclaredValueOfGoods;
             tblConsignmentNoteObject.BasicOfBooking                  = tblConsignmentNoteDTO.BasicOfBooking;
             tblConsignmentNoteObject.BilledWithMs                    = tblConsignmentNoteDTO.BilledWithMs;
             tblConsignmentNoteObject.BranchCode                      = tblConsignmentNoteDTO.BranchCode;
             tblConsignmentNoteObject.ToPay                           = tblConsignmentNoteDTO.ToPay;
             tblConsignmentNoteObject.Rebooking                       = tblConsignmentNoteDTO.Rebooking;
             tblConsignmentNoteObject.MainConsignmentNo               = tblConsignmentNoteDTO.MainConsignmentNo;
             tblConsignmentNoteObject.GoodRecievedDetails             = tblConsignmentNoteDTO.GoodRecievedDetails;
             tblConsignmentNoteObject.Charges1                        = tblConsignmentNoteDTO.Charges1;
             tblConsignmentNoteObject.Amount1                         = tblConsignmentNoteDTO.Amount1;
             tblConsignmentNoteObject.Charges2                        = tblConsignmentNoteDTO.Charges2;
             tblConsignmentNoteObject.Amount2                         = tblConsignmentNoteDTO.Amount2;
             tblConsignmentNoteObject.Charges3                        = tblConsignmentNoteDTO.Charges3;
             tblConsignmentNoteObject.Amount3                         = tblConsignmentNoteDTO.Amount3;
             tblConsignmentNoteObject.Charges4                        = tblConsignmentNoteDTO.Charges4;
             tblConsignmentNoteObject.Amount4                         = tblConsignmentNoteDTO.Amount4;
             tblConsignmentNoteObject.Charges5                        = tblConsignmentNoteDTO.Charges5;
             tblConsignmentNoteObject.Amount5                         = tblConsignmentNoteDTO.Amount5;
             tblConsignmentNoteObject.FinalAmount                     = tblConsignmentNoteDTO.FinalAmount;
             tblConsignmentNoteObject.ServiceTaxisPayableBy           = tblConsignmentNoteDTO.ServiceTaxisPayableBy;
             tblConsignmentNoteObject.FinalAmount                     = tblConsignmentNoteDTO.FinalAmount;
             tblConsignmentNoteObject.PanNo                           = tblConsignmentNoteDTO.PanNo;
             tblConsignmentNoteObject.PartyCode                       = tblConsignmentNoteDTO.PartyCode;
             tblConsignmentNoteObject.ServicetaxThrough               = tblConsignmentNoteDTO.ServicetaxThrough;
             tblConsignmentNoteObject.ValidType                       = tblConsignmentNoteDTO.ValidType;
             tblConsignmentNoteObject.PhoneNo                         = tblConsignmentNoteDTO.PhoneNo;
             tblConsignmentNoteObject.AddressofIssuing                = tblConsignmentNoteDTO.AddressofIssuing;
             tblConsignmentNoteObject.ConsignmentDate                 = tblConsignmentNoteDTO.ConsignmentDate;
             tblConsignmentNoteObject.CentralisedServiceTaxRegnNo     = tblConsignmentNoteDTO.CentralisedServiceTaxRegnNo;
         }
         dbObject.SaveChanges();
         return(tblConsignmentNoteObject.ConsignmentId);
     }
 }