Пример #1
0
        public JsonResult New(AD_UserEquipment ue)
        {
            Response res = new Response();

            try
            {
                AD_UserEquipmentsBL ueb = new AD_UserEquipmentsBL();
                ue.IsActive = true;
                if (ue.UEId > 0)
                {
                    ueb.Manage("Update", ue);
                }
                else
                {
                    ueb.Manage("Insert", ue);
                }
                res.Status  = "success";
                res.Message = "save successfully";
            }
            catch (Exception ex)
            {
                res.Status  = "danger";
                res.Message = ex.Message;
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult Devices(string filter, string value)
        {
            if (filter == "Issue")
            {
                AD_UserEquipmentsBL ueb = new AD_UserEquipmentsBL();

                //var rec = ueb.SelectedList("ReturnedDevice", value, null);
                var rec = ueb.SelectedList("AvailableDevices", value, null);
                return(Json(rec, JsonRequestBehavior.AllowGet));
            }
            else if (filter == "Transfer")
            {
                AD_UserEquipmentsBL ueb = new AD_UserEquipmentsBL();

                var rec = ueb.SelectedList("IssuedDevice", value, null);
                return(Json(rec, JsonRequestBehavior.AllowGet));
            }
            else if (filter == "Return")
            {
                Sec_UserDevicesBL udb = new Sec_UserDevicesBL();
                var rec = udb.SelectedList("byUserId", value, null, "Devices");
                return(Json(rec, JsonRequestBehavior.AllowGet));
            }
            return(null);
        }
Пример #3
0
        public ActionResult ToList(string filter, string value, string value2, string value3)
        {
            AD_UserEquipmentsBL ueb = new AD_UserEquipmentsBL();

            var rec = ueb.ToList(filter, value, value2, value3);

            return(Json(new { data = rec }, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        public ActionResult Paging(int current, int rowCount, string searchPhrase)
        {
            AD_UserEquipmentsBL ueb = new AD_UserEquipmentsBL();
            Int64 count             = 0;

            current  = (current == 0) ? 1 : current;
            rowCount = (rowCount == 0) ? 5 : rowCount;
            int offset = (current - 1) * rowCount;
            var rec    = ueb.Paging(offset, rowCount, searchPhrase, ref count);

            return(Json(new { current = current, total = count, rows = rec, rowCount = rowCount }, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public ActionResult Edit(Int64 id)
        {
            AD_DefinationBL db = new AD_DefinationBL();

            ViewBag.UETypes = db.SelectedList("byDefinationType", "UE Type", "-select Device-");
            AD_UserEquipmentsBL ueb = new AD_UserEquipmentsBL();

            ClientsBL cBl = new ClientsBL();

            ViewBag.UEOwner = cBl.SelectedList("All", null, "-Select Owner-");

            return(View("new", ueb.ToSingle("ById", id.ToString())));
        }
Пример #6
0
        public ActionResult Movement()
        {
            string TransType = "";

            if (Request.QueryString["UEId"] != null)
            {
                ViewBag.UEId = Convert.ToInt32(Request.QueryString["UEId"]);
            }

            if (Request.QueryString["UserId"] != null)
            {
                ViewBag.UserId = Request.QueryString["UserId"];
            }

            if (Request.QueryString["UETypeId"] != null)
            {
                ViewBag.UETypeId = Request.QueryString["UETypeId"];
            }


            if (Request.QueryString["UEsts"] != null)
            {
                TransType = Request.QueryString["UEsts"];
            }

            AD_DefinationBL db = new AD_DefinationBL();

            ViewBag.UEStatus = db.SelectedList("byDefinationType", "UE Status", "-Transaction Type-");

            foreach (var v in ViewBag.UEStatus)
            {
                if (v.Text == TransType)
                {
                    ViewBag.UEsts = v.Value;
                }
            }

            ViewBag.UETypes = db.SelectedList("byDefinationType", "UE Type", "-select-");

            AD_UserEquipmentsBL ueb = new AD_UserEquipmentsBL();

            ViewBag.Equipments = ueb.SelectedList("All", "", "-select-");

            Sec_UserBL ub = new Sec_UserBL();

            ViewBag.Users = ub.SelectedList("ByStatus", true.ToString(), "-Users-");

            ViewBag.IssueToUsers = ub.SelectedList("ByStatus", true.ToString(), "-Users-");

            return(View());
        }
Пример #7
0
        public Response IdleUE(string IMEI, int Duration, string TestType)
        {
            Response r = new Response();

            try
            {
                AV_UEPbxBL ueb = new AV_UEPbxBL();

                var rec = ueb.ToSingle("byIsIdle", true.ToString());
                if (rec != null)
                {
                    AD_UserEquipmentsBL ueqb = new AD_UserEquipmentsBL();
                    var uerec = ueqb.ToSingle("BySerialNo", IMEI);
                    if (uerec != null)
                    {
                        SendMessage(rec.DeviceToken, uerec.UENumber, Duration, TestType);
                        r.Status  = "success";
                        r.Message = "success";
                    }
                    else
                    {
                        r.Status  = "error";
                        r.Message = "Device number not found!.";
                    }
                }
                else
                {
                    r.Status  = "error";
                    r.Message = "Server busy.";
                }
            }
            catch (Exception ex)
            {
                r.Status  = "error";
                r.Message = ex.Message;
            }

            return(r);
        }
Пример #8
0
        public Response SetDeviceNumber(string IMEI, string DeviceNumber)
        {
            Response r = new Response();

            try
            {
                AD_UserEquipmentsBL ueb = new AD_UserEquipmentsBL();
                AD_UserEquipment    ue  = new AD_UserEquipment();
                ue.SerialNo = IMEI;
                ue.UENumber = DeviceNumber.Trim();
                ueb.Manage("Set_DeviceNumber", ue);

                r.Status  = "success";
                r.Message = "success";
            }
            catch (Exception ex)
            {
                r.Status  = "error";
                r.Message = ex.Message;
            }
            return(r);
        }
Пример #9
0
        public Response ChangeToken(string IMEI, string Token)
        {
            Response r = new Response();

            try
            {
                AD_UserEquipmentsBL ueb = new AD_UserEquipmentsBL();
                AD_UserEquipment    ue  = new AD_UserEquipment();
                ue.SerialNo = IMEI;
                ue.Token    = Token;

                ueb.Manage("Set_Token", ue);

                r.Status  = "success";
                r.Message = "success";
            }
            catch (Exception ex)
            {
                r.Status  = "error";
                r.Message = ex.Message;
            }

            return(r);
        }
Пример #10
0
        public JsonResult Movement(List <AD_UEMovement> mov, string UEStatus)
        {
            Response res = new Response();

            try
            {
                AD_UEMovementBL ueb = new AD_UEMovementBL();

                foreach (var item in mov)
                {
                    ueb.Manage(UEStatus, item);
                }

                //------------------------------
                if (UEStatus == "Issue")
                {
                    long UEId   = mov.Select(x => x.UEId).Single();
                    long UserId = mov.Select(x => x.UserId).Single();

                    AD_UserEquipmentsBL uebl = new AD_UserEquipmentsBL();
                    AD_UserEquipment    uEqu = uebl.ToSingle("ById", UEId.ToString());

                    Sec_UserBL u            = new Sec_UserBL();
                    Sec_User   usr          = u.Single("ById", UserId.ToString());
                    WebConfig  wc           = new WebConfig();
                    string     UeModel      = uEqu.Model;
                    string     Manufacturer = uEqu.Manufacturer;
                    string     SerialNo     = uEqu.SerialNo;

                    string AVStoreURL = wc.AppSettings("AVStoreURL");

                    string Url = "<a href=" + AVStoreURL + ">AirView Store</a>";

                    string UserName = usr.UserName;
                    string ToEmail  = usr.Email;

                    string Subject = "UE Device Issued";
                    string Body    = "<h1>Hi, " + UserName + "</h1>" +
                                     "<p>A new device is issued to your account.</p>" +
                                     "<table border=" + 1 + " cellpadding=" + 2 + " cellspacing=" + 0 + " width = " + 400 + ">" +
                                     "<tr bgcolor='#F5F5F5'><td><strong>Model</strong></td><td>" + UeModel + "</td></tr>" +
                                     "<tr bgcolor='#F5F5F5'><td><strong>Manufacturer</strong></td><td>" + Manufacturer + "</td></tr>" +
                                     "<tr bgcolor='#F5F5F5'><td><strong>SerialNo</strong></td><td>" + SerialNo + "</td></tr>" +
                                     "</table>" +
                                     "<p>Please download and install AirView Store by clicking here: " + Url + "</p>";


                    Thread thread = new Thread(() => SendEmail(Subject, ToEmail, Body));
                    thread.Start();

                    //-----------------------------
                }


                res.Status  = "success";
                res.Message = "save successfully";
            }
            catch (Exception ex)
            {
                res.Status  = "danger";
                res.Message = ex.Message;
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }