private void btnDelete_Click(object sender, EventArgs e)
        {
            var expenseTranID = Convert.ToInt32(dgExpenseTransaction.CurrentRow.Cells["ExpenseTransactionID"].Value.ToString());

            if (expenseTranID == 0)
            {
                MyMessageBox.ShowBox("Please select a value from the Expense Transaction!!!");
            }
            else
            {
                var retStr = MyMessageBoxYesorNo.ShowBox("Are you Sure You want to Delete??");
                if (retStr == "1")
                {
                    ExpenseTransactionBL obj = new ExpenseTransactionBL();
                    var flag = obj.DeleteExpenseTransaction(expenseTranID);
                    LoadDefaultValues();
                    if (flag)
                    {
                        MyMessageBox.ShowBox("Expense Transaction Deleted");
                    }
                    else
                    {
                        MyMessageBox.ShowBox("Expense Transaction Failed to Delete.");
                    }
                }
            }
        }
Beispiel #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var SparePartsInfoID = Convert.ToInt32(dgSparePartsInfo.CurrentRow.Cells["SparePartsInfoID"].Value.ToString());

            if (SparePartsInfoID == 0)
            {
                MyMessageBox.ShowBox("Please select a value from the SpareParts Info!!!");
            }
            else
            {
                var retStr = MyMessageBoxYesorNo.ShowBox("Are you Sure You want to Delete??");
                if (retStr == "1")
                {
                    SparePartsInfoBL obj = new SparePartsInfoBL();
                    var flag             = obj.DeleteSparePartsInfo(SparePartsInfoID);
                    LoadDefaultValues();
                    if (flag)
                    {
                        MyMessageBox.ShowBox("SpareParts Information Deleted");
                    }
                    else
                    {
                        MyMessageBox.ShowBox("SpareParts Information Failed to Delete.");
                    }
                }
            }
        }
Beispiel #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var vehicleInventoryID = Convert.ToInt32(dgVehicleInventory.CurrentRow.Cells["VehicleInventoryID"].Value.ToString());

            if (vehicleInventoryID == 0)
            {
                MyMessageBox.ShowBox("Please select a value from the Vehicle Invetory!!!");
            }
            else
            {
                var retStr = MyMessageBoxYesorNo.ShowBox("Are you Sure You want to Delete??");
                if (retStr == "1")
                {
                    VehicleInventoryBL obj = new VehicleInventoryBL();
                    var flag = obj.DeleteVehicleInventory(vehicleInventoryID);
                    LoadDefaultValues();
                    if (flag)
                    {
                        MyMessageBox.ShowBox("Vehicle Inventory Deleted");
                    }
                    else
                    {
                        MyMessageBox.ShowBox("Vehicle Inventory Failed to Delete.");
                    }
                }
            }
        }
Beispiel #4
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            var retStr = MyMessageBoxYesorNo.ShowBox("Are you Sure You want to Remove??");

            if (retStr == "1")
            {
                if (lstBoxSPInvlist.SelectedIndex != -1)
                {
                    lstBoxSPInvlist.Items.RemoveAt(lstBoxSPInvlist.SelectedIndex);
                }
                else
                {
                    MyMessageBox.ShowBox("Please Select SpareParts Inventory from Right grid to Remove");
                }
            }
        }
Beispiel #5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string id = MyMessageBoxYesorNo.ShowBox("Are you sure to Delete??");

            if (id == "1")
            {
                var        expenseID = dgExpenses.CurrentRow.Cells["ExpenseID"].Value.ToString();
                ExpensesBL expen     = new ExpensesBL();
                var        result    = expen.DeleteExpenses(Convert.ToInt32(expenseID));
                if (result)
                {
                    MyMessageBox.ShowBox("Expenses Deleted");
                }
                else
                {
                    MyMessageBox.ShowBox("Failed");
                }
                clear();
                LoadExpenses();
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtCustomerName.Text == "" || ddlEmployees.SelectedIndex == -1 || ddlModel.SelectedIndex == -1 || txtDealerRemark.Text == "" || ddlStatus.SelectedIndex == -1 || (!rdnPayCash.Checked && !rdnPayFinance.Checked))
            {
                MyMessageBox.ShowBox("Please enter all Mandatory Fields !!!");
                return;
            }

            //ReadyToDeliver
            bool flgRTOD = false;

            if (rdnRtoDYes.Checked)
            {
                flgRTOD = true;
                string result = MyMessageBoxYesorNo.ShowBox("Are you sure to Deliver the Vehicles?  Please validate Vehicle, Spare Parts, Insurance, Finance and RTO is Alloted");
                if (result != "1")
                {
                    return;
                }
            }

            //Get Sales Executive Id
            int SalesExecutiveId = 0;

            if (ddlEmployees.SelectedIndex != -1)
            {
                var salesItem = (ComboboxItem)ddlEmployees.SelectedItem;
                SalesExecutiveId = Convert.ToInt32(salesItem.Value);
            }


            int Model = 0;

            if (ddlModel.SelectedIndex != -1)
            {
                var modelItem = (ComboboxItem)ddlModel.SelectedItem;
                Model = Convert.ToInt32(modelItem.Value);
            }

            //Get StatusId
            int StatusId = 0;

            if (ddlStatus.SelectedIndex != -1)
            {
                var statusitem = (ComboboxItem)ddlStatus.SelectedItem;
                StatusId = Convert.ToInt32(statusitem.Value);
            }



            //AdvanceAmountMode
            bool flgAdvCash = false;

            if (rdnAdvCash.Checked)
            {
                flgAdvCash = true;
            }

            //CashOrFinance
            bool flagCash = false;

            if (rdnPayCash.Checked)
            {
                flagCash = true;
            }

            //FinancierId

            int?financierId = null;

            if (ddlFinance.SelectedIndex != -1)
            {
                var financeItem = (ComboboxItem)ddlFinance.SelectedItem;
                financierId = Convert.ToInt32(financeItem.Value);
            }

            int?advanceChequeNo = null;

            if (txtChequeNo.Text != "")
            {
                advanceChequeNo = Convert.ToInt32(txtChequeNo.Text);
            }

            //Populate VehicleBookingDTO
            VehicleBookingDTO dto = new VehicleBookingDTO()
            {
                CustomerID          = Convert.ToInt32(txtCustomerId.Text),
                VehicleEnquiryID    = _vehicleEnquiryId,
                ReferenceBy         = txtReferenceBy.Text,
                SalesExecutiveId    = SalesExecutiveId,
                ModelID             = Model,
                Color1              = ddlColor1.Text,
                Color2              = ddlColor2.Text,
                Color3              = ddlColor3.Text,
                CustomerRemark      = txtCustomerRemark.Text,
                ClosingRemark       = txtDealerRemark.Text,
                ReadyToDeliver      = flgRTOD,
                AdvanceAmount       = Convert.ToInt32(txtAdvanceAmount.Text),
                AdvanceMode         = flgAdvCash,
                AdvanceChequeNo     = advanceChequeNo ?? 0,
                IsCash              = flagCash,
                FinancierInfoId     = financierId,
                FinancierRemark     = txtFinanceRemark.Text,
                StatusId            = StatusId,
                FollowupDescription = txtDealerRemark.Text,
                FollowupIsActive    = true,
                FollowupDate        = Convert.ToDateTime(dtFollowupDate.Text),
                CommittedDate       = Convert.ToDateTime(dtCommittedDate.Text),
                CreatedBy           = GlobalSetup.Userid,
                CreatedDate         = DateTime.Now,
                ModifiedBy          = GlobalSetup.Userid,
                ModifiedDate        = DateTime.Now
            };

            if (_mode == "EDIT" || _mode == "DELIVERY")
            {
                dto.VehicleBookingID = _vehicleBookingId;
            }
            //Save VehicleBooking
            VehicleBookingBL bl = new VehicleBookingBL();
            var flag            = bl.SaveVehicleBooking(dto, _mode);

            if (flag)
            {
                MyMessageBox.ShowBox("Vehicle Booking Saved");
                Clear();
                this.Close();
            }
            else
            {
                MyMessageBox.ShowBox("Vehicle Booking Failed to Save");
            }
        }
Beispiel #7
0
        private void btnGenerateInvoice_Click(object sender, EventArgs e)
        {
            string result = MyMessageBoxYesorNo.ShowBox("Please verify the margin price for Vehicle, Extra Fittings and Customer Credit???");

            if (result == "1")
            {
                if (invMargin.Text == "0" || invMargin.Text == "")
                {
                    MyMessageBox.ShowBox("Invoice Margin Cannot be Empty!!!");
                    return;
                }
                if (lblWarrantyMargin.Text == "0" || lblWarrantyMargin.Text == "")
                {
                    MyMessageBox.ShowBox("Warranty Margin Price Cannot be Empty!!!");
                    return;
                }

                if ((fMargin1.Visible && (fMargin1.Text == "0" || fMargin1.Text == "")) ||
                    (fMargin2.Visible && (fMargin2.Text == "0" || fMargin2.Text == "")) ||
                    (fMargin3.Visible && (fMargin3.Text == "0" || fMargin3.Text == "")) ||
                    (fMargin4.Visible && (fMargin4.Text == "0" || fMargin4.Text == "")) ||
                    (fMargin5.Visible && (fMargin5.Text == "0" || fMargin5.Text == "")) ||
                    (fMargin6.Visible && (fMargin6.Text == "0" || fMargin6.Text == "")) ||
                    (fMargin7.Visible && (fMargin7.Text == "0" || fMargin7.Text == "")) ||
                    (fMargin8.Visible && (fMargin8.Text == "0" || fMargin8.Text == "")) ||
                    (fMargin9.Visible && (fMargin9.Text == "0" || fMargin9.Text == "")) ||
                    (fMargin10.Visible && (fMargin10.Text == "0" || fMargin10.Text == "")))
                {
                    MyMessageBox.ShowBox("Extra Fitting Margin Price Cannot be Empty!!!");
                    return;
                }

                if (txtDiscount.Text != "" && txtRemarks.Text == "")
                {
                    MyMessageBox.ShowBox("Discount Remarks Cannot be Empty for Discount Offer!!!");
                    return;
                }


                if (txtDiscount.Text != "")
                {
                    var discountAmt = Convert.ToInt32(txtDiscount.Text);
                    //Add Discount margin
                    var sp = new InvoiceMarginDTO()
                    {
                        InvoiceID        = _invoiceId,
                        InvoiceType      = "SALES",
                        VehicleBookingID = _vehicleBookingId,
                        MarginTypeID     = 5,//For Discount Margin
                        ManualAmount     = 0,
                        MarginID         = _vehicleBookingId,
                        MarginAmount     = -discountAmt,
                        ActualAmount     = 0,
                        IsReceived       = false,
                        ReceivedDate     = null,
                        IsCash           = false,
                        ChequeBankTranNo = "",
                        Remarks          = txtRemarks.Text,
                        CreatedDate      = DateTime.Now,
                        CreatedBy        = GlobalSetup.Userid,
                        ModifiedBy       = null,
                        ModifiedDate     = null,
                        InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                    };
                    lst.Add(sp);
                }

                if (txtFinanceMargin.Text != "")
                {
                    var finmarginType = lst.Where(x => x.MarginTypeID == 2).FirstOrDefault();
                    finmarginType.MarginAmount = Convert.ToInt32(txtFinanceMargin.Text);
                }

                string result1 = MyMessageBoxYesorNo.ShowBox("Previously Generated Invoice will be Deleted???");
                if (result1 == "1")
                {
                    InvoiceBL bl   = new InvoiceBL();
                    var       flag = bl.SaveInvoiceMargin(lst, _vehicleBookingId);

                    if (flag)
                    {
                        MyMessageBox.ShowBox("Invoice Margin Created !!!");
                    }
                    else
                    {
                        MyMessageBox.ShowBox("Invoice Margin failed to create !!!");
                    }
                }
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ddlModelName.SelectedIndex == -1 || txtIdentificationNo.Text == "" || txtOtherDescription.Text == "" || ddlQuantity.SelectedIndex == -1 || txtMarginPrice.Text == "" || txtShowRoomPrice.Text == "")
            {
                MyMessageBox.ShowBox("Please Select All Mandatory Fields !!!");
                return;
            }

            if (txtMarginPrice.Text == "0" || txtShowRoomPrice.Text == "0")
            {
                MyMessageBox.ShowBox("Price cannot be 0 !!!");
                return;
            }

            if (Convert.ToInt32(ddlQuantity.Text) > 5)
            {
                string ok = MyMessageBoxYesorNo.ShowBox("Are you sure you want to add " + ddlQuantity.Text + " Quantity");
                if (ok != "1")
                {
                    return;
                }
            }
            SparePartsInventoryDTO info = new SparePartsInventoryDTO();
            var selItem = (ComboboxItem)ddlModelName.SelectedItem;

            info.SparePartsInventoryID = _SparePartsInventoryID;
            info.SparePartsInfoID      = Convert.ToInt32(selItem.Value);
            info.IdentificationNo      = txtIdentificationNo.Text;
            info.OtherDescription      = txtOtherDescription.Text;
            info.CreatedDate           = System.DateTime.Now;
            info.CreatedBy             = GlobalSetup.Userid;
            info.ModifiedDate          = System.DateTime.Now;
            info.MarginPrice           = Convert.ToInt32(txtMarginPrice.Text);
            info.ShowRoomPrice         = Convert.ToInt32(txtShowRoomPrice.Text);
            var invSelitem = (ComboboxItem)ddlInvStatus.SelectedItem;

            info.SparePartsInventoryStatusTypeID = Convert.ToInt32(invSelitem.Value);
            int quantity = Convert.ToInt32(ddlQuantity.Text);
            SparePartsInventoryBL viBL = new SparePartsInventoryBL();
            var flag    = false;
            var identno = info.IdentificationNo;

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    for (int i = 1; i <= quantity; i++)
                    {
                        info.IdentificationNo = identno + " --" + i.ToString() + " -" + System.DateTime.Now.ToShortDateString();
                        viBL.SaveInventorySpareParts(info, _mode);
                    }
                    flag = true;
                    scope.Complete();
                }
                catch (Exception ex)
                {
                    flag = false;
                }
                if (flag)
                {
                    MyMessageBox.ShowBox("SpareParts Inventory Saved", "SpareParts Inventory");
                    Clear();
                }
                else
                {
                    MyMessageBox.ShowBox("SpareParts Inventory Failed to Save", "SpareParts Inventory");
                }
            }
            this.Close();
        }