Example #1
0
        protected override void OnSaving()
        {
            if (TipoSolicitud == BusinessObjects.TipoSolicitud.SolicitudLubricantes)
            {
                this.EstadoSolicitud = BusinessObjects.EstadoSolicitud.Finalizada;
            }

            if (CodSolicitud == 0)
            {
                RequiereInicializacionGeneradorDeCodigos NombreDeSecuencia = this.ClassInfo.FindAttributeInfo(typeof(RequiereInicializacionGeneradorDeCodigos)) as RequiereInicializacionGeneradorDeCodigos;
                if (!ReferenceEquals(NombreDeSecuencia, null))
                {
                    CodSolicitud = Secuencias.GetNextValue(this.Session.DataLayer, NombreDeSecuencia.id);
                }


                this.Equipo = Automovil.NumeroEquipo;
                this.Placa  = Automovil.NumeroPlaca;
            }


            if (!ReferenceEquals(UsuarioCreador, null))
            {
                UsuarioCreador = CurrentUserLoged.UserName;
                FechaDeIngreso = DateTime.Now;
            }
        }
Example #2
0
        public object Delete(Secuencias deleted)
        {
            string msgError = "";
            bool   result   = repository.Remove(deleted, ref msgError);

            object json = new
            {
                success = result,
                message = msgError
            };

            return(json);
        }
Example #3
0
        protected void UiVistaCargaSecuencia_BatchUpdate(object sender, DevExpress.Web.Data.ASPxDataBatchUpdateEventArgs e)
        {
            if (!ValidarConexionYUsuarioLogueado(sender))
            {
                return;
            }

            var listaDeModificados = new List <Frecuencia>();

            foreach (var item in e.UpdateValues)
            {
                var registro = Secuencias.FirstOrDefault(p => p.ID_FREQUENCY == int.Parse(item.Keys["ID_FREQUENCY"].ToString()) && p.CODE_CUSTOMER == item.Keys["CODE_CUSTOMER"].ToString());
                if (registro == null)
                {
                    continue;
                }
                registro.SUNDAY          = int.Parse(item.NewValues["SUNDAY"].ToString());
                registro.MONDAY          = int.Parse(item.NewValues["MONDAY"].ToString());
                registro.TUESDAY         = int.Parse(item.NewValues["TUESDAY"].ToString());
                registro.WEDNESDAY       = int.Parse(item.NewValues["WEDNESDAY"].ToString());
                registro.THURSDAY        = int.Parse(item.NewValues["THURSDAY"].ToString());
                registro.FRIDAY          = int.Parse(item.NewValues["FRIDAY"].ToString());
                registro.SATURDAY        = int.Parse(item.NewValues["SATURDAY"].ToString());
                registro.PRIORITY        = int.Parse(item.NewValues["PRIORITY"].ToString());
                registro.FREQUENCY_WEEKS = int.Parse(item.NewValues["FREQUENCY_WEEKS"].ToString());

                listaDeModificados.Add(registro);
            }
            if (listaDeModificados.Count > 0)
            {
                UsuarioDeseaActualizarSecuencia?.Invoke(sender,
                                                        new FrecuenciaArgumento
                {
                    XmlDocumentos = ObtenerXmlDeListadoDeSecuencia(listaDeModificados),
                    UserID        = Session["LOGIN"].ToString()
                });
            }
            else
            {
                TerminoProceso("cpTerminoDeProcesarInformacionDesdeExcel", true, sender);
            }
            e.Handled = true;
        }
Example #4
0
        public object Post(Secuencias added)
        {
            object json;
            string messageError = "";

            try
            {
                Secuencias posted = repository.Add(added, ref messageError);

                if (posted != null)
                {
                    json = new
                    {
                        total   = 1,
                        data    = posted,
                        success = true
                    };
                }
                else
                {
                    json = new
                    {
                        message = messageError,
                        success = false
                    };
                };
            }
            catch (Exception ex)
            {
                LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message);

                object error = new { message = ex.Message };

                json = new
                {
                    message = ex.Message,
                    success = false
                };
            };

            return(json);
        }
Example #5
0
        public object GetAll()
        {
            var queryValues = Request.RequestUri.ParseQueryString();

            int page  = Convert.ToInt32(queryValues["page"]);
            int start = Convert.ToInt32(queryValues["start"]);
            int limit = Convert.ToInt32(queryValues["limit"]);
            int id    = Convert.ToInt32(queryValues["id"]);
            int orden = Convert.ToInt32(queryValues["orden"]);


            #region Configuramos el orden de la consulta si se obtuvo como parametro
            string strOrder = !string.IsNullOrWhiteSpace(queryValues["sort"]) ? queryValues["sort"] : "";
            strOrder = strOrder.Replace('[', ' ');
            strOrder = strOrder.Replace(']', ' ');

            Sort sort;

            if (!string.IsNullOrWhiteSpace(strOrder))
            {
                sort = JsonConvert.DeserializeObject <Sort>(strOrder);
            }
            else
            {
                sort = new Sort();
            }
            #endregion

            string query = !string.IsNullOrWhiteSpace(queryValues["query"]) ? queryValues["query"] : "";

            int totalRecords = 0;

            try
            {
                if (id == 0)
                {
                    object             json;
                    string             msgError = "";
                    IList <Secuencias> lista;

                    lista = repository.GetList(query, sort, page, start, limit, ref totalRecords, ref msgError);

                    json = new
                    {
                        total   = totalRecords,
                        data    = lista,
                        success = true
                    };

                    return(json);
                }
                else
                {
                    string     msgError = "";
                    Secuencias estatus  = repository.Get(id, ref msgError);

                    object json = new
                    {
                        data    = estatus,
                        success = true,
                        message = msgError
                    };

                    return(json);
                }
            }
            catch (Exception ex)
            {
                LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message);

                object error = new { message = ex.Message };

                object json = new
                {
                    message = ex.Message,
                    success = false
                };

                return(json);
            }
        }