Ejemplo n.º 1
0
        public frmPlotZone()
        {
            InitializeComponent();
            this.Load += new EventHandler(frmPlotZone_Load);
            objMaster  = new ZoneBO();


            this.SetProperties((INavigation)objMaster);
        }
        public frmPlotTiming()
        {
            InitializeComponent();
            this.Load            += new EventHandler(frmPlotTiming_Load);
            grdZones.CellEndEdit += new GridViewCellEventHandler(grdZones_CellEndEdit);
            objMaster             = new ZoneBO();


            this.SetProperties((INavigation)objMaster);
            this.KeyPreview             = true;
            this.KeyDown               += new KeyEventHandler(frmPlotTiming_KeyDown);
            this.FormClosing           += new FormClosingEventHandler(frmPlotTiming_FormClosing);
            this.grdZones.EnableSorting = false;
        }
Ejemplo n.º 3
0
        public frmZones()
        {
            InitializeComponent();

            objMaster = new ZoneBO();
            this.SetProperties((INavigation)objMaster);

            this.FormClosing += new FormClosingEventHandler(frmZones_FormClosing);

            this.Shown += new EventHandler(frmZones_Shown);


            ComboFunctions.FillZoneTypes(ddlType);
            FormatGrid();
        }
        public frmZonesList()
        {
            InitializeComponent();
            this.Load += new EventHandler(frmLocationList_Load);
            grdLister.CellDoubleClick += new GridViewCellEventHandler(grdLister_CellDoubleClick);
            grdLister.RowsChanging    += new Telerik.WinControls.UI.GridViewCollectionChangingEventHandler(Grid_RowsChanging);
            objMaster = new ZoneBO();

            this.SetProperties((INavigation)objMaster);

            grdLister.ShowRowHeaderColumn = false;
            this.Shown += new EventHandler(frmLocationList_Shown);

            grdLister.CommandCellClick += new CommandCellClickEventHandler(grid_CommandCellClick);
            grdLister.CellFormatting   += new CellFormattingEventHandler(grdLister_CellFormatting);
        }
        void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
            {
                objMaster = new ZoneBO();

                try
                {
                    objMaster.GetByPrimaryKey(grdLister.CurrentRow.Cells["Id"].Value.ToInt());

                    if (objMaster.Current != null)
                    {
                        int    id       = objMaster.Current.Id;
                        string zoneName = objMaster.Current.ZoneName;
                        objMaster.Delete(objMaster.Current);

                        //using (PDADataContext db = new PDADataContext())
                        //{

                        //    Zone objZone = db.Zones.FirstOrDefault(c => c.ZoneName == zoneName && c.ClientId==AppVars.objPolicyConfiguration.DefaultClientId);

                        //    if (objZone != null)
                        //    {
                        //        db.Zones.DeleteOnSubmit(objZone);
                        //        db.SubmitChanges();
                        //    }
                        //}
                    }
                }
                catch (Exception ex)
                {
                    if (objMaster.Errors.Count > 0)
                    {
                        ENUtils.ShowMessage(objMaster.ShowErrors());
                    }
                    else
                    {
                        ENUtils.ShowMessage(ex.Message);
                    }
                    e.Cancel = true;
                }
            }
        }
 private void CreateSINBINZone()
 {
     try
     {
         if (General.GetQueryable <Gen_Zone>(c => c.ZoneName == "SIN BIN").Count() == 0)
         {
             ZoneBO objZone = new ZoneBO();
             objZone.New();
             objZone.Current.ZoneName    = "SIN BIN";
             objZone.Current.ShortName   = "SIN BIN";
             objZone.Current.AddOn       = DateTime.Now;
             objZone.Current.AddBy       = AppVars.LoginObj.LuserId.ToInt();
             objZone.Current.OrderNo     = 1000;
             objZone.Current.ZoneTypeId  = 1;
             objZone.Current.PlotKind    = 1;
             objZone.CheckDataValidation = false;
             objZone.Save();
         }
     }
     catch
     {
     }
 }
        private void UpdateZones()
        {
            ZoneBO objMaster = null;

            try
            {
                objMaster = new ZoneBO();
                for (int i = 0; i < grdZones.RowCount; i++)
                {
                    int Id = grdZones.Rows[i].Cells[COL_ZONE.Id].Value.ToInt();

                    objMaster.GetByPrimaryKey(Id);
                    objMaster.Edit();

                    objMaster.Current.BlockPickup   = grdZones.Rows[i].Cells[COL_ZONE.BlockPickup].Value.ToBool();
                    objMaster.Current.BlockDropOff  = grdZones.Rows[i].Cells[COL_ZONE.BlockDropOff].Value.ToBool();
                    objMaster.Current.IsOutsideArea = grdZones.Rows[i].Cells[COL_ZONE.IsLocalArea].Value.ToBool();


                    objMaster.Save();
                    objMaster.Clear();
                }
                this.Close();
            }
            catch (Exception ex)
            {
                if (objMaster.Errors.Count > 0)
                {
                    ENUtils.ShowMessage(objMaster.ShowErrors());
                }
                else
                {
                    ENUtils.ShowMessage(ex.Message);
                }
            }
        }