public override void Save()
        {
            var rows = grdBookings.Rows.Where(c => c.Cells[COLS.ID].Value.ToStr() == "" || c.Cells[COLS.ID].Value.ToInt() == 0);


            foreach (GridViewRowInfo row in rows)
            {
                try
                {
                    if (string.IsNullOrEmpty(row.Cells[COLS.PickupDateTime].Value.ToStr().Trim()))
                    {
                        continue;
                    }


                    objMaster = new BookingBO();
                    objMaster.New();

                    objMaster.Current.SubcompanyId = AppVars.objSubCompany.Id;

                    objMaster.Current.BookingDate   = DateTime.Now;
                    objMaster.Current.BookingNo     = row.Cells[COLS.BookingReference].Value.ToStr();
                    objMaster.Current.VehicleTypeId = row.Cells[COLS.VehicleType].Value.ToIntorNull();

                    objMaster.Current.FromLocTypeId = Enums.LOCATION_TYPES.ADDRESS;
                    objMaster.Current.FromAddress   = row.Cells[COLS.From].Value.ToStr();

                    objMaster.Current.ToLocTypeId   = Enums.LOCATION_TYPES.ADDRESS;
                    objMaster.Current.ToAddress     = row.Cells[COLS.To].Value.ToStr();
                    objMaster.Current.JourneyTypeId = 1;
                    objMaster.Current.FareRate      = 0.00m;

                    objMaster.Current.PickupDateTime = row.Cells[COLS.PickupDateTime].Value.ToDateTime();
                    string companyName = row.Cells[COLS.Account].Value.ToStr();
                    int?   companyId   = null;


                    if (companyName.ToLower() == "cash")
                    {
                    }

                    if (!string.IsNullOrEmpty(companyName))
                    {
                        companyId = General.GetObject <Gen_Company>(c => c.CompanyName.ToLower() == companyName.ToLower()).DefaultIfEmpty().Id.ToIntorNull();
                    }

                    if (companyId != null && companyId != 0)
                    {
                        objMaster.Current.CompanyId     = companyId;
                        objMaster.Current.IsCompanyWise = true;
                    }



                    objMaster.Current.CustomerName = row.Cells[COLS.Passenger].Value.ToStr().ToProperCase();

                    if (objMaster.Current.CustomerName.Length > 100)
                    {
                        objMaster.Current.CustomerName = objMaster.Current.CustomerName.Substring(0, 99);
                    }

                    string phoneNo = row.Cells[COLS.PhoneNo].Value.ToStr();

                    if (!string.IsNullOrEmpty(phoneNo))
                    {
                        if (phoneNo.Contains("+44"))
                        {
                            phoneNo = phoneNo.Strip("+44").Trim();
                        }

                        else if (phoneNo.Contains("0044"))
                        {
                            phoneNo = phoneNo.Strip("0044").Trim();
                        }


                        if (phoneNo.Length > 0)
                        {
                            if (phoneNo[0] != '0')
                            {
                                phoneNo = phoneNo.Insert(0, "0");
                            }
                        }
                    }

                    if (phoneNo.StartsWith("07"))
                    {
                        objMaster.Current.CustomerMobileNo = phoneNo;
                    }
                    else
                    {
                        objMaster.Current.CustomerPhoneNo = phoneNo;
                    }



                    if (companyId != null && companyId != 0)
                    {
                        if (companyName.ToLower().Trim() == "C/Card" || companyName.ToLower().Trim() == "Credit Card")
                        {
                            objMaster.Current.PaymentTypeId = Enums.PAYMENT_TYPES.CREDIT_CARD;
                        }
                        else
                        {
                            objMaster.Current.PaymentTypeId = Enums.PAYMENT_TYPES.BANK_ACCOUNT;
                        }
                    }
                    else
                    {
                        objMaster.Current.PaymentTypeId = Enums.PAYMENT_TYPES.CASH;
                    }


                    objMaster.Current.BookingStatusId = Enums.BOOKINGSTATUS.WAITING;
                    objMaster.Current.FromDoorNo      = row.Cells[COLS.FlightNo].Value.ToStr();



                    objMaster.Current.Booking_ViaLocations.Add(new Booking_ViaLocation
                    {
                        ViaLocTypeId    = Enums.LOCATION_TYPES.ADDRESS,
                        ViaLocLabel     = "Via",
                        ViaLocTypeLabel = "Address",
                        ViaLocTypeValue = "Address",
                        ViaLocValue     = row.Cells[COLS.Via].Value.ToStr()
                    });



                    objMaster.Save();

                    row.Cells[COLS.ID].Value = objMaster.Current.Id;

                    row.ErrorText = "";
                }
                catch (Exception ex)
                {
                    row.Cells[COLS.ID].Value = objMaster.Current.Id;

                    row.ErrorText = objMaster.ShowErrors();
                }
            }
        }
        public override void Save()
        {
            var rows = grdBookings.Rows.Where(c => c.Cells[COLS.ID].Value.ToStr() == "" || c.Cells[COLS.ID].Value.ToInt() == 0);


            foreach (GridViewRowInfo row in rows)
            {
                try
                {
                    objMaster = new BookingBO();
                    objMaster.New();

                    objMaster.Current.SubcompanyId = AppVars.objSubCompany.Id;

                    objMaster.Current.BookingDate   = DateTime.Now;
                    objMaster.Current.BookingNo     = row.Cells[COLS.BookingReference].Value.ToStr();
                    objMaster.Current.VehicleTypeId = row.Cells[COLS.VehicleType].Value.ToIntorNull();

                    objMaster.Current.FromLocTypeId = Enums.LOCATION_TYPES.ADDRESS;
                    objMaster.Current.FromAddress   = row.Cells[COLS.From].Value.ToStr();

                    objMaster.Current.ToLocTypeId   = Enums.LOCATION_TYPES.ADDRESS;
                    objMaster.Current.ToAddress     = row.Cells[COLS.To].Value.ToStr();
                    objMaster.Current.JourneyTypeId = 1;
                    objMaster.Current.FareRate      = row.Cells[COLS.Fare].Value.ToDecimal();

                    objMaster.Current.PickupDateTime = row.Cells[COLS.PickupDateTime].Value.ToDateTime();
                    string companyName = row.Cells[COLS.Account].Value.ToStr();
                    int?   companyId   = null;

                    if (!string.IsNullOrEmpty(companyName))
                    {
                        companyId = General.GetObject <Gen_Company>(c => c.CompanyName.ToLower() == companyName.ToLower()).DefaultIfEmpty().Id.ToIntorNull();
                    }

                    if (companyId != null)
                    {
                        objMaster.Current.CompanyId     = companyId;
                        objMaster.Current.IsCompanyWise = true;
                    }


                    objMaster.Current.CustomerName = row.Cells[COLS.Passenger].Value.ToStr().ToProperCase();

                    string phoneNo = row.Cells[COLS.PhoneNo].Value.ToStr();

                    if (!string.IsNullOrEmpty(phoneNo))
                    {
                        if (phoneNo.Contains("+44"))
                        {
                            phoneNo = phoneNo.Strip("+44").Trim();
                        }

                        else if (phoneNo.Contains("0044"))
                        {
                            phoneNo = phoneNo.Strip("0044").Trim();
                        }


                        if (phoneNo.Length > 0)
                        {
                            if (phoneNo[0] != '0')
                            {
                                phoneNo = phoneNo.Insert(0, "0");
                            }
                        }
                    }

                    if (phoneNo.StartsWith("07"))
                    {
                        objMaster.Current.CustomerMobileNo = phoneNo;
                    }
                    else
                    {
                        objMaster.Current.CustomerPhoneNo = phoneNo;
                    }

                    string payment     = row.Cells[COLS.PaymentType].Value.ToStr();
                    int?   paymentType = General.GetObject <Gen_PaymentType>(c => c.PaymentType.ToLower() == payment.ToLower()).DefaultIfEmpty().Id.ToIntorNull();

                    if (paymentType != 0)
                    {
                        objMaster.Current.PaymentTypeId = paymentType;
                    }
                    else
                    {
                        paymentType = General.GetObject <Gen_PaymentType>(c => c.PaymentType.ToLower() == "bank account").DefaultIfEmpty().Id.ToIntorNull();
                        objMaster.Current.PaymentTypeId = paymentType;
                    }


                    objMaster.Current.BookingStatusId = Enums.BOOKINGSTATUS.WAITING;



                    objMaster.AddedBy = AppVars.LoginObj.UserName.ToStr();

                    objMaster.Save();

                    row.Cells[COLS.ID].Value = objMaster.Current.Id;

                    row.ErrorText = "";
                }
                catch (Exception ex)
                {
                    row.Cells[COLS.ID].Value = objMaster.Current.Id;

                    row.ErrorText = objMaster.ShowErrors();
                }
            }
        }