Пример #1
0
        protected void AproveChanges(Ticket_statistic statistic, string secureID = null)
        {
            Tickets ticket = new Tickets();

            if (!string.IsNullOrEmpty(secureID))
            {
                ticket.SecureID = secureID;
                ticket.GetBySecureId();
            }
            else
            {
                ticket.ID = ID;
                ticket.GetById();
            }

            string status = string.Empty;

            TicketStatuses.TryGetValue(Convert.ToInt32(ticket.StatusID), out status);

            statistic.Status       = status;
            statistic.SecureID     = ticket.SecureID;
            statistic.UserID       = ticket.UserID;
            statistic.AgreedCost   = ticket.AgreedCost;
            statistic.GruzobozCost = ticket.GruzobozCost;
            statistic.AssessedCost = ticket.AssessedCost;
            statistic.ChangeDate   = DateTime.Now;
            statistic.Goods        = BLL.Helpers.GoodsHelper.GoodsToString(ticket.FullSecureID);

            statistic.Create();
        }
Пример #2
0
        protected Ticket_statistic CheckChanges(string statusChange)
        {
            Tickets ticket = new Tickets()
            {
                ID = ID
            };

            ticket.GetById();

            var statistic = new Ticket_statistic();

            if (statusChange == "редактирование")
            {
                bool changed = false;
                statistic.Changes = "Редактирование заявки";

                if (GruzobozCost != ticket.GruzobozCost && GruzobozCost != null)
                {
                    changed            = true;
                    statistic.Changes += String.Format(", стоимость за услугу изменена с {0} на {1}", ticket.GruzobozCost, GruzobozCost);
                }

                if (AgreedCost != ticket.AgreedCost && AgreedCost != null)
                {
                    changed            = true;
                    statistic.Changes += String.Format(", согласованная стоимость изменена с {0} на {1}", ticket.AgreedCost, AgreedCost);
                }

                if (AssessedCost != ticket.AssessedCost && AssessedCost != null)
                {
                    changed            = true;
                    statistic.Changes += String.Format(", оценочная стоимость изменена с {0} на {1}", ticket.AssessedCost, AssessedCost);
                }

                if (StatusID != ticket.StatusID && StatusID != null)
                {
                    changed = true;

                    string statusOld = string.Empty;
                    string statusNew = string.Empty;
                    TicketStatuses.TryGetValue(Convert.ToInt32(ticket.StatusID), out statusOld);
                    TicketStatuses.TryGetValue(Convert.ToInt32(StatusID), out statusNew);

                    statistic.Changes += String.Format(", статус изменен с {0} на {1}", statusOld, statusNew);
                }

                if (changed == false)
                {
                    return(null);
                }
            }
            else
            {
                statistic.Changes = "Создание заявки";
            }

            return(statistic);
        }
Пример #3
0
        public void Delete(Int32 id)
        {
            this.ID = id;
            var ticketForDelete = new Ticket_statistic()
            {
                ID = id
            };

            ticketForDelete.GetById();

            DM.DeleteData(this);
        }