Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        /// <summary>
        /// Insert tag
        /// </summary>
        /// <returns></returns>
        public CommandResult insertTagByService(Common.BLL.Entity.GasStation.Tag tag,
                                                Common.BLL.Entity.GasStation.User user, DateTime regDate, int intervalTime)
        {
            CommandResult result = null;

            if ((null != tag) && (null != user))
            {
                // Register new traffic
                result = BaseDAL.DBaseHelper.executeCommand(BaseDAL.Base.EnumExecuteType.procedureNonQuery, connection, C_spTrafficRegisterByService, true,
                                                            new KeyValuePair("@tagData", tag.tag),
                                                            new KeyValuePair("@insertedById", user.id),
                                                            new KeyValuePair("@trafficDate", regDate),
                                                            new KeyValuePair("@intervalTime", intervalTime)
                                                            );
            }
            else
            {
                result = CommandResult.makeNullDataResult();
            }

            return(result);
        }