コード例 #1
0
 /// <summary>
 ///     Instanciar un objeto tabla de base de datos desde un objeto historial
 /// </summary>
 /// <param name="tkDtRecords">Referencia a el elemento de la base de datos</param>
 public void FillRecordsDb(ref TK_DT_RECORDS tkDtRecords)
 {
     //tkDtRecords.TK_DT_RECORDS_ID = RecordId;
     tkDtRecords.ACTIVITY_DATE       = ActivityDate;
     tkDtRecords.CONTENT             = Content;
     tkDtRecords.TK_HD_TICKETS_ID    = TicketId;
     tkDtRecords.NOTE                = Note;
     tkDtRecords.TK_CT_STATUS_ID     = Status;
     tkDtRecords.TK_BT_EMPLOYEES_ID  = EmployeeId;
     tkDtRecords.USER_UPDATE         = UserUpdate;
     tkDtRecords.TK_CT_SERVICES_ID   = ServiceId;
     tkDtRecords.TK_CT_PRIORITIES_ID = PrioritiesId;
     tkDtRecords.TK_CT_CATEGORIES_ID = CategoryId;
 }
コード例 #2
0
 /// <summary>
 ///     Instanciar un objeto desde la informacion en la base de datos
 /// </summary>
 /// <param name="tkDtRecords">Objeto tipo tabla para obtener la infomacion desde la base de datos</param>
 public void FillRecord(TK_DT_RECORDS tkDtRecords)
 {
     RecordId     = tkDtRecords.TK_DT_RECORDS_ID;
     ActivityDate = tkDtRecords.ACTIVITY_DATE;
     Content      = tkDtRecords.CONTENT;
     TicketId     = tkDtRecords.TK_HD_TICKETS_ID;
     Note         = tkDtRecords.NOTE;
     UserUpdate   = tkDtRecords.USER_UPDATE;
     Status       = tkDtRecords.TK_CT_STATUS_ID;
     EmployeeId   = tkDtRecords.TK_BT_EMPLOYEES_ID;
     ServiceId    = tkDtRecords.TK_CT_SERVICES_ID;
     PrioritiesId = tkDtRecords.TK_CT_PRIORITIES_ID;
     CategoryId   = tkDtRecords.TK_CT_CATEGORIES_ID;
 }
コード例 #3
0
        /// <summary>
        ///     Agrega un nuevo registro en el historial de un ticket
        /// </summary>
        /// <param name="ticketRecord">Objeto con la informacion a agregar en el historial del ticket</param>
        /// <returns>TicketRegisterResult con la secuencia del nuevo registro</returns>
        public TicketRegisterResult UpdateRecord(TK_DT_RECORDS ticketRecord)
        {
            var result = new TicketRegisterResult();

            using (var db = new dbGoldenTicket())
            {
                ticketRecord.TK_DT_RECORDS_ID = GenerateRecordId(ticketRecord.TK_HD_TICKETS_ID);
                db.TK_DT_RECORDS.Add(ticketRecord);
                db.SaveChanges();

                result.SequenceNewTicket = ticketRecord.TK_DT_RECORDS_ID;
                result.Success           = true;
                result.Message           = "op_exitosa";
            }

            return(result);
        }
コード例 #4
0
        /// <summary>
        ///     Funcion que dados los datos de un ticket se crea un nuevo elemento
        ///     y su inicio en el historial
        /// </summary>
        /// <param name="ticketRecord">Objeto con los datos para el historial del ticket</param>
        /// <param name="ticket">objeto con los datos del ticket para su creacion </param>
        /// <returns>TicketRegisterResult con el folio y id del ticket nuevo</returns>
        public TicketRegisterResult CreateNewTicket(TK_HD_TICKETS ticket, TK_DT_RECORDS ticketRecord)
        {
            var result = new TicketRegisterResult();

            using (var db = new dbGoldenTicket())
            {
                db.TK_HD_TICKETS.Add(ticket);
                ticketRecord.TK_HD_TICKETS_ID = ticket.TK_HD_TICKETS_ID;
                ticketRecord.TK_DT_RECORDS_ID = GenerateRecordId(ticketRecord.TK_HD_TICKETS_ID);
                db.TK_DT_RECORDS.Add(ticketRecord);
                db.SaveChanges();

                result.FolioNewTicket = ticket.FOLIO;
                result.IdNewTicket    = ticket.TK_HD_TICKETS_ID;

                result.Success = true;
                result.Message = "op_exitosa";
            }

            return(result);
        }
コード例 #5
0
        /// <summary>
        ///     Funcion para insertar un nuevo elemento en la tabla historial
        /// </summary>
        /// <param name="customerLocation">Ubicacion del solicitante</param>
        /// <param name="employeeName">Nombre del solicitante</param>
        /// <param name="ticketRecord">Nuevo objeto para ser insertado en la base de datos </param>
        /// <param name="ticketId">Id del ticket a actualizar</param>
        /// <param name="customerEmail">Correo del solicitante</param>
        /// <param name="customerExt">Extension del solicitante</param>
        /// <param name="customerPhone">Telefono del solicitante</param>
        /// <param name="customerArea">Area del solicitante</param>
        /// <returns>Success booleano</returns>
        public TicketRegisterResult UpdateTicket(long ticketId, string customerEmail, int customerExt,
                                                 string customerPhone, string customerArea,
                                                 string customerLocation, string employeeName, TK_DT_RECORDS ticketRecord)
        {
            var result = new TicketRegisterResult();

            using (var db = new dbGoldenTicket())
            {
                if (!ticketRecord.TK_BT_EMPLOYEES_ID.IsNullOrWhiteSpace())
                {
                    var employee = new TK_BT_EMPLOYEES
                    {
                        TK_BT_EMPLOYEES_ID = ticketRecord.TK_BT_EMPLOYEES_ID,
                        FULLNAME           = employeeName
                    };

                    var employeeAux = new EmployeeRegister();
                    employeeAux.UpdateEmployee(employee);
                }

                // Actualizo la informacion de la tabla ticket
                var ticket = (
                    from tblTicket in db.TK_HD_TICKETS
                    where tblTicket.TK_HD_TICKETS_ID == ticketId
                    select tblTicket
                    ).SingleOrDefault();

                if (ticket != null)
                {
                    ticket.CUSTOMER_EMAIL     = customerEmail;
                    ticket.CUSTOMER_EXTENSION = customerExt;
                    ticket.CUSTOMER_AREA      = customerArea;
                    ticket.CUSTOMER_PHONE     = customerPhone;
                    ticket.CUSTOMER_LOCATION  = customerLocation;

                    db.SaveChanges();

                    result.CustomerEmail    = ticket.CUSTOMER_EMAIL;
                    result.CustomerFullName = ticket.CUSTOMER_FULLNAME;
                    result.FolioNewTicket   = ticket.FOLIO;
                    result.Content          = ticket.CONTENT;
                    result.Title            = ticket.TITLE;
                    result.IdNewTicket      = ticket.TK_HD_TICKETS_ID;

                    ticketRecord.TK_DT_RECORDS_ID = GenerateRecordId(ticketRecord.TK_HD_TICKETS_ID);
                    db.TK_DT_RECORDS.Add(ticketRecord);

                    result.Status   = ticketRecord.TK_CT_STATUS_ID;
                    result.Employee = ticketRecord.TK_BT_EMPLOYEES_ID;
                    result.Note     = ticketRecord.NOTE;

                    db.SaveChanges();
                }

                result.Success = true;
                result.Message = "op_exitosa";
            }

            return(result);
        }