Example #1
0
 public void GravarImei(Imei imei)
 {
     if (imei.id == 0)
     {
         context.Tbl_Imei.Add(imei);
     }
     else
     {
         context.Entry(imei).State = EntityState.Modified;
     }
     context.SaveChanges();
 }
Example #2
0
 public override int GetHashCode()
 {
     return(base.GetHashCode() ^
            IsSuccess.GetHashCode() ^
            State.GetHashCode() ^
            Manufacturer.GetHashCode() ^
            ModelName.GetHashCode() ^
            SerialNumber.GetHashCode() ^
            SignalQuality.GetHashCode() ^
            Imsi.GetHashCode() ^
            Imei.GetHashCode() ^
            OperatorName.GetHashCode());
 }
Example #3
0
        private ActionResult ObterDetalhesImei(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Imei imei = imeiServico.ObterImeiPorId((long)id);

            if (imei == null)
            {
                return(HttpNotFound());
            }
            return(View(imei));
        }
Example #4
0
        /*######################## EDITAR #############################*/
        public ActionResult Edit(long id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Imei imei = imeiServico.ObterImeiPorId(id);

            if (imei == null)
            {
                return(Renderiza(HttpNotFound()));
            }
            ViewBag.aparelhoId = new SelectList(aparelhoServico.ObterAparelhosClassificadosPorNome(), "id", "modelo", imei.aparelhoId);
            return(Renderiza(imei));
        }
Example #5
0
        public override Task <StationResponse> GetItemStations(Imei request, ServerCallContext context)
        {
            List <Station> stations = new List <Station>()
            {
                new Station {
                    Name = "download"
                }, new Station {
                    Name = "packing"
                }
            };
            StationResponse response = new StationResponse();

            response.Stations.Add(stations);
            return(Task.FromResult(response));
        }
Example #6
0
 private ActionResult GravarImei(Imei imei)
 {
     try
     {
         if (ModelState.IsValid)
         {
             imeiServico.GravarImei(imei);
             return(RedirectToAction("Index"));
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(imei));
     }
 }
        public Boolean add()
        {
            string qryStringMember;

            qryStringMember = "Insert into tbl_repair (customer_name, contact_no, item_name, issue, imei, downpayment, repair_price, status, store_representative, date_added) VALUES (@customer_name, @contact_no, @item_name, @issue, @imei, @downpayment, @repair_price, @status, @store_representative, NOW())";

            try
            {
                Connect.CnSql = new MySqlConnection(Connect.ConnStr);
                Connect.CnSql.Open(); Connect.CmSql = new MySqlCommand(qryStringMember, Connect.CnSql);
                Connect.CmSql.Parameters.AddWithValue("@customer_name", CustomerName.Trim());
                Connect.CmSql.Parameters.AddWithValue("@contact_no", ContactNo.Trim());
                Connect.CmSql.Parameters.AddWithValue("@item_name", ItemName.Trim());
                Connect.CmSql.Parameters.AddWithValue("@issue", Issue.Trim());
                Connect.CmSql.Parameters.AddWithValue("@imei", Imei.Trim());
                Connect.CmSql.Parameters.AddWithValue("@downpayment", Downpayment);
                Connect.CmSql.Parameters.AddWithValue("@repair_price", RepairPrice);
                Connect.CmSql.Parameters.AddWithValue("@status", Status.Trim());
                Connect.CmSql.Parameters.AddWithValue("@store_representative", StoreRepresentative);


                Trans = Connect.CnSql.BeginTransaction();
                Connect.CmSql.Transaction = Trans;
                Connect.CmSql.ExecuteNonQuery();
                Trans.Commit();
                return(true);
            }
            catch (MySqlException e)
            {
                XtraMessageBox.Show(e.Message, "SQL Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Trans.Rollback();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "General Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Trans.Rollback();
            }
            finally
            {
                Connect.CnSql.Close();
                Connect.CnSql.Dispose();
                Connect.CmSql.Dispose();
                Connect.CmSql = null;
                Connect.DrSql = null;
            }
            return(false);
        }
        /*######################## DETALHES #############################*/
        public ActionResult Details(long id)
        {
            if (id == 0)
            {
                return(Renderiza(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }

            Avaliacao avaliacao = avaliacaoServico.ObterAvaliacaoPorId(id);
            Imei      imei      = imeiServico.ObterImeiPorId(avaliacao.imeiId);
            Aparelho  aparelho  = aparelhoServico.ObterAparelhoPorId((int)imei.aparelhoId);

            ViewBag.Aparelho = aparelho.modelo;
            if (avaliacao == null)
            {
                return(Renderiza(HttpNotFound()));
            }
            return(Renderiza(avaliacao));
        }
        public IHttpActionResult URoute([FromBody] Imei imei)
        {
            try
            {
                var response = checkRequst();

                if (response.result)
                {
                    SqlConnection con = new SqlConnection(helper.Strcon);
                    con.Open();
                    DataSet    ds  = new DataSet();
                    SqlCommand cmd = new SqlCommand("sp_Update_RouteSM", con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@imeiOld", imei.oldimei.Trim());
                    cmd.Parameters.AddWithValue("@imeiNew", imei.newimei.Trim());
                    DataTable      dt = new DataTable();
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(dt);
                    con.Close();
                    #region
                    var Status = dt;
                    #endregion
                    return(Json <DataTable>(Status));
                }
                else if (response.res == "400")
                {
                    return(Json <string>(Convert.ToString(Request.CreateResponse(HttpStatusCode.BadRequest))));
                }
                else //401
                {
                    return(Json <string>(Convert.ToString(Request.CreateResponse(HttpStatusCode.Unauthorized))));
                }
            }
            catch (Exception ex)
            {
                DataTable dtNew = new DataTable();
                dtNew.Columns.Add("Result", typeof(string));
                dtNew.Rows.Add("Error : " + ex.ToString());
                return(Json <DataTable>(dtNew));
            }
        }
Example #10
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            var oth = obj as ModemStatus;

            if (oth == null)
            {
                return(false);
            }
            return(IsSuccess == oth.IsSuccess &&
                   State.Equals(oth.State) &&
                   Manufacturer.Equals(oth.Manufacturer) &&
                   ModelName.Equals(oth.ModelName) &&
                   SerialNumber.Equals(oth.SerialNumber) &&
                   SignalQuality == oth.SignalQuality &&
                   Imsi.Equals(oth.Imsi) &&
                   Imei.Equals(oth.Imei) &&
                   OperatorName.Equals(oth.OperatorName));
        }
Example #11
0
        public override int GetHashCode()
        {
            unchecked
            {
                const int HashingBase       = (int)2166136261;
                const int HashingMultiplier = 16777619;

                int hash = HashingBase;
                hash = (hash * HashingMultiplier) ^ OrderNo.GetHashCode();
                hash = (hash * HashingMultiplier) ^ ((DateFrom != null) ? DateFrom.GetHashCode() : 0);
                hash = (hash * HashingMultiplier) ^ ((DateTo != null) ? DateTo.GetHashCode() : 0);
                hash = (hash * HashingMultiplier) ^ CustomerName.GetHashCode();
                hash = (hash * HashingMultiplier) ^ VehicleType.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Address.GetHashCode();
                hash = (hash * HashingMultiplier) ^ ProjectNo.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Imei.GetHashCode();
                hash = (hash * HashingMultiplier) ^ TrackerName.GetHashCode();
                hash = (hash * HashingMultiplier) ^ AddressLatitude.GetHashCode();
                hash = (hash * HashingMultiplier) ^ AddressLongitude.GetHashCode();
                return(hash);
            }
        }
Example #12
0
        public override int GetHashCode()
        {
            unchecked
            {
                const int HashingBase       = (int)2166136261;
                const int HashingMultiplier = 16777619;

                int hash = HashingBase;
                hash = (hash * HashingMultiplier) ^ GpsName.GetHashCode();
                hash = (hash * HashingMultiplier) ^ GpsStatus.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Imei.GetHashCode();
                hash = (hash * HashingMultiplier) ^ LastDate.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Battery.GetHashCode();
                hash = (hash * HashingMultiplier) ^ ElapsedTime.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Distance.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Imei.GetHashCode();
                hash = (hash * HashingMultiplier) ^ GoogleDistance.GetHashCode();
                hash = (hash * HashingMultiplier) ^ LastLatitude.GetHashCode();
                hash = (hash * HashingMultiplier) ^ LastLongitude.GetHashCode();
                hash = (hash * HashingMultiplier) ^ ((LatLngList != null) ? LatLngList.GetHashCode() : 0);
                return(hash);
            }
        }
Example #13
0
 public override int GetHashCode() => base.GetHashCode() ^ (Imei != null ? Imei.GetHashCode() : 1955087533) ^ (Data != null ? Data.GetHashCode() : 1955087533);
Example #14
0
 public ActionResult Create(Imei imei)
 {
     return(GravarImei(imei));
 }
Example #15
0
 public ActionResult Edit(Imei imei)
 {
     return(GravarImei(imei));
 }
Example #16
0
 public void GravarImei(Imei imei)
 {
     imeiDAL.GravarImei(imei);
 }