コード例 #1
0
        public void GetDataforEmployeecard()
        {
            LogManager.WriteLog("[GetDataforEmployeecard]- Start", LogManager.enumLogLevel.Info);

            DataTable dtEMPCard;
            int       Message_ID = 0;

            try
            {
                dtEMPCard = CommonDataAccess.GetEmployeeCardPollingData();

                LogManager.WriteLog("[GetDataforEmployeecard] | Number of Employeecards to Process: " +
                                    dtEMPCard.Rows.Count.ToString(), LogManager.enumLogLevel.Info);

                if ((dtEMPCard == null) || (dtEMPCard.Rows.Count == 0))
                {
                    LogManager.WriteLog("No cards to be broadcasted", LogManager.enumLogLevel.Info);
                    return;
                }

                foreach (DataRow row in dtEMPCard.Rows)
                {
                    EmployeeMasterCardThreadData threadData = new EmployeeMasterCardThreadData()
                    {
                        EmployeeCardNo = row["EmployeeCard"].ToString(),
                        EmployeeFlags  = row["EmployeeFlags"].ToString(),
                        InstallationNo = Convert.ToInt32(row["Installation_No"])
                    };

                    bool canAdd = true;


                    Message_ID = EmployeecardSend(threadData.EmployeeCardNo, threadData.EmployeeFlags, threadData.InstallationNo);
                    LogManager.WriteLog("GetDataforEmployeecard | Master card Information " + threadData.EmployeeCardNo.ToString()
                                        + "sent to Installation: " + threadData.InstallationNo.ToString()
                                        + ", MessageID: " + Message_ID.ToString()
                                        , LogManager.enumLogLevel.Info);


                    if (canAdd)
                    {
                        threadData.MessageID = Message_ID;
                        if (!_requestCollection.ContainsKey(Message_ID))
                        {
                            _requestCollection.Add(Message_ID, threadData);
                        }
                    }
                }
                LogManager.WriteLog("[GetDataforEmployeecard]- End", LogManager.enumLogLevel.Info);
            }
            catch (Exception Ex)

            {
                ExceptionManager.Publish(Ex);
            }
        }
コード例 #2
0
        public static List <Employeecarddata> GetEmployeeCardPollingData()
        {
            DataTable dtEmpcard = CommonDataAccess.GetEmployeeCardPollingData();
            List <Employeecarddata> empcardData = new List <Employeecarddata>();

            foreach (DataRow row in dtEmpcard.Rows)
            {
                empcardData.Add(new Employeecarddata {
                    EmployeeCard = row["EmployeeCard"].ToString(),
                    //EMPCardEDType=Convert.ToInt32( row["EMPCard_ED_Type"]),
                    EmployeeFlags   = row["EmployeeFlags"].ToString(),
                    Installation_No = Convert.ToInt32(row["Installation_No"])
                });
                //PollingStatus =Convert.ToBoolean(row["Polling_Status"])
            }
            return(empcardData);
        }