예제 #1
0
        private bool deleteCarTag_Tag(int carId)
        {
            bool result = false;

            int id;

            id = carId;
            Common.BLL.Entity.GasStation.CarTag model = new Common.BLL.Entity.GasStation.CarTag()
            {
                carId = id
            };

            Common.BLL.Logic.GasStation.CarTag lCarTag = new Common.BLL.Logic.GasStation.CarTag(Common.Enum.EDatabase.GasStation);
            CommandResult resultCarTag = lCarTag.read(model, "carId");

            if (resultCarTag.status == BaseDAL.Base.EnumCommandStatus.success)
            {
                // Delete CarTag
                int           tagId    = model.tagId;
                CommandResult opResult = lCarTag.delete(model);
                if (opResult.status == BaseDAL.Base.EnumCommandStatus.success)
                {
                    //Delete Tag from tabel Tarffic
                    Common.BLL.Entity.GasStation.Traffic modelTraffic = new Common.BLL.Entity.GasStation.Traffic()
                    {
                        tagId = tagId
                    };

                    Common.BLL.Logic.GasStation.Traffic lTraffic = new Common.BLL.Logic.GasStation.Traffic(Common.Enum.EDatabase.GasStation);
                    CommandResult result1 = lTraffic.read(modelTraffic, "tagId");

                    if (result1.status == BaseDAL.Base.EnumCommandStatus.success)
                    {
                        CommandResult resultTagTraffic = lTraffic.delete(modelTraffic);
                        if (resultTagTraffic.status == BaseDAL.Base.EnumCommandStatus.success)
                        {
                            // Delete Tag from table Tag
                            Common.BLL.Entity.GasStation.Tag modelTag = new Common.BLL.Entity.GasStation.Tag()
                            {
                                id = tagId
                            };
                            Common.BLL.Logic.GasStation.Tag lTag = new Common.BLL.Logic.GasStation.Tag(Common.Enum.EDatabase.GasStation);
                            CommandResult result2 = lTag.read(modelTag, "tagId");
                            if (result2.status == BaseDAL.Base.EnumCommandStatus.success)
                            {
                                CommandResult resultTag = lTag.delete(modelTag);
                                if (resultTag.status == BaseDAL.Base.EnumCommandStatus.success)
                                {
                                    result = true;
                                }
                            }
                        }
                    }
                }
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Write tag to db
        /// </summary>
        /// <param name="tagId"></param>
        private void writeToDB(string tagId)
        {
            Common.BLL.Logic.GasStation.Traffic lTraffic = new Common.BLL.Logic.GasStation.Traffic(Common.Enum.EDatabase.GasStation);
            Common.BLL.Entity.GasStation.Tag    tag      = new Common.BLL.Entity.GasStation.Tag()
            {
                tag = tagId
            };

            lTraffic.insertTagByService(tag, serviceUser, DateTime.Now, interval);
        }
예제 #3
0
        /// <summary>
        /// Show Report
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void showButton_Click(object sender, EventArgs e)
        {
            try
            {
                string dateStart = dateStartMaskedTextBox.Text.Trim();
                string dateEnd   = dateEndMaskedTextBox.Text.Trim();
                Common.BLL.Logic.GasStation.Traffic lTraffic = new Common.BLL.Logic.GasStation.Traffic(Common.Enum.EDatabase.GasStation);
                if (ExtensionsDateTime.isValidDate(dateStart) && ExtensionsDateTime.isValidDate(dateEnd))
                {
                    DateTime date1 = ExtensionsDateTime.persianToMiladi(dateStart);
                    DateTime date2 = ExtensionsDateTime.persianToMiladi(dateEnd).Add(new TimeSpan(23, 59, 59));

                    if (typeComboBox.SelectedIndex == 0)
                    {
                        CommandResult opResult   = lTraffic.loadTraffic(date1, date2);
                        DataTable     resultData = opResult.model as DataTable;
                        result = ExtensionsDateTable.makePersianDate(resultData);
                        UserControls.StateTrafficUserControl stateTraffic = new UserControls.StateTrafficUserControl(result);
                        stateTabPage.Controls.Add(stateTraffic);
                    }
                    else if (typeComboBox.SelectedIndex == 1)
                    {
                        string nationalcode = nationalCodeMaskedTextBox.Text.Trim();

                        CommandResult opResult   = lTraffic.loadTrafficByNationalcode(date1, date2, nationalcode);
                        DataTable     resultData = opResult.model as DataTable;
                        result = ExtensionsDateTable.makePersianDate(resultData);
                        UserControls.StateTrafficUserControl stateTraffic = new UserControls.StateTrafficUserControl(result);
                        stateTabPage.Controls.Add(stateTraffic);
                    }
                    else if (typeComboBox.SelectedIndex == 2)
                    {
                        //TODO: fill plate
                        string plate = string.Empty;

                        CommandResult opResult   = lTraffic.loadTrafficByPlate(date1, date2, plate);
                        DataTable     resultData = opResult.model as DataTable;
                        result = ExtensionsDateTable.makePersianDate(resultData);
                        UserControls.StateTrafficUserControl stateTraffic = new UserControls.StateTrafficUserControl(result);
                        stateTabPage.Controls.Add(stateTraffic);
                    }


                    //resultGrid.DataSource = result;
                    //resultGrid.loadHeader(this.GetType().Name);
                }
                else
                {
                    //TODO: Date isnot Valid
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #4
0
        private void reloadTrafficByPlate(string plate)
        {
            Common.BLL.Logic.GasStation.Traffic lTraffic = new Common.BLL.Logic.GasStation.Traffic(Common.Enum.EDatabase.GasStation);
            CommandResult opResult = lTraffic.searchTrafficByPlate(plate);

            if (opResult.status == BaseDAL.Base.EnumCommandStatus.success)
            {
                DataTable result = opResult.model as DataTable;
                UserControls.TrafficUserControl car = new UserControls.TrafficUserControl(result);
                trafficTabPage.Controls.Add(car);
            }
        }
예제 #5
0
        private void writeToDB(string tagId)
        {
            int interval = 1;

            Common.BLL.Entity.GasStation.User serviceUser;

            Common.BLL.Logic.GasStation.Traffic lTraffic = new Common.BLL.Logic.GasStation.Traffic(Common.Enum.EDatabase.GasStation);
            Common.BLL.Entity.GasStation.Tag    tag      = new Common.BLL.Entity.GasStation.Tag()
            {
                tag = tagId
            };

            Common.BLL.Logic.GasStation.User lUser = new Common.BLL.Logic.GasStation.User(Common.Enum.EDatabase.GasStation);
            CommandResult opResult = lUser.getServiceUser();

            serviceUser = opResult.model as Common.BLL.Entity.GasStation.User;


            lTraffic.insertTagByService(tag, serviceUser, DateTime.Now, interval);
        }