Exemplo n.º 1
0
        //
        // GET: /Header/

        public ActionResult Header()
        {
            var role = this.GetCurrentRole();

            if (role != RoleType.超级管理员)
            {
                var projectID = this.GetCurrentOrderClientID();

                //var clientInfo = OrderClientBLL.GetCompanyInfo(projectID);
                //if (clientInfo.Code == 0)
                //{
                //    ViewBag.LogoFile = clientInfo.Data.LogoFile;
                //    ViewBag.CompanyName = clientInfo.Data.CompanyName;
                //}

                if (role == RoleType.操作员 || role == RoleType.管理员 || role == RoleType.项目管理员)
                {
                    var info = DeviceBLL.GetMaintainCount(projectID);

                    if (info.Code == 0)
                    {
                        ViewBag.MaintainCount = info.Data;
                    }
                }
            }

            return(PartialView());
        }
Exemplo n.º 2
0
        public ActionResult EditDevice(WebDevice webDevice)
        {
            DeviceBLL deviceBLL = new DeviceBLL();
            var       cResult   = deviceBLL.UpdateDevice(webDevice);

            return(JsonContentHelper.GetJsonContent(cResult));
        }
Exemplo n.º 3
0
        public static IDeviceBLL <DeviceReading> CreateDocumentdbDeviceBusinessModel()
        {
            // IBusinessModelContext<ApartmentBLL,Apartment> context=new
            IDeviceBLL <DeviceReading> context = new DeviceBLL <DeviceReading>();

            return(context);
        }
Exemplo n.º 4
0
        public ActionResult ImportExcel(HttpPostedFileBase fileData, string ProjectID = "", string UserID = "")
        {
            // var currentUserID = this.GetCurrentUserID();
            //var gao = this.GetCurrentUserID();
            var result = new DeviceBLL().ImportDeviceFromExcel(fileData, ProjectID, UserID);

            return(JsonContentHelper.GetJsonContent(result));
        }
Exemplo n.º 5
0
        public ActionResult CreateDevice(WebDevice webDevice)
        {
            webDevice.CreateUserID = this.GetCurrentUserID();
            webDevice.ProjectID    = this.GetCurrentProjectID();
            DeviceBLL deviceBLL = new DeviceBLL();
            var       cResult   = deviceBLL.InsertDevice(webDevice);

            return(JsonContentHelper.GetJsonContent(cResult));
        }
Exemplo n.º 6
0
 private void FrmRead_Load(object sender, EventArgs e)
 {
     if (Device != null)
     {
         var d = new DeviceBLL(AppSettings.Current.ConnStr).GetByID(Device.ID).QueryObject;
         if (d != null)
         {
             txtLastValue.DecimalValue = d.LastValue.HasValue ? d.LastValue.Value : 0;
         }
     }
 }
Exemplo n.º 7
0
 private void FrmRead_Load(object sender, EventArgs e)
 {
     if (Device != null)
     {
         var d = new DeviceBLL(AppSettings.Current.ConnStr).GetByID(Device.ID).QueryObject;
         if (d != null)
         {
             txtLastValue.DecimalValue = d.LastValue.HasValue ? d.LastValue.Value : 0;
         }
     }
 }
Exemplo n.º 8
0
 public ActionResult Delete(string id)
 {
     try
     {
         var result = new DeviceBLL().DeleteDevice(id);
         return(JsonContentHelper.GetJsonContent(result));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 9
0
        public ActionResult MaintainCount()
        {
            int count     = 0;
            var projectID = this.GetCurrentProjectID();

            if (string.IsNullOrWhiteSpace(projectID) == false)
            {
                count = DeviceBLL.GetMaintainCount(projectID).Data;
            }

            return(JsonContentHelper.GetJsonContent(count));
        }
Exemplo n.º 10
0
 private void 模拟读表ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.dataGridView1.SelectedRows.Count == 1)
     {
         FrmRead frm = new FrmRead();
         frm.StartPosition = FormStartPosition.CenterParent;
         frm.Device        = this.dataGridView1.SelectedRows[0].Tag as Device;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             var d = new DeviceBLL(AppSettings.Current.ConnStr).GetByID(frm.Device.ID).QueryObject;
             ShowItemInGridViewRow(dataGridView1.SelectedRows[0], d);
         }
     }
 }
Exemplo n.º 11
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            DeviceBLL devBll = new DeviceBLL();

            StaticData.Device.device_no = txtDevice_no.Text.Trim();
            devBll.setConfig(StaticData.Device);

            string xml = devBll.setDevice();

            try
            {
                string is_success = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/is_success").InnerText;
                if (is_success == "T")
                {
                    StaticData.Device.device_name = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/device_name").InnerText;
                    StaticData.Device.username    = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/username").InnerText;
                    StaticData.Device.pname       = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/pname").InnerText;

                    StringBuilder strB = new StringBuilder();
                    strB.Append("请确认这是你添加的设备:\n");
                    strB.Append("用户名:" + StaticData.Device.username + "\n");
                    strB.Append("商户名称:" + StaticData.Device.pname + "\n");
                    strB.Append("设备名称:" + StaticData.Device.device_name + "\n");
                    strB.Append("确认后所有款项都将会进入此账户下.\n");

                    DialogResult result = MessageBox.Show(strB.ToString(), "信息确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (result == DialogResult.OK)
                    {
                        //确定按钮的方法
                        devBll.setConfig(StaticData.Device);
                        Application.Restart();
                    }
                    else
                    {
                        //取消按钮的方法
                    }
                }
                else
                {
                    string error_msg = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/error_msg").InnerText;
                    lblMsg.Text    = error_msg;
                    lblMsg.Visible = true;
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text    = "异常:" + ex.Message;
                lblMsg.Visible = true;
            }
        }
Exemplo n.º 12
0
 private void InitCmbDevice()
 {
     cmbDevice.DataSource = null;
     List<Device> items = new DeviceBLL(AppSettings.Current.ConnStr).GetItems(null).QueryObjects;
     Division d = cmbDivision.SelectedItem as Division;
     if (d != null && !string.IsNullOrEmpty(d.ID))
     {
         List<Division> ds = GetDesendents(d);
         items = items.Where(it => ds.Exists(item => item.ID == it.Division)).ToList();
     }
     items.Insert(0, new Device { ID = string.Empty, Name = string.Empty });
     cmbDevice.DataSource = items;
     cmbDevice.DisplayMember = "Name";
     cmbDevice.DropDownStyle = ComboBoxStyle.DropDownList;
 }
Exemplo n.º 13
0
        //添加传感器信息
        private void button1_Click(object sender, EventArgs e)
        {
            string deviceId = DeviceIdText.Text.Trim();
            string type     = TypeText.Text.Trim();
            string company  = CompanyText.Text.Trim();
            string info     = InfoText.Text.Trim();

            if (deviceId == "")
            {
                Show("请输入传感器编号");
                return;
            }

            DeviceBLL bll = new DeviceBLL();

            if (bll.DeviceIsExist(deviceId))
            {
                Show(string.Format("编号为{0}的传感器已存在", deviceId));
                ClearInput();
                return;
            }

            if (type == "")
            {
                Show("请输入传感器类型");
                return;
            }


            Device model = new Device()
            {
                deviceId   = deviceId,
                type       = type,
                company    = company,
                deviceInfo = info
            };


            if (bll.AddDevice(model))
            {
                ClearInput();
                Show(string.Format("添加编号为{0}的{1}传感器成功", model.deviceId, model.type));
            }
            else
            {
                Show(string.Format("添加编号为{0}的{1}传感器失败", model.deviceId, model.type));
            }
        }
Exemplo n.º 14
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (Device != null && Device.LastValue >= txtValue.DecimalValue)
     {
         MessageBox.Show("表读数小于表的上次读数");
         return;
     }
     var ret = new DeviceBLL(AppSettings.Current.ConnStr).AddReadLog(Device.ID, DateTime.Now, txtValue.DecimalValue);
     if (ret.Result == ResultCode.Successful)
     {
         this.DialogResult = DialogResult.OK;
     }
     else
     {
         MessageBox.Show(ret.Message);
     }
 }
Exemplo n.º 15
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (Device != null && Device.LastValue >= txtValue.DecimalValue)
            {
                MessageBox.Show("表读数小于表的上次读数");
                return;
            }
            var ret = new DeviceBLL(AppSettings.Current.ConnStr).AddReadLog(Device.ID, DateTime.Now, txtValue.DecimalValue);

            if (ret.Result == ResultCode.Successful)
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show(ret.Message);
            }
        }
Exemplo n.º 16
0
        private void InitCmbDevice()
        {
            cmbDevice.DataSource = null;
            List <Device> items = new DeviceBLL(AppSettings.Current.ConnStr).GetItems(null).QueryObjects;
            Division      d     = cmbDivision.SelectedItem as Division;

            if (d != null && !string.IsNullOrEmpty(d.ID))
            {
                List <Division> ds = GetDesendents(d);
                items = items.Where(it => ds.Exists(item => item.ID == it.Division)).ToList();
            }
            items.Insert(0, new Device {
                ID = string.Empty, Name = string.Empty
            });
            cmbDevice.DataSource    = items;
            cmbDevice.DisplayMember = "Name";
            cmbDevice.DropDownStyle = ComboBoxStyle.DropDownList;
        }
Exemplo n.º 17
0
        //
        // GET: /Device/

        public ActionResult Index(string searchInfo, DeviceStateEnum?deviceStateEnum = null, bool isMaintainSearch = false, int pageIndex = 1, int pageSize = 10, string orderBy = "", bool ascending = false)
        {
            List <WebDevice> device = new List <WebDevice>();
            int       totalCount    = 0;
            DeviceBLL deviceBLL     = new DeviceBLL();
            var       cResult       = deviceBLL.GetDeviceList(out totalCount, this.GetCurrentProjectID(), searchInfo, isMaintainSearch, deviceStateEnum, pageIndex, pageSize, orderBy, ascending);

            if (cResult.Code == 0)
            {
                device = cResult.Data;
            }
            var pageList = new PagedList <WebDevice>(device, pageIndex, pageSize, totalCount);

            ViewBag.SearchInfo       = searchInfo;
            ViewBag.DeviceStateEnum  = deviceStateEnum.HasValue ? deviceStateEnum.ToString() : deviceStateEnum.ToString();
            ViewBag.PageSize         = pageSize;
            ViewBag.IsMaintainSearch = isMaintainSearch;
            ViewBag.ProjectID        = this.GetCurrentProjectID();
            ViewBag.UserID           = this.GetCurrentUserID();
            return(View(pageList));
        }
Exemplo n.º 18
0
        public ActionResult EditDevice(string deviceTypeID, string returnUrl)
        {
            DeviceBLL deviceBLL = new DeviceBLL();
            var       result    = deviceBLL.GetDeviceByID(deviceTypeID);
            WebDevice webDevice = null;

            if (result.Code == 0)
            {
                webDevice = result.Data;
            }
            ManufacturerBLL manufacturBLL = new ManufacturerBLL();
            SupplierBLL     supplierBLL   = new SupplierBLL();

            DeviceTypeBLL deviceTypeBll = new DeviceTypeBLL();
            var           deviceType    = deviceTypeBll.GetDeviceTypeDir(this.GetCurrentProjectID());

            ViewBag.ManufacturList = manufacturBLL.GetManufacturerDir(this.GetCurrentProjectID()).Data;
            ViewBag.SupperList     = supplierBLL.GetSupplierDir(this.GetCurrentProjectID()).Data;
            ViewBag.DeviceType     = deviceType.Data;
            ViewBag.Action         = "Update";
            ViewBag.ReturnUrl      = returnUrl;
            return(View(webDevice));
        }
Exemplo n.º 19
0
        // 1) RequestToken = with Device ID return a RequestToken
        public AccessAuthorizerResponse IsAuthorizedRequestToken(HttpRequestMessage request)
        {
            Guid deviceKey;

            // Find Header
            if (request.Headers.Contains(OAuthConstants.AuthorzationHeader))
            {
                IEnumerable <string> authorzationHeaders = request.Headers.GetValues(OAuthConstants.AuthorzationHeader);
                if (authorzationHeaders.Count() == 1)
                {
                    string deviceKeyString = authorzationHeaders.FirstOrDefault();

                    if (!Guid.TryParse(deviceKeyString, out deviceKey))
                    {
                        return(new AccessAuthorizerResponse(0, "DeviceKey inválido"));
                    }

                    if (!(new DeviceBLL().DeviceKeyExists(deviceKey)))
                    {
                        return(new AccessAuthorizerResponse(0, "DeviceKey inválido"));
                    }

                    Device device = new DeviceBLL().GetDeviceByDeviceKey(deviceKey);


                    if (!device.Active)
                    {
                        return(new AccessAuthorizerResponse(-1, "DeviceKey inactivo. Favor de contactar al desarrollador."));
                    }

                    HttpContext.Current.Items["deviceKey"] = deviceKey;
                    return(new AccessAuthorizerResponse(1, "DeviceKey válido"));;
                }
            }

            return(new AccessAuthorizerResponse(0, "DeviceKey inválido"));
        }
Exemplo n.º 20
0
 public Setup()
 {
     InitializeComponent();
     deviceBLL = new DeviceBLL();
 }
Exemplo n.º 21
0
 public ELog()
 {
     _bll = new DeviceBLL();
 }
Exemplo n.º 22
0
        public ActionResult ExportExcel(string searchInfo, DeviceStateEnum?deviceStateEnum = null, bool isMaintainSearch = false)
        {
            var result = new DeviceBLL().ExportDeviceToExcel(this.GetCurrentProjectID(), searchInfo, deviceStateEnum, isMaintainSearch);

            return(JsonContentHelper.GetJsonContent(result));
        }
 private void 模拟读表ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.dataGridView1.SelectedRows.Count == 1)
     {
         FrmRead frm = new FrmRead();
         frm.StartPosition = FormStartPosition.CenterParent;
         frm.Device = this.dataGridView1.SelectedRows[0].Tag as Device;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             var d = new DeviceBLL(AppSettings.Current.ConnStr).GetByID(frm.Device.ID).QueryObject;
             ShowItemInGridViewRow(dataGridView1.SelectedRows[0], d);
         }
     }
 }
Exemplo n.º 24
0
 public HistoryRecordDataViewModel(DeviceBLL bll)
 {
     m_DeviceBll = bll;
 }
Exemplo n.º 25
0
 public ITAGPDF()
 {
     _bll = new DeviceBLL();
 }
Exemplo n.º 26
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ConfigBLL  configBll  = new ConfigBLL();
            CashierBLL cashierBll = new CashierBLL();
            DeviceBLL  deviceBll  = new DeviceBLL();

            string path = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Yunfu";

            //第一次启动
            if (!Directory.Exists(path))//不存在path路径
            {
                Directory.CreateDirectory(path);
            }
            if (!File.Exists(path + "\\Cashier.xml"))
            {
                StaticData.Cashier.cashier_id = "0";
                cashierBll.setConfig(StaticData.Cashier);
            }
            if (!File.Exists(path + "\\Device.xml"))
            {
                deviceBll.setConfig(StaticData.Device);
            }
            if (!File.Exists(path + "\\Config.xml"))
            {
                StaticData.Config.isPrint      = "0";
                StaticData.Config.isVoice      = "1";
                StaticData.Config.dualPrint    = "1";
                StaticData.Config.userLptPrint = "0";
                StaticData.Config.LptName      = "LPT1";
                StaticData.Config.printerName  = new PrintDocument().PrinterSettings.PrinterName;
                configBll.setConfig(StaticData.Config);
            }

            StaticData.Device  = deviceBll.getConfig();
            StaticData.Config  = configBll.getConfig();
            StaticData.Cashier = cashierBll.getConfig();

            AlipayBLL ab  = new AlipayBLL();
            string    xml = ab.verify();

            try
            {
                string is_success = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/is_success").InnerText;
                if (is_success == "T")
                {
                    FormLogin frmLogin = new FormLogin();
                    frmLogin.ShowDialog();
                    if (frmLogin.DialogResult == DialogResult.OK)
                    {
                        Application.Run(new FormMain());
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
                else
                {
                    try
                    {
                        string     error_msg = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/error_msg").InnerText;
                        FormDevice frmDevice = new FormDevice(error_msg);
                        frmDevice.ShowDialog();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowError("异常" + ex.Message);
            }
        }
Exemplo n.º 27
0
 public Tempod()
 {
     _bll = new DeviceBLL();
 }
Exemplo n.º 28
0
 public ITAGSingleUse()
 {
     _bll = new DeviceBLL();
 }
Exemplo n.º 29
0
        public bool SerializePointInfo(DevicePDF device)
        {
            try
            {
                tempList.Clear();

                Dictionary <DateTime, double> dic = new Dictionary <DateTime, double>();
                ObjectManage.DeviceNew.Data.TempListWithTime.ToList().ForEach(p =>
                {
                    string[] s = p.Split(new char[1] {
                        ','
                    });
                    tempList.Add(new PointKeyValue()
                    {
                        PointTime = Convert.ToDateTime(s[0]), PointTemp = Convert.ToDouble(s[1])
                    });
                });
                //此处增加mark属性值得读取及添加排序
                int markCount = ObjectManage.DeviceNew.Data.MarkTimeCount;
                if (markCount > 0)
                {
                    for (int i = 0; i < markCount && i < ObjectManage.DeviceNew.Data.MarkTimeArray.Length; i++)
                    {
                        string[] markPoint = ObjectManage.DeviceNew.Data.MarkTimeArray[i].Split(new[] { ',' });
                        if (markPoint.Length < 2)
                        {
                            continue;
                        }
                        else if (Convert.ToDateTime(markPoint[1]) != DateTime.MinValue)
                        {
                            tempList.Add(new PointKeyValue()
                            {
                                PointTemp = Convert.ToDouble(markPoint[0]),
                                PointTime = Convert.ToDateTime(markPoint[1]),
                                IsMark    = true
                            });
                        }
                    }
                    tempList = tempList.OrderBy(p => p.PointTime).ToList();
                }
                int       id    = new DeviceBLL().GetPointPKValue();
                PointInfo point = new PointInfo();
                point.ID          = id + 1;
                point.ProductName = ProductName;
                point.SN          = SerialNumber;
                point.TN          = TripNumber;
                point.TempUnit    = TempUnit;
                point.Remark      = DateTime.Now.ToString();
                using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
                {
                    if (tempList.Count > 0)
                    {
                        /*序列化*/
                        XmlSerializer xmlSerializer = new XmlSerializer(typeof(List <PointKeyValue>));
                        xmlSerializer.Serialize(ms, tempList);
                        point.Points = ms.ToArray();
                    }
                }
                points = point;
                //tempList.Clear();
                //ObjectManage.DeviceNew.Data.TempListWithTime.ToList().ForEach(p =>
                //{
                //    string[] s = p.Split(new char[1] { ',' });
                //    tempList.Add(new PointKeyValue() { PointTime = Convert.ToDateTime(s[0]).ToLocalTime(), PointTemp = Convert.ToDouble(s[1]) });

                //});
                return(true);
            }
            catch { return(false); }
        }