Beispiel #1
0
        public static bool ReflashDynamicArea(ScreenParam screenParam, int areaId, out string strResult)
        {
            int nResult = 0;

            strResult = "";
            nResult   = SendDynamicAreasInfoCommand(screenParam.Id, 0, areaId.ToString());
            if (0 != nResult)
            {
                strResult = GetErrorMessage("执行SendDynamicAreasInfoCommand函数, ", nResult);
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        private void AreaMonitor(ScreenParam screenParam, MyGroupList myGroupList)
        {
            string    sql        = "";
            DataTable dataTable  = null;
            string    time       = DateTime.Now.ToString("HH:mm:ss");
            string    date       = DateTime.Now.ToString("yyyy-MM-dd");
            bool      updateFlag = false;

            if (screenParam.DutyNoFormat.Equals(ScreenParam.dutyPrefix))
            {
                updateFlag = true;
            }
            else
            {
                int result = DateTime.Compare(Convert.ToDateTime(time), Convert.ToDateTime(screenParam.UpdateTime));
                if (result >= 0 && !date.Equals(screenParam.DutyDate))
                {
                    updateFlag = true;
                }
            }
            if (updateFlag)
            {
                string year = "'" + DateTime.Now.ToString("yyyy-MM") + "'";
                sql = String.Format("select * from IO_LeaderDuty where M_Month={0:G} and M_Date={1:D}", year, Convert.ToInt32(DateTime.Now.ToString("dd")));
                string         name  = "";
                SqlParameter[] paras = null;

                dataTable = SqlHelper.ExecuteDataTable(sql, paras);
                foreach (DataRow dt in dataTable.Rows)
                {
                    name = dt["M_Name"].ToString();
                }
                screenParam.DutyNoFormat = ScreenParam.dutyPrefix + name + "  " + screenParam.DutyNo;
                if (name.Length > 0)
                {
                    screenParam.DutyDate = date;
                }
            }

            SqlParameter[] param = null;
            //查询当前刷卡
            sql = "SELECT top 1 A.*,B.Base_PerID,B.Base_PerNo,B.Base_PerName,C.Base_RoleName FROM AcvB_AccessLog A,"
                  + " General_Personnel B,General_Role C,General_Group D "
                  + " where A.Base_PerID=B.Base_PerID and B.Base_RoleID=C.Base_RoleID and B.Base_GroupID=D.Base_GroupID"
                  + " and A.Device_ID in(" + myGroupList.DevicesFormat + ")"
                  + " order by A.Access_DateTime desc";
            //System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            //stopwatch.Start(); //  开始监视代码
            dataTable = SqlHelper.ExecuteDataTable(sql, param);
            string inOutRecord = "";

            foreach (DataRow dt in dataTable.Rows)
            {
                if (dt["InOutFlag"].ToString().Equals("0"))
                {
                    inOutRecord = "进闸";
                }
                else
                {
                    inOutRecord = "出闸";
                }
                inOutRecord = "当前刷卡: " + dt["Base_PerName"].ToString() + "  工号" + dt["Base_PerNo"].ToString();
            }
            //screenParam.PersonRecord = inOutRecord;
            //stopwatch.Stop(); //  停止监视
            //TimeSpan timeSpan = stopwatch.Elapsed; //  获取总时间
            //Console.WriteLine("seconds:" + timeSpan.TotalSeconds);

            param    = new SqlParameter[3];//参数化有问题,暂时用字符串连接代替
            param[0] = new SqlParameter("@deviceList", myGroupList.DevicesFormat);
            param[1] = new SqlParameter("@groupIdLen", SqlDbType.Int, 4)
            {
                Value = 5
            };
            param[2] = new SqlParameter("@groupId", screenParam.GroupId);

            sql = "select F.Base_RoleID,Max(G.Base_RoleName) as Base_RoleName,count(E.Base_PerID) as PerCount from"
                  + " (select top 500000  a.* from AcvB_AccessLog a where ISNULL(Base_PerID,'''')<>'''' and Device_ID in(" + myGroupList.DevicesFormat + ")"
                  + " and a.Access_DateTime=(select MAX(Access_DateTime) from AcvB_AccessLog"
                  + " where Base_PerID=a.Base_PerID and isnull(Reserved,'''')='''' )"
                  + " order by Base_PerID) E, General_Personnel F,General_Role G,General_Group H"
                  + " where E.Base_PerID=F.Base_PerID and F.Base_RoleID=G.Base_RoleID and F.Base_GroupID=H.Base_GroupID"
                  //+ " and SUBSTRING(H.Base_AuthID,1,@groupIdLen) = @groupId"
                  + " and E.InOutFlag='0' and E.Card_Status='1'"
                  + " group by F.Base_RoleID";

            dataTable = SqlHelper.ExecuteDataTable(sql, param);
            screenParam.ResetRoleDefaultTotal();
            foreach (DataRow dt in dataTable.Rows)
            {
                string role_id = dt["Base_RoleID"].ToString();
                int    count   = dt.Field <int>("PerCount");
                screenParam.SetRoleTotal(role_id, count);
            }
            screenParam.ShowRoleStatistics();

            screenParam.GenerateFile();
        }
Beispiel #3
0
 private void screen2Radio_Checked(object sender, RoutedEventArgs e)
 {
     this.mainGrid.DataContext = myScreen2Param.ScreenParam;
     screenParamUse            = myScreen2Param.ScreenParam;
     screenGroupUse            = screen2Group;
 }
Beispiel #4
0
        public static bool SetScreenPara(ScreenParam screenParam, double leftRatio, double titleRatio, out string strResult)
        {
            int nResult = DeleteScreen_Dynamic(screenParam.Id);

            strResult = "";
            if (0 != nResult)
            {
                strResult = BxDriver.GetErrorMessage("执行DeleteScreen函数,", nResult);
            }

            nResult = BxDriver.AddScreen_Dynamic(BxDriver.CONTROLLER_BX_5E1, screenParam.Id, SEND_MODE_NETWORK, screenParam.Width
                                                 , screenParam.High, screenParam.Type, 1
                                                 , "COM1", 9600
                                                 , screenParam.IpAddr, Convert.ToInt32(screenParam.Port), 0, 0, "", ""
                                                 , "", 0, "", ""
                                                 , "");
            if (0 != nResult)
            {
                strResult = GetErrorMessage("执行AddScreen函数,", nResult);
                return(false);
            }

            int leftWidth  = (int)(screenParam.Width * leftRatio);
            int rightWidth = screenParam.Width - leftWidth;

            //左侧
            nResult = AddScreenDynamicArea(screenParam.Id, 0, RUN_MODE_CYCLE_SHOW
                                           , 5, 0, "", 1
                                           , 0, 0, leftWidth - 2, screenParam.High - 5
                                           , 255, 0, 255
                                           , 1, 0, 1);
            if (0 != nResult)
            {
                strResult = GetErrorMessage("执行AddScreenDynamicArea函数,", nResult);
                return(false);
            }

            if (System.IO.File.Exists(screenParam.Reader.MonitorText))
            {
                Color color      = ColorTranslator.FromHtml(screenParam.LeftContextFontColor);
                int   colorValue = color.B << 16 | color.G << 8 | color.R;
                //int colorValue = Convert.ToInt32(screenParam.LeftContextFontColor);
                nResult = AddScreenDynamicAreaFile(screenParam.Id, 0
                                                   , screenParam.Reader.MonitorText, 0, 0, screenParam.LeftContextFontName, screenParam.LeftContextFontSize, 0, colorValue
                                                   , 1, 2, 1);
                if (0 != nResult)
                {
                    strResult = GetErrorMessage("执行AddScreenDynamicAreaFile函数, ", nResult);
                    return(false);
                }
            }

            int titleHigh = (int)(screenParam.High * titleRatio);

            //右侧
            nResult = AddScreenDynamicArea(screenParam.Id, 1, RUN_MODE_CYCLE_SHOW
                                           , 5, 0, "", 1
                                           , leftWidth + 2, 0, rightWidth - 2, screenParam.High - (2 + titleHigh + 10)
                                           , 255, 0, 255
                                           , 1, 0, 1);
            if (0 != nResult)
            {
                strResult = GetErrorMessage("执行AddScreenDynamicArea函数,", nResult);
                return(false);
            }

            if (System.IO.File.Exists(screenParam.Reader.NoteText))
            {
                Color color      = ColorTranslator.FromHtml(screenParam.RightContextFontColor);
                int   colorValue = color.B << 16 | color.G << 8 | color.R;
                //int colorValue = Convert.ToInt32(screenParam.RightContextFontColor);
                nResult = AddScreenDynamicAreaFile(screenParam.Id, 1
                                                   , screenParam.Reader.NoteText, 0, 0, screenParam.RightContextFontName, screenParam.RightContextFontSize, 0, colorValue
                                                   , 5, 10, 10);
                if (0 != nResult)
                {
                    strResult = GetErrorMessage("执行AddScreenDynamicAreaFile函数, ", nResult);
                    return(false);
                }
            }
            Thread.Sleep(100);
            return(true);
        }
 public FontSettings(ScreenParam screen1Param, ScreenParam screen2Param)
 {
     InitializeComponent();
     this.screen1Param = screen1Param;
     this.screen2Param = screen2Param;
 }