Esempio n. 1
0
        private void grid_CommandCellClick(object sender, EventArgs e)
        {
            GridCommandCellElement gridCell = (GridCommandCellElement)sender;
            string name = gridCell.ColumnInfo.Name.ToLower();

            GridViewRowInfo row = gridCell.RowElement.RowInfo;
            long            id  = row.Cells[COLS.BookingId].Value.ToLong();



            if (name == "unprocess")
            {
                RadGridView grid = gridCell.GridControl;
                objMaster = new BookingBO();

                objMaster.GetByPrimaryKey(id);

                if (objMaster.Current != null)
                {
                    if (General.GetQueryable <DriverRent_Charge>(c => c.BookingId == id).Count() > 0)
                    {
                        ENUtils.ShowMessage("Cannot UnProcess this Job as Driver Rent is generated from it");
                        return;
                    }

                    objMaster.Current.IsProcessed = false;

                    objMaster.CheckCustomerValidation = false;
                    objMaster.CheckDataValidation     = false;

                    objMaster.Save();
                    row.Delete();
                }
            }
        }
        void grdLister_CommandCellClick(object sender, EventArgs e)
        {
            try
            {
                GridCommandCellElement gridCell = (GridCommandCellElement)sender;
                string name = gridCell.ColumnInfo.Name.ToLower();


                GridViewRowInfo row = gridCell.GridControl.CurrentRow;



                if (row != null)
                {
                    if (name == "accept")
                    {
                        using (TaxiDataContext db = new TaxiDataContext())
                        {
                            db.stp_AuthUnavailAllocDrvs(row.Cells["ONLINEBOOKINGID"].Value.ToLong(), "", AppVars.LoginObj.UserName.ToStr());
                        }
                    }
                    else
                    {
                        if (AppVars.denyAllocatedBookingIds.ToStr().Trim().Length == 0)
                        {
                            AppVars.denyAllocatedBookingIds += "," + row.Cells["ONLINEBOOKINGID"].Value.ToLong() + ",";
                        }
                        else
                        {
                            AppVars.denyAllocatedBookingIds += row.Cells["ONLINEBOOKINGID"].Value.ToLong() + ",";
                        }
                    }

                    row.Delete();

                    SleepAction();

                    if (name == "accept")
                    {
                        RefreshDashBoardBookings();
                    }


                    if (grdLister.Rows.Count == 0)
                    {
                        CloseForm();
                    }
                }
            }
            catch (Exception ex)
            {
                //  ENUtils.ShowMessage(ex.Message);
            }
        }
Esempio n. 3
0
        void grdLister_CommandCellClick(object sender, EventArgs e)
        {
            try
            {
                GridCommandCellElement gridCell = (GridCommandCellElement)sender;


                if (gridCell.ColumnInfo.Name == "btnDelete")
                {
                    GridViewRowInfo row          = grdLister.CurrentRow;
                    string          AddressName  = row.Cells[COLS.Address].Value.ToStr();
                    string          AddressLine1 = row.Cells[COLS.AddressLine1].Value.ToStr();
                    long            Id           = row.Cells[COLS.Id].Value.ToLong();
                    var             query        = General.GetObject <Gen_RecentAddress>(c => (c.Id == Id) && (c.AddressLine1.Contains(AddressName)));
                    if (query != null)
                    {
                        string[] result = query.AddressLine1.Split(new string[] { "</add>" }, StringSplitOptions.RemoveEmptyEntries);
                        if (result.Count() > 1)
                        {
                            AddressLine1 = AddressLine1.Replace(AddressName, "");
                            AddressLine1 = AddressLine1.Replace("<add></add>", "");
                            using (TaxiDataContext db = new TaxiDataContext())
                            {
                                if (!string.IsNullOrEmpty(AddressLine1))
                                {
                                    db.stp_RunProcedure("update Gen_RecentAddresses set AddressLine1='" + AddressLine1 + "' where Id=" + Id + "");
                                }
                                else
                                {
                                    db.stp_RunProcedure("delete  from Gen_RecentAddresses where Id=" + Id + "");
                                }
                            }
                        }
                        else
                        {
                            using (TaxiDataContext db = new TaxiDataContext())
                            {
                                db.stp_RunProcedure("delete  from Gen_RecentAddresses where Id=" + Id + "");
                            }
                        }

                        row.Delete();
                        //   LoadRecentAddress();
                        //query.AddressLine1.Contains("").cou
                    }
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
        private void removeAssociation_ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GridViewRowInfo row = printQueue_GridView.SelectedRows.FirstOrDefault();

            if (row != null)
            {
                GridViewCellInfo otherCell = row.Cells[QueueColumns.Name];

                RemotePrintQueue queue = _controller.Context.RemotePrintQueues.Where(x => x.Name == otherCell.Value.ToString()).FirstOrDefault();
                _controller.Context.RemotePrintQueues.Remove(queue);
                _controller.Context.SaveChanges();

                row.Delete();

                printQueue_GridView.Refresh();
            }
        }
        private void grid_CommandCellClick(object sender, EventArgs e)
        {
            try
            {
                GridCommandCellElement gridCell = (GridCommandCellElement)sender;
                string name = gridCell.ColumnInfo.Name.ToLower();

                GridViewRowInfo row = gridCell.RowElement.RowInfo;
                long            id  = row.Cells["Id"].Value.ToLong();



                //bool rtn = false;
                //if (name == "btndelete")
                //{
                //    if (DialogResult.Yes == RadMessageBox.Show("Are you sure you want to delete a Booking ? ", "", MessageBoxButtons.YesNo, RadMessageIcon.Question))
                //    {

                //        RadGridView grid = gridCell.GridControl;
                //        grid.CurrentRow.Delete();
                //    }
                //}


                if (name == "btnrecall")
                {
                    new TaxiDataContext().stp_UpdateJobStatus(id, Enums.BOOKINGSTATUS.PENDING_WEBBOOKING);
                    row.Delete();

                    (Application.OpenForms.OfType <Form>().FirstOrDefault(c => c.Name == "frmBookingDashBoard") as frmBookingDashBoard).PopulatePendingWebBookings(null);
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
Esempio n. 6
0
        private void grid_CommandCellClick(object sender, EventArgs e)
        {
            try

            {
                GridCommandCellElement gridCell = (GridCommandCellElement)sender;
                string name = gridCell.ColumnInfo.Name.ToLower();

                GridViewRowInfo row = gridCell.RowElement.RowInfo;
                long            id  = row.Cells[COLS.Id].Value.ToLong();


                if (name == "update")
                {
                    RadGridView grid = gridCell.GridControl;

                    if (grid.CurrentRow != null && grid.CurrentRow is GridViewDataRowInfo)
                    {
                        objeCustomBO = new SetCustomFaresBO();

                        objeCustomBO.GetByPrimaryKey(id);

                        if (objeCustomBO.Current != null)
                        {
                            objeCustomBO.Current.Pickup = grid.CurrentRow.Cells[COLS.Pickup].Value.ToString();

                            objeCustomBO.Current.Destination = grid.CurrentRow.Cells[COLS.Destination].Value.ToString();

                            objeCustomBO.Current.ViaPoints   = grid.CurrentRow.Cells[COLS.ViaPoints].Value.ToStr();
                            objeCustomBO.Current.DriverFares = grid.CurrentRow.Cells[COLS.DriverFares].Value.ToDecimal();


                            objeCustomBO.Current.DriverRtnFares = grid.CurrentRow.Cells[COLS.DriverRtnFares].Value.ToDecimal();
                            objeCustomBO.Current.CustomerFares  = grid.CurrentRow.Cells[COLS.CustomerFares].Value.ToDecimal();


                            objeCustomBO.Current.CustomerRtnFares = grid.CurrentRow.Cells[COLS.CustomerRtnFares].Value.ToDecimal();
                            objeCustomBO.Current.CompanyFares     = grid.CurrentRow.Cells[COLS.CompanyFares].Value.ToDecimal();


                            objeCustomBO.Current.CompanyRtnFares = grid.CurrentRow.Cells[COLS.CompanyRtnFares].Value.ToDecimal();
                            if (grid.CurrentRow.Cells[COLS.CompanyId].Value != null)
                            {
                                objeCustomBO.Current.CompanyId = grid.CurrentRow.Cells[COLS.CompanyId].Value.ToInt();
                            }

                            objeCustomBO.CheckDataValidation = false;



                            objeCustomBO.Save();
                            //   SetDisplayRecords();
                        }
                    }
                }


                else if (name == "delete")
                {
                    if (DialogResult.Yes == RadMessageBox.Show("Are you sure you want to delete Selected Booking(s) ? ", "", MessageBoxButtons.YesNo, RadMessageIcon.Question))
                    {
                        objeCustomBO = new SetCustomFaresBO();
                        objeCustomBO.GetByPrimaryKey(id);
                        objeCustomBO.Delete(objeCustomBO.Current);
                        grdFares.Refresh();
                        row.Delete();
                        //  SetDisplayRecords();
                    }
                }
            }
            catch

            {
            }
        }
        private void grid_CommandCellClick(object sender, EventArgs e)
        {
            GridCommandCellElement gridCell = (GridCommandCellElement)sender;
            string name = gridCell.ColumnInfo.Name.ToLower();

            GridViewRowInfo row = gridCell.RowElement.RowInfo;
            long            id  = row.Cells[COLS.BookingId].Value.ToLong();



            if (name == "save")
            {
                RadGridView grid = gridCell.GridControl;

                if (grid.CurrentRow != null && grid.CurrentRow is GridViewDataRowInfo)
                {
                    objMaster = new BookingBO();

                    objMaster.GetByPrimaryKey(id);

                    if (objMaster.Current != null)
                    {
                        if (objMaster.Current.MasterJobId != null)
                        {
                            objMaster.Current.Booking1.ReturnFareRate = grid.CurrentRow.Cells[COLS.Fares].Value.ToDecimal();

                            objMaster.Current.Booking1.WaitingMins = grid.CurrentRow.Cells[COLS.CompanyPrice].Value.ToDecimal();
                        }

                        objMaster.Current.FareRate = grid.CurrentRow.Cells[COLS.Fares].Value.ToDecimal();

                        objMaster.Current.CompanyPrice = grid.CurrentRow.Cells[COLS.CompanyPrice].Value.ToDecimal();

                        objMaster.Current.ParkingCharges = grid.CurrentRow.Cells[COLS.CParking].Value.ToDecimal();
                        objMaster.Current.WaitingCharges = grid.CurrentRow.Cells[COLS.CWaiting].Value.ToDecimal();


                        objMaster.Current.CongtionCharges     = grid.CurrentRow.Cells[COLS.DParking].Value.ToDecimal();
                        objMaster.Current.MeetAndGreetCharges = grid.CurrentRow.Cells[COLS.DWaiting].Value.ToDecimal();


                        objMaster.Current.DriverCommission = grid.CurrentRow.Cells[COLS.CommissionAmount].Value.ToDecimal();
                        objMaster.Current.EscortPrice      = grid.CurrentRow.Cells[COLS.EscortPrice].Value.ToDecimal();


                        objMaster.CheckCustomerValidation = false;
                        objMaster.CheckDataValidation     = false;

                        objMaster.DisableUpdateReturnJob = true;

                        objMaster.Save();
                    }
                }
            }


            else if (name == "saveandready")
            {
                RadGridView grid = gridCell.GridControl;
                objMaster = new BookingBO();

                objMaster.GetByPrimaryKey(id);

                if (objMaster.Current != null)
                {
                    if (objMaster.Current.MasterJobId != null)
                    {
                        objMaster.Current.Booking1.ReturnFareRate = grid.CurrentRow.Cells[COLS.Fares].Value.ToDecimal();
                        objMaster.Current.Booking1.WaitingMins    = grid.CurrentRow.Cells[COLS.CompanyPrice].Value.ToDecimal();
                    }


                    objMaster.Current.FareRate       = grid.CurrentRow.Cells[COLS.Fares].Value.ToDecimal();
                    objMaster.Current.CompanyPrice   = grid.CurrentRow.Cells[COLS.CompanyPrice].Value.ToDecimal();
                    objMaster.Current.ParkingCharges = grid.CurrentRow.Cells[COLS.CParking].Value.ToDecimal();
                    objMaster.Current.WaitingCharges = grid.CurrentRow.Cells[COLS.CWaiting].Value.ToDecimal();


                    objMaster.Current.CongtionCharges     = grid.CurrentRow.Cells[COLS.DParking].Value.ToDecimal();
                    objMaster.Current.MeetAndGreetCharges = grid.CurrentRow.Cells[COLS.DWaiting].Value.ToDecimal();

                    objMaster.Current.DriverCommission = grid.CurrentRow.Cells[COLS.CommissionAmount].Value.ToDecimal();

                    objMaster.Current.EscortPrice = grid.CurrentRow.Cells[COLS.EscortPrice].Value.ToDecimal();

                    objMaster.Current.IsProcessed = true;

                    objMaster.CheckCustomerValidation = false;
                    objMaster.CheckDataValidation     = false;

                    objMaster.DisableUpdateReturnJob = true;

                    objMaster.Save();
                    row.Delete();
                }
            }
        }
        void grdLocations_CommandCellClick(object sender, EventArgs e)
        {
            try
            {
                GridCommandCellElement gridCell = (GridCommandCellElement)sender;
                string name = gridCell.ColumnInfo.Name.ToLower();

                GridViewRowInfo row = gridCell.RowElement.RowInfo;

                string street   = row.Cells["Street"].Value.ToStr().Trim();
                string postCode = row.Cells["PostCode"].Value.ToStr().Trim();
                int    zoneId   = row.Cells["Zone"].Value.ToInt();

                if (zoneId == 0)
                {
                    ENUtils.ShowMessage("Plot cannot be empty");
                    return;
                }

                if (string.IsNullOrEmpty(street))
                {
                    ENUtils.ShowMessage("Street cannot be empty");
                    return;
                }



                if (string.IsNullOrEmpty(postCode))
                {
                    ENUtils.ShowMessage("PostCode cannot be empty");
                    return;
                }



                string addressQuery = string.Empty;

                if (name == "delete")
                {
                    if (DialogResult.Yes == RadMessageBox.Show("are you sure ?", "Delete", MessageBoxButtons.YesNo))
                    {
                        addressQuery = "delete from Gen_locations  where LOCATIONNAME='" + row.Cells["OldStreet"].Value.ToStr() + "' AND POSTCODE='" + row.Cells["OldPostCode"].Value.ToStr() + "';" + Environment.NewLine;


                        row.Delete();
                    }
                    else
                    {
                        return;
                    }
                }
                else if (name == "edit")
                {
                    street = street.Replace("'A", "A").ToStr().Trim().Replace("'B", "B").ToStr().Trim().Replace("'C", "C").Replace("'C", "C").ToStr().Trim()
                             .Replace("'D", "D").ToStr().Trim().Replace("'E", "E").ToStr().Trim().Replace("'F", "F").ToStr().Trim().Replace("'G", "G").ToStr().Trim().Replace("'H", "H").ToStr().Trim()
                             .Replace("'I", "I").ToStr().Trim().Replace("'J", "J").ToStr().Trim().Replace("'K", "K").ToStr().Trim().Replace("'L", "L").ToStr().Trim()
                             .Replace("'M", "M").ToStr().Trim().Replace("'N", "N").ToStr().Trim().Replace("'O", "O").ToStr().Trim().Replace("'P", "P").ToStr().Trim()
                             .Replace("'Q", "Q").ToStr().Trim().Replace("'R", "R").ToStr().Trim().Replace("'S", "S").ToStr().Trim().Replace("'T", "T").ToStr().Trim().Replace("'U", "U").ToStr().Trim()
                             .Replace("'V", "V").ToStr().Trim().Replace("'W", "W").ToStr().Trim().Replace("'X", "X").ToStr().Trim().Replace("'Y", "Y").ToStr().Trim()
                             .Replace("'Z", "Z").ToStr().Trim();

                    street = street.Replace("\r\n", "").ToStr().Trim();
                    street = street.Replace(",", "").ToStr().Trim();

                    string OLDStreet = row.Cells["OldStreet"].Value.ToStr();
                    OLDStreet = OLDStreet.Replace("'A", "''A").ToStr().Trim().Replace("'B", "''B").ToStr().Trim().Replace("'C", "''C")
                                .Replace("'D", "''D").ToStr().Trim().Replace("'E", "''E").ToStr().Trim().Replace("'F", "''F").ToStr().Trim().Replace("'G", "''G").ToStr().Trim().Replace("'H", "''H").ToStr().Trim()
                                .Replace("'I", "''I").ToStr().Trim().Replace("'J", "''J").ToStr().Trim().Replace("'K", "''K").ToStr().Trim().Replace("'L", "''L").ToStr().Trim()
                                .Replace("'M", "''M").ToStr().Trim().Replace("'N", "''N").ToStr().Trim().Replace("'O", "''O").ToStr().Trim().Replace("'P", "''P").ToStr().Trim()
                                .Replace("'Q", "''Q").ToStr().Trim().Replace("'R", "''R").ToStr().Trim().Replace("'S", "''S").ToStr().Trim().Replace("'T", "''T").ToStr().Trim().Replace("'U", "''U").ToStr().Trim()
                                .Replace("'V", "''V").ToStr().Trim().Replace("'W", "''W").ToStr().Trim().Replace("'X", "''X").ToStr().Trim().Replace("'Y", "''Y").ToStr().Trim()
                                .Replace("'Z", "''Z").ToStr().Trim();

                    addressQuery += "UPDATE GEN_LOCATIONS SET locationname='" + street + "',PostCode='" + postCode + "',ZoneId=" + zoneId + " where LOCATIONNAME='" + OLDStreet + "' AND POSTCODE='" + row.Cells["OldPostCode"].Value.ToStr() + "';" + Environment.NewLine;
                }



                // addressQuery = addressQuery.Replace("SET locationname=", "SET locationname='").ToStr().Trim();

                using (TaxiDataContext db = new TaxiDataContext())
                {
                    if (addressQuery.ToStr().Trim() != string.Empty)
                    {
                        db.stp_RunProcedure(addressQuery);
                    }
                }

                if (addressQuery.ToStr().Length > 0)
                {
                    RefreshRecords();
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
        void grdAddresses_CommandCellClick(object sender, EventArgs e)
        {
            try
            {
                GridCommandCellElement gridCell = (GridCommandCellElement)sender;
                string name = gridCell.ColumnInfo.Name.ToLower();

                GridViewRowInfo row         = gridCell.RowElement.RowInfo;
                string          fullAddress = row.Cells["FullAddress"].Value.ToStr().Trim().ToUpper();


                string street   = row.Cells["Street"].Value.ToStr().Trim().ToUpper();
                string postCode = row.Cells["PostCode"].Value.ToStr().Trim().ToUpper();

                int zoneId = row.Cells["Zone"].Value.ToInt();

                if (zoneId == 0)
                {
                    ENUtils.ShowMessage("Plot cannot be empty");
                    return;
                }

                if (string.IsNullOrEmpty(street))
                {
                    ENUtils.ShowMessage("Street cannot be empty");
                    return;
                }



                if (string.IsNullOrEmpty(postCode))
                {
                    ENUtils.ShowMessage("PostCode cannot be empty");
                    return;
                }

                string addressQuery = string.Empty;



                if (name == "delete")
                {
                    if (DialogResult.Yes == RadMessageBox.Show("are you sure ?", "Delete", MessageBoxButtons.YesNo))
                    {
                        addressQuery = "delete from GEN_ADDRESSES where addressline1='" + fullAddress + "';" + Environment.NewLine;


                        row.Delete();
                    }
                    else
                    {
                        return;
                    }
                }
                else if (name == "edit")
                {
                    street = street.Replace("'A", "A").ToStr().Trim().Replace("'B", "B").ToStr().Trim().Replace("'C", "C").Replace("'C", "C").ToStr().Trim()
                             .Replace("'D", "D").ToStr().Trim().Replace("'E", "E").ToStr().Trim().Replace("'F", "F").ToStr().Trim().Replace("'G", "G").ToStr().Trim().Replace("'H", "H").ToStr().Trim()
                             .Replace("'I", "I").ToStr().Trim().Replace("'J", "J").ToStr().Trim().Replace("'K", "K").ToStr().Trim().Replace("'L", "L").ToStr().Trim()
                             .Replace("'M", "M").ToStr().Trim().Replace("'N", "N").ToStr().Trim().Replace("'O", "O").ToStr().Trim().Replace("'P", "P").ToStr().Trim()
                             .Replace("'Q", "Q").ToStr().Trim().Replace("'R", "R").ToStr().Trim().Replace("'S", "S").ToStr().Trim().Replace("'T", "T").ToStr().Trim().Replace("'U", "U").ToStr().Trim()
                             .Replace("'V", "V").ToStr().Trim().Replace("'W", "W").ToStr().Trim().Replace("'X", "X").ToStr().Trim().Replace("'Y", "Y").ToStr().Trim()
                             .Replace("'Z", "Z").ToStr().Trim();

                    street = street.Replace("\r\n", "").ToStr().Trim();
                    street = street.Replace(",", "").ToStr().Trim();


                    string OLDaDDRESS = row.Cells["FullAddress"].Value.ToStr();

                    OLDaDDRESS = OLDaDDRESS.Replace("'A", "''A").ToStr().Trim().Replace("'B", "''B").ToStr().Trim().Replace("'C", "''C")
                                 .Replace("'D", "''D").ToStr().Trim().Replace("'E", "''E").ToStr().Trim().Replace("'F", "''F").ToStr().Trim().Replace("'G", "''G").ToStr().Trim().Replace("'H", "''H").ToStr().Trim()
                                 .Replace("'I", "''I").ToStr().Trim().Replace("'J", "''J").ToStr().Trim().Replace("'K", "''K").ToStr().Trim().Replace("'L", "''L").ToStr().Trim()
                                 .Replace("'M", "''M").ToStr().Trim().Replace("'N", "''N").ToStr().Trim().Replace("'O", "''O").ToStr().Trim().Replace("'P", "''P").ToStr().Trim()
                                 .Replace("'Q", "''Q").ToStr().Trim().Replace("'R", "''R").ToStr().Trim().Replace("'S", "''S").ToStr().Trim().Replace("'T", "''T").ToStr().Trim().Replace("'U", "''U").ToStr().Trim()
                                 .Replace("'V", "''V").ToStr().Trim().Replace("'W", "''W").ToStr().Trim().Replace("'X", "''X").ToStr().Trim().Replace("'Y", "''Y").ToStr().Trim()
                                 .Replace("'Z", "''Z").ToStr().Trim();



                    addressQuery = "update GEN_ADDRESSES SET addressline1='" + street + " " + postCode + "',PostalCode='" + postCode + "',ZoneId=" + zoneId + "  where addressline1='" + OLDaDDRESS + "';" + Environment.NewLine;
                }



                using (TaxiDataContext db = new TaxiDataContext())
                {
                    if (addressQuery.ToStr().Trim() != string.Empty)
                    {
                        db.stp_RunProcedure(addressQuery);
                    }
                }

                if (addressQuery.ToStr().Length > 0)
                {
                    if (name == "delete")
                    {
                        AppVars.listOfAddress.RemoveAll(c => c.AddressLine1 == fullAddress);

                        addresses.RemoveAll(c => c.AddressLine1 == fullAddress);
                    }
                    else if (name == "edit")
                    {
                        var obj = AppVars.listOfAddress.FirstOrDefault(c => c.AddressLine1 == fullAddress);
                        if (obj != null)
                        {
                            obj.AddressLine1 = street + " " + postCode;
                            obj.PostalCode   = postCode;


                            var obj1 = addresses.FirstOrDefault(c => c.AddressLine1 == fullAddress);
                            if (obj1 != null)
                            {
                                obj1.AddressLine1 = street + " " + postCode;
                                obj1.PostalCode   = postCode;

                                if (obj1.ZoneId != zoneId)
                                {
                                    obj.ZoneId = zoneId;

                                    obj1.ZoneId = zoneId;

                                    row.Delete();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }