Example #1
0
    protected void btnSure_Click(object sender, EventArgs e)
    {
        TerminalEntity entity = new TerminalEntity();

        WebFormHelper.GetDataFromForm(this, entity);
        // entity.MachineMac = FT.Commons.Web.Tools.WebToolsHelper.GetMac(entity.MachineIp);
        //entity.StartDate = Convert.ToDateTime(this.txtBeginDate.Value.ToString());
        // entity.EndDate = Convert.ToDateTime(this.txtEndDate.Value.ToString());
        if (entity.Id < 0)
        {
            if (SimpleOrmOperator.Create(entity))
            {
                TerminalOnlineMonitorThread.InitTerminalList();
                WebTools.Alert(this, "添加成功!");
            }
            else
            {
                WebTools.Alert("添加失败!");
            }
        }
        else
        {
            if (SimpleOrmOperator.Update(entity))
            {
                TerminalOnlineMonitorThread.InitTerminalList();
                WebTools.Alert(this, "修改成功!");
            }
            else
            {
                WebTools.Alert("修改失败!");
            }
        }
    }
Example #2
0
        protected virtual TerminalEntity GetByTerminalFromReader(IDataReader reader)
        {
            TerminalEntity entity_Terminal = null;

            try
            {
                entity_Terminal                 = new TerminalEntity();
                entity_Terminal.SAN             = (long?)(GetFromReader(reader, "SAN"));
                entity_Terminal.IdSuscriptor    = (long?)(GetFromReader(reader, "IdSuscriptor"));
                entity_Terminal.IdServicio      = (int?)(GetFromReader(reader, "IdServicio"));
                entity_Terminal.Latitud         = (String)(GetFromReader(reader, "Latitud", IsString: true));
                entity_Terminal.Longitud        = (String)(GetFromReader(reader, "Longitud", IsString: true));
                entity_Terminal.Estatus         = (String)(GetFromReader(reader, "Estatus", IsString: true));
                entity_Terminal.FechaAlta       = (String)(GetFromReader(reader, "FechaAlta", IsString: true));
                entity_Terminal.FechaSuspension = (String)(GetFromReader(reader, "FechaSuspension", IsString: true));
                entity_Terminal.ESN             = (String)(GetFromReader(reader, "ESN", IsString: true));
                entity_Terminal.Comentarios     = (String)(GetFromReader(reader, "Comentarios", IsString: true));
                entity_Terminal.Suscriptor      = (String)(GetFromReader(reader, "Suscriptor", IsString: true));
                entity_Terminal.Servicio        = (String)(GetFromReader(reader, "Servicio", IsString: true));
                entity_Terminal.SatellitedID    = (String)(GetFromReader(reader, "SatellitedID", IsString: true));
                entity_Terminal.BeamID          = (int?)(GetFromReader(reader, "BeamID"));
                entity_Terminal.Polarization    = (String)(GetFromReader(reader, "Polarization", IsString: true));
            }
            catch (Exception ex)
            {
                throw new Exception("Error converting Terminal data to entity", ex);
            }
            return(entity_Terminal);
        }
Example #3
0
    protected void dgLists_ItemCommand(object source, DataGridCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            int id = Convert.ToInt32(e.CommandArgument);
            FT.DAL.DataAccessFactory.GetDataAccess().ExecuteSql("delete from yuantuo_terminals where id=" + id);
            WebTools.Alert(this, "删除成功!");
            TerminalOnlineMonitorThread.InitTerminalList();
            this.ProcedurePager1.Changed = true;
        }
        else if (e.CommandName == "Detail")
        {
            int id = Convert.ToInt32(e.CommandArgument);
            this.Pop(id);
        }
        else if (e.CommandName == "Open")
        {
            int            id     = Convert.ToInt32(e.CommandArgument);
            TerminalEntity entity = SimpleOrmOperator.Query <TerminalEntity>(id);
            FT.Commons.Tools.WindowExHelper.WakeUp(entity.MachineMac);
            WebTools.Alert(this, "已给终端" + entity.MachineName + "发送开机命令,请稍等片刻!!!");
        }
        else if (e.CommandName == "Close")
        {
            int            id     = Convert.ToInt32(e.CommandArgument);
            TerminalEntity entity = SimpleOrmOperator.Query <TerminalEntity>(id);
            WholeBllTools.CloseComputer(entity.MachineIp);
            WebTools.Alert(this, "已给终端" + entity.MachineName + "发送关机命令,请稍等片刻!!!");

            // FT.Commons.Tools.WindowExHelper.WakeUp(entity.MachineMac);
        }
    }
Example #4
0
        /// <summary>
        /// Edits a Terminal
        ///</summary>
        /// <param name="Terminal"> Objeto Terminal a editar </param>
        public override int EditTerminal(TerminalEntity entity_Terminal)
        {
            int result = 0;

            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.Terminal.ConnectionString))
            {
                SqlCommand comandoSql = CreateCommand("Softv_TerminalEdit", connection);

                AssingParameter(comandoSql, "@SAN", entity_Terminal.SAN);

                AssingParameter(comandoSql, "@IdSuscriptor", entity_Terminal.IdSuscriptor);

                AssingParameter(comandoSql, "@IdServicio", entity_Terminal.IdServicio);

                AssingParameter(comandoSql, "@Latitud", entity_Terminal.Latitud);

                AssingParameter(comandoSql, "@Longitud", entity_Terminal.Longitud);

                AssingParameter(comandoSql, "@Estatus", entity_Terminal.Estatus);

                AssingParameter(comandoSql, "@FechaAlta", entity_Terminal.FechaAlta);

                AssingParameter(comandoSql, "@FechaSuspension", entity_Terminal.FechaSuspension);

                AssingParameter(comandoSql, "@ESN", entity_Terminal.ESN);

                AssingParameter(comandoSql, "@Comentarios", entity_Terminal.Comentarios);

                AssingParameter(comandoSql, "@SatellitedID", entity_Terminal.SatellitedID);

                AssingParameter(comandoSql, "@BeamID", entity_Terminal.BeamID);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }

                    result = int.Parse(ExecuteNonQuery(comandoSql).ToString());
                }
                catch (Exception ex)
                {
                    throw new Exception("Error updating Terminal " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                }
            }
            return(result);
        }
Example #5
0
        /// <summary>
        ///</summary>
        /// <param name="Terminal"> Object Terminal added to List</param>
        public override int AddTerminal(TerminalEntity entity_Terminal)
        {
            int result = 0;

            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.Terminal.ConnectionString))
            {
                SqlCommand comandoSql = CreateCommand("Softv_TerminalAdd", connection);

                AssingParameter(comandoSql, "@SAN", null, pd: ParameterDirection.Output, IsKey: true);

                AssingParameter(comandoSql, "@IdSuscriptor", entity_Terminal.IdSuscriptor);

                AssingParameter(comandoSql, "@IdServicio", entity_Terminal.IdServicio);

                AssingParameter(comandoSql, "@Latitud", entity_Terminal.Latitud);

                AssingParameter(comandoSql, "@Longitud", entity_Terminal.Longitud);

                AssingParameter(comandoSql, "@Estatus", entity_Terminal.Estatus);

                AssingParameter(comandoSql, "@FechaAlta", entity_Terminal.FechaAlta);

                AssingParameter(comandoSql, "@FechaSuspension", entity_Terminal.FechaSuspension);

                AssingParameter(comandoSql, "@ESN", entity_Terminal.ESN);

                AssingParameter(comandoSql, "@Comentarios", entity_Terminal.Comentarios);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    result = ExecuteNonQuery(comandoSql);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error adding Terminal " + ex.Message, ex);
                }
                finally
                {
                    connection.Close();
                }
                result = (int)comandoSql.Parameters["@SAN"].Value;
            }
            return(result);
        }
Example #6
0
        public static TerminalEntity GetOneDeep(long?SAN)
        {
            TerminalEntity result = ProviderSoftv.Terminal.GetTerminalById(SAN);

            //if (result.IdServicio != null)
            //    result.Servicio = ProviderSoftv.Servicio.GetServicioById(result.IdServicio);

            //if (result.IdSuscriptor != null)
            //    result.Suscriptor = ProviderSoftv.Suscriptor.GetSuscriptorById(result.IdSuscriptor);

            //if (result.SAN != null)
            //    result.Movimiento = ProviderSoftv.Movimiento.GetMovimientoById(result.SAN);

            //if (result.SAN != null)
            //    result.Ticket = ProviderSoftv.Ticket.GetTicketById(result.SAN);

            return(result);
        }
Example #7
0
 public int?UpdateTerminalInformacionAdicional(TerminalEntity objTerminal)
 {
     if (WebOperationContext.Current.IncomingRequest.Method == "OPTIONS")
     {
         return(null);
     }
     else
     {
         try
         {
             return(Terminal.TerminalInformacionAdicional(objTerminal));
         }
         catch (Exception ex)
         {
             throw new WebFaultException <string>(ex.Message, HttpStatusCode.ExpectationFailed);
         }
     }
 }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         GobalTools.BindCity(this.cbCityCodeValue);
         GobalTools.BindTerminalGroup(this.cbMachineGroupIdValue);
         if (Request.Params["id"] != null)
         {
             TerminalEntity entity = SimpleOrmOperator.Query <TerminalEntity>(Convert.ToInt32(Request.Params["id"]));
             WebFormHelper.SetDataToForm(this, entity);
             this.lbLastOnlineTime.Text     = DateTimeHelper.DtToLongString(entity.LastOnlineTime);
             this.lbLastOutlineTime.Text    = DateTimeHelper.DtToLongString(entity.LastOutlineTime);
             this.lbCurrentStatus.ForeColor = Color.Red;
             this.lbCurrentStatus.Text      = string.Format("({0})", FT.Commons.Tools.WindowExHelper.CanConnectionTo(entity.MachineIp)?"在线":"不在线");
         }
         else
         {
         }
     }
 }
Example #9
0
        /// <summary>
        /// Gets Terminal by
        ///</summary>
        public override TerminalEntity GetTerminalById(long?SAN)
        {
            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.Terminal.ConnectionString))
            {
                SqlCommand     comandoSql      = CreateCommand("Softv_TerminalGetById", connection);
                TerminalEntity entity_Terminal = null;


                AssingParameter(comandoSql, "@SAN", SAN);

                IDataReader rd = null;
                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow);
                    if (rd.Read())
                    {
                        entity_Terminal = GetTerminalFromReader(rd);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("Error getting data Terminal " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    if (rd != null)
                    {
                        rd.Close();
                    }
                }
                return(entity_Terminal);
            }
        }
Example #10
0
        public override int TerminalInformacionAdicional(TerminalEntity entity_Terminal)
        {
            int result = 0;

            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.Terminal.ConnectionString))
            {
                SqlCommand comandoSql = CreateCommand("TerminalInformacionAdicional", connection);

                AssingParameter(comandoSql, "@SatelliteID", entity_Terminal.SatellitedID);

                AssingParameter(comandoSql, "@BeamID", entity_Terminal.BeamID);

                AssingParameter(comandoSql, "@SAN", entity_Terminal.SAN);

                AssingParameter(comandoSql, "@Polarization", entity_Terminal.Polarization);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }

                    result = int.Parse(ExecuteNonQuery(comandoSql).ToString());
                }
                catch (Exception ex)
                {
                    throw new Exception("Error updating Terminal " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                }
            }
            return(result);
        }
Example #11
0
        public static int Edit(TerminalEntity objTerminal)
        {
            int result = ProviderSoftv.Terminal.EditTerminal(objTerminal);

            return(result);
        }
Example #12
0
 public abstract int TerminalInformacionAdicional(TerminalEntity entity_Terminal);
Example #13
0
 /// <summary>
 /// Abstract method to update Terminal
 /// </summary>
 public abstract int EditTerminal(TerminalEntity entity_Terminal);
Example #14
0
 /// <summary>
 /// Abstract method to add Terminal
 ///  /summary>
 /// <param name="Terminal"></param>
 /// <returns></returns>
 public abstract int AddTerminal(TerminalEntity entity_Terminal);
Example #15
0
        public static int TerminalInformacionAdicional(TerminalEntity objTerminal)
        {
            int result = ProviderSoftv.Terminal.TerminalInformacionAdicional(objTerminal);

            return(result);
        }
Example #16
0
        public static TerminalEntity GetByTerminal(long?SAN)
        {
            TerminalEntity result = ProviderSoftv.Terminal.GetByTerminal(SAN);

            return(result);
        }
Example #17
0
        public static int Add(TerminalEntity objTerminal)
        {
            int result = ProviderSoftv.Terminal.AddTerminal(objTerminal);

            return(result);
        }