public void GetClientById(int id)
        {
            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.CommandText = "SELECT * FROM CLIENTE WHERE idCliente = @ID";
            conexao.command.Parameters.Clear();
            conexao.command.Parameters.Add("@ID", SqlDbType.Int).Value = id;

            System.Data.SqlClient.SqlDataReader dataReader = conexao.command.ExecuteReader();

            if (dataReader.HasRows)
            {
                while (dataReader.Read())
                {
                    Id             = dataReader.GetInt32(0);
                    Email          = dataReader.GetString(1);
                    Senha          = dataReader.GetString(2);
                    Nome           = dataReader.GetString(3);
                    Sobrenome      = dataReader.GetString(4);
                    Sexo           = dataReader.GetString(5);
                    Cpf            = dataReader.GetString(6);
                    DataNascimento = dataReader.GetDateTime(7);
                    DataInscricao  = dataReader.GetDateTime(8).ToString();
                }
            }

            dataReader.Close();
            conexao.connection.Close();
        }
示例#2
0
        public System.Collections.Generic.List <DeliveryBoy> GetAll()
        {
            System.Data.SqlClient.SqlCommand              cmd     = null;
            System.Data.SqlClient.SqlDataReader           SDR     = null;
            System.Collections.Generic.List <DeliveryBoy> ListTmp = new System.Collections.Generic.List <DeliveryBoy>();
            DeliveryBoy ObjTmp = null;
            DBCon       Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM DELIVERYBOY WHERE Deleted=0 ORDER BY DBID DESC";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new DeliveryBoy
                    {
                        DBID        = SDR.GetInt32(0),
                        Name        = SDR.GetString(1),
                        Mobile      = SDR.GetString(2),
                        Password    = SDR.GetString(3),
                        Create_Date = SDR.GetDateTime(4),
                        Create_By   = SDR.GetInt32(5),
                        Update_Date = SDR.GetDateTime(6),
                        Update_By   = SDR.GetInt32(7),
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
示例#3
0
        public System.Collections.Generic.List <Users> GetAll()
        {
            System.Data.SqlClient.SqlCommand        cmd     = null;
            System.Data.SqlClient.SqlDataReader     SDR     = null;
            System.Collections.Generic.List <Users> ListTmp = new System.Collections.Generic.List <Users>();
            Users ObjTmp = null;
            DBCon Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM USERS WHERE Deleted=0 ORDER BY UID DESC";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new Users
                    {
                        UID         = SDR.GetInt32(0),
                        User_Name   = SDR.GetString(1),
                        Password    = SDR.GetString(2),
                        User_Type   = SDR.GetString(3),
                        Create_By   = SDR.GetInt64(4),
                        Create_Date = SDR.GetDateTime(5),
                        Update_By   = SDR.GetInt64(6),
                        Update_Date = SDR.GetDateTime(7),
                        MESSID      = SDR.IsDBNull(9)? 0:SDR.GetInt32(9),
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
示例#4
0
        public System.Collections.Generic.List <Category> GetAll()
        {
            System.Data.SqlClient.SqlCommand           cmd     = null;
            System.Data.SqlClient.SqlDataReader        SDR     = null;
            System.Collections.Generic.List <Category> ListTmp = new System.Collections.Generic.List <Category>();
            Category ObjTmp = null;
            DBCon    Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM CATEGORY WHERE Deleted=0 ORDER BY Category_ID DESC";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new Category
                    {
                        Category_ID = SDR.GetInt32(0),
                        Name        = SDR.GetString(1),
                        Create_By   = SDR.GetInt32(2),
                        Create_Date = SDR.GetDateTime(3),
                        Update_By   = SDR.GetInt32(4),
                        Update_Date = SDR.GetDateTime(5),
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
示例#5
0
        public System.Collections.Generic.List <Customer> GetAll()
        {
            System.Data.SqlClient.SqlCommand           cmd     = null;
            System.Data.SqlClient.SqlDataReader        SDR     = null;
            System.Collections.Generic.List <Customer> ListTmp = new System.Collections.Generic.List <Customer>();
            Customer ObjTmp = null;
            DBCon    Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM CUSTOMER WHERE Deleted=0 ORDER BY CID DESC";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new Customer
                    {
                        CID         = SDR.GetInt64(0),
                        Name        = SDR.GetString(1),
                        Birthday    = SDR.GetDateTime(2),
                        Email       = SDR.GetString(3),
                        Mobile      = SDR.GetString(4),
                        Password    = SDR.GetString(5),
                        Signup_Date = SDR.GetDateTime(6),
                        Update_Date = SDR.GetDateTime(7),
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
        public override void ParseFromDataReader(System.Data.SqlClient.SqlDataReader r)
        {
            ID     = r.GetGuid(0);
            TaskID = r.GetInt32(1);
            if (!r.IsDBNull(2))
            {
                Priority = (Priority)r.GetInt32(2);
            }
            else
            {
                Priority = null;
            }

            if (!r.IsDBNull(3))
            {
                ScheduleID = r.GetGuid(3);
            }
            else
            {
                ScheduleID = null;
            }

            if (!r.IsDBNull(4))
            {
                Inserted = r.GetDateTime(4);
            }
            else
            {
                Inserted = DT_NEVER;
            }

            if (!r.IsDBNull(5))
            {
                ServerID = r.GetInt32(5);
            }
            else
            {
                ServerID = null;
            }

            if (!r.IsDBNull(6))
            {
                LastUpdate = r.GetDateTime(6);
            }
            else
            {
                LastUpdate = DT_NEVER;
            }

            if (!r.IsDBNull(7))
            {
                ReturnCode = r.GetString(7);
            }
            else
            {
                ReturnCode = null;
            }

            Status = (TaskStatus)r.GetInt32(8);
        }
示例#7
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            listView.Items.Clear();

            string query = BuildQuery();

            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            cmd.CommandText    = query;
            cmd.CommandTimeout = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CommandTimedOut"]);
            cmd.CommandType    = CommandType.Text;

            using (System.Data.SqlClient.SqlDataReader reader = SqlHelper.Default.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    ListViewItem objItem = this.listView.Items.Add(reader.GetGuid(0).ToString());
                    objItem.SubItems.Add(reader.GetString(3));                                            // Tx Number
                    objItem.SubItems.Add(reader.GetString(5));
                    objItem.SubItems.Add(reader.GetDateTime(4).ToString(Common.Utility.GetDateFormat())); //
                    objItem.SubItems.Add(reader.GetDateTime(6).ToString(Common.Utility.GetDateFormat()));
                    objItem.SubItems.Add(reader.GetString(1));
                    objItem.SubItems.Add(reader.GetDecimal(7).ToString("##"));
                }
            }
        }
示例#8
0
        public TList_Sessao Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            bool         podeFecharBco = false;
            TList_Sessao lista         = new TList_Sessao();

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, vTop, vNM_Campo));
            try
            {
                while (reader.Read())
                {
                    TRegistro_Sessao reg = new TRegistro_Sessao();
                    if (!(reader.IsDBNull(reader.GetOrdinal("id_pdv"))))
                    {
                        reg.Id_pdv = reader.GetDecimal(reader.GetOrdinal("id_pdv"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("Ds_pdv"))))
                    {
                        reg.Ds_pdv = reader.GetString(reader.GetOrdinal("Ds_pdv"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("id_sessao"))))
                    {
                        reg.Id_sessao = reader.GetDecimal(reader.GetOrdinal("id_sessao"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("login"))))
                    {
                        reg.Login = reader.GetString(reader.GetOrdinal("login"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_abertura")))
                    {
                        reg.Dt_abertura = reader.GetDateTime(reader.GetOrdinal("dt_abertura"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_fechamento")))
                    {
                        reg.Dt_fechamento = reader.GetDateTime(reader.GetOrdinal("dt_fechamento"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("st_registro")))
                    {
                        reg.St_registro = reader.GetString(reader.GetOrdinal("st_registro"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
示例#9
0
        public TList_SpedContabil Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_SpedContabil lista = new TList_SpedContabil();

            System.Data.SqlClient.SqlDataReader reader = null;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }

            try
            {
                reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
                while (reader.Read())
                {
                    TRegistro_SpedContabil reg = new TRegistro_SpedContabil();

                    if (!reader.IsDBNull(reader.GetOrdinal("cd_empresa")))
                    {
                        reg.Cd_empresa = reader.GetString(reader.GetOrdinal("cd_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nm_empresa")))
                    {
                        reg.Nm_empresa = reader.GetString(reader.GetOrdinal("nm_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_sped")))
                    {
                        reg.Id_sped = reader.GetDecimal(reader.GetOrdinal("id_sped"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nr_sped")))
                    {
                        reg.Nr_sped = reader.GetDecimal(reader.GetOrdinal("nr_sped"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_ini")))
                    {
                        reg.Dt_ini = reader.GetDateTime(reader.GetOrdinal("dt_ini"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_fin")))
                    {
                        reg.Dt_fin = reader.GetDateTime(reader.GetOrdinal("dt_fin"));
                    }
                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
示例#10
0
        public TList_EtapaPedido Select(TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_EtapaPedido lista = new TList_EtapaPedido();

            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = ExecutarBusca(SqlCodeBusca(vBusca, vTop, ""));
            try
            {
                while (reader.Read())
                {
                    TRegistro_EtapaPedido reg = new TRegistro_EtapaPedido();

                    if (!reader.IsDBNull(reader.GetOrdinal("Id_etapa")))
                    {
                        reg.Id_etapa = reader.GetDecimal(reader.GetOrdinal("Id_etapa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("NR_Pedido")))
                    {
                        reg.Nr_pedido = reader.GetDecimal(reader.GetOrdinal("NR_Pedido"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DS_Etapa")))
                    {
                        reg.DS_Etapa = reader.GetString(reader.GetOrdinal("DS_Etapa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_ini")))
                    {
                        reg.Dt_ini = reader.GetDateTime(reader.GetOrdinal("dt_ini"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_fin")))
                    {
                        reg.Dt_fin = reader.GetDateTime(reader.GetOrdinal("dt_fin"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("st_registro")))
                    {
                        reg.St_registro = reader.GetString(reader.GetOrdinal("st_registro"));
                    }

                    lista.Add(reg);
                }
                return(lista);
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
        }
示例#11
0
        public List <HG_OrderItem> GetAll(Int64 OID = 0)
        {
            var CurrOrgID = HttpContext.Current.Request.Cookies["UserInfo"];

            System.Data.SqlClient.SqlCommand    cmd = null;
            System.Data.SqlClient.SqlDataReader SDR = null;
            List <HG_OrderItem> ListTmp             = new List <HG_OrderItem>();
            DBCon Obj = new DBCon();

            try
            {
                string Query = "SELECT * FROM HG_ORDERITEM";
                if (OID > 0)
                {
                    Query = "SELECT * FROM HG_ORDERITEM WHERE OID=" + OID.ToString() + " and Deleted=0 ";
                }
                else if (int.Parse(CurrOrgID["OrgId"]) > 0)
                {
                    Query = "SELECT * FROM HG_ORDERITEM WHERE OrgId=" + CurrOrgID["OrgId"] + " and Deleted=0 ";
                }
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    HG_OrderItem ObjTmp = new HG_OrderItem();
                    ObjTmp.OIID         = SDR.GetInt64(0);
                    ObjTmp.FID          = SDR.GetInt64(1);
                    ObjTmp.Price        = SDR.GetDouble(2);
                    ObjTmp.Count        = SDR.GetInt32(3);
                    ObjTmp.IsAddon      = SDR.GetString(4);
                    ObjTmp.OID          = SDR.GetInt64(5);
                    ObjTmp.Status       = SDR.GetInt32(7);
                    ObjTmp.OrderDate    = SDR.GetDateTime(8);
                    ObjTmp.UpdatedBy    = SDR.GetInt32(9);
                    ObjTmp.UpdationDate = SDR.GetDateTime(10);
                    ObjTmp.TickedNo     = SDR.GetInt32(11);
                    ObjTmp.ChefSeenBy   = SDR.GetInt32(12);
                    ObjTmp.OrgId        = SDR.GetInt32(13);
                    ObjTmp.OrdById      = SDR.GetInt64(14);
                    ObjTmp.TaxInItm     = SDR.GetDouble(15);
                    ObjTmp.CostPrice    = SDR.GetDouble(16);
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
示例#12
0
        public static byte[] PrivateMessageCheck(WorldMgr.character c)
        {
            DB           ms     = new DB("SELECT * FROM message WHERE receiver='" + c.Information.Name + "'");
            PacketWriter Writer = new PacketWriter();
            int          count  = ms.Count();

            Writer.Create(OperationCode.SERVER_PM_MESSAGE);
            Writer.Byte(1);                     //Static
            Writer.Byte(Convert.ToByte(count)); //Total count
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    string   pmfrom    = reader.GetString(1);
                    string   pmto      = reader.GetString(2);
                    string   pmmessage = reader.GetString(3);
                    byte     pmstatus  = reader.GetByte(4);
                    DateTime pmdate    = Convert.ToDateTime(reader.GetDateTime(5));

                    Writer.Text(pmfrom);            // Message From
                    Writer.DWord(0x8A070000);       // date
                    Writer.DWord(0xC7058401);       // date
                    Writer.Byte(pmstatus);          // Status (0 = Unread) (1 = Read)
                }
                ms.Close();
            }
            return(Writer.GetBytes());
        }
示例#13
0
        public static DateTime EarliestDate(string reportType, object entity)
        {
            //find earliest date in data base from sql dataset using reportType to filter the rows
            //if there is a reportId in the ReportStore get the report data Deserialize and return
            //Type systemType = typeDictionary[reportType];
            DateTime result = DateTime.Now;

            using (System.Data.SqlClient.SqlConnection connection = DatabaseConnection)
            {
                connection.Open();
                using (System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand("Select startDate From ReportStore Where reportType Like '%" + reportType + "%'", connection))
                {
                    //command.Parameters.AddWithValue("reportType", reportType);
                    using (System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            DateTime compare = reader.GetDateTime(0);
                            if (compare < result)
                            {
                                result = compare;
                            }
                        }
                    }
                }
            }

            //Select startDate From ReportStore Where reportType = systemType.FullName
            return(result);
        }
示例#14
0
        public System.Collections.Generic.List <Ledger> GetAll()
        {
            System.Data.SqlClient.SqlCommand         cmd     = null;
            System.Data.SqlClient.SqlDataReader      SDR     = null;
            System.Collections.Generic.List <Ledger> ListTmp = new System.Collections.Generic.List <Ledger>();
            Ledger ObjTmp = null;
            DBCon  Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM LEDGER WHERE Deleted=0 ORDER BY LID DESC";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new Ledger
                    {
                        LID         = SDR.GetInt64(0),
                        CID         = SDR.GetInt64(1),
                        Debit       = SDR.GetDouble(2),
                        Credit      = SDR.GetDouble(3),
                        Description = SDR.GetString(4),
                        Entry_Date  = SDR.GetDateTime(5),
                        LedgerType  = SDR.IsDBNull(7)?"":SDR.GetString(7)
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
示例#15
0
        public List <GenerateOtp> GetAll()
        {
            System.Data.SqlClient.SqlCommand              cmd     = null;
            System.Data.SqlClient.SqlDataReader           SDR     = null;
            System.Collections.Generic.List <GenerateOtp> ListTmp = new System.Collections.Generic.List <GenerateOtp>();
            GenerateOtp ObjTmp = null;
            DBCon       Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM GenerateOtp WHERE Deleted=0 ";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new GenerateOtp
                    {
                        OtpId        = SDR.GetInt64(0),
                        OtpCode      = SDR.GetString(1),
                        OtpType      = SDR.GetString(2),
                        hubid        = SDR.GetInt32(3),
                        CreationDate = SDR.GetDateTime(4),
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
示例#16
0
        public ConcurrentDictionary <Int64, TifinMaster> GetAll()
        {
            System.Data.SqlClient.SqlCommand          cmd     = null;
            System.Data.SqlClient.SqlDataReader       SDR     = null;
            ConcurrentDictionary <Int64, TifinMaster> ListTmp = new ConcurrentDictionary <Int64, TifinMaster>();

            DBCon Obj = new DBCon();

            try
            {
                string Query = "SELECT * FROM TifinMaster";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    TifinMaster ObjTmp = new TifinMaster();
                    ObjTmp.TifinID         = SDR.GetInt64(0);
                    ObjTmp.TifinType       = SDR.GetInt32(1);
                    ObjTmp.TifinColor      = SDR.GetString(2);
                    ObjTmp.TifinStatus     = SDR.IsDBNull(4) ? "UnUsed" : SDR.GetString(4);
                    ObjTmp.TifinAtLocation = SDR.IsDBNull(5) ? "2" : SDR.GetString(5);
                    ObjTmp.TifinTakenBy    = SDR.IsDBNull(6) ? "" : SDR.GetString(6);
                    ObjTmp.UpdationDate    = SDR.IsDBNull(7) ? System.DateTime.Now : SDR.GetDateTime(7);
                    ListTmp.TryAdd(ObjTmp.TifinID, ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
示例#17
0
        public System.Collections.Generic.List <FoodReview> GetAll()
        {
            System.Data.SqlClient.SqlCommand             cmd     = null;
            System.Data.SqlClient.SqlDataReader          SDR     = null;
            System.Collections.Generic.List <FoodReview> ListTmp = new System.Collections.Generic.List <FoodReview>();
            FoodReview ObjTmp = null;
            DBCon      Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM FOODREVIEW WHERE Deleted=0 ORDER BY Date_Time DESC";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new FoodReview
                    {
                        FID       = SDR.GetInt64(0),
                        CID       = SDR.GetInt64(1),
                        Rating    = SDR.GetInt32(2),
                        Comment   = SDR.GetString(3),
                        Date_Time = SDR.GetDateTime(4),
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
        public ConcurrentDictionary <Int64, OrderItemCollection> GetAll()
        {
            System.Data.SqlClient.SqlCommand    cmd = null;
            System.Data.SqlClient.SqlDataReader SDR = null;
            ConcurrentDictionary <Int64, OrderItemCollection> ListTmp = new ConcurrentDictionary <Int64, OrderItemCollection>();
            DBCon Obj = new DBCon();

            try
            {
                string Query = "SELECT * FROM OrderItemCollection";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    OrderItemCollection ObjTmp = new OrderItemCollection();
                    ObjTmp.ItemCollectionId = SDR.GetInt64(0);
                    ObjTmp.OrderItemId      = SDR.GetInt64(1);
                    ObjTmp.TifinRackId      = SDR.GetInt64(2);
                    ObjTmp.FoodId           = SDR.GetInt64(3);
                    ObjTmp.MessId           = SDR.GetInt64(4);
                    ObjTmp.CreationDate     = SDR.GetDateTime(5);
                    ObjTmp.CreatedBy        = SDR.GetInt32(7);
                    ListTmp.TryAdd(ObjTmp.TifinRackId, ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
示例#19
0
        public TList_DataContato Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_DataContato lista = new TList_DataContato();

            System.Data.SqlClient.SqlDataReader reader = null;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }

            try
            {
                reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
                while (reader.Read())
                {
                    TRegistro_DataContato reg = new TRegistro_DataContato();
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_Contato")))
                    {
                        reg.Id_contato = reader.GetDecimal(reader.GetOrdinal("ID_Contato"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_clifor")))
                    {
                        reg.Cd_clifor = reader.GetString(reader.GetOrdinal("cd_clifor"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nm_clifor")))
                    {
                        reg.Nm_clifor = reader.GetString(reader.GetOrdinal("nm_clifor"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_TpData")))
                    {
                        reg.Id_TpData = reader.GetDecimal(reader.GetOrdinal("ID_TpData"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ds_tpdata")))
                    {
                        reg.Ds_tpdata = reader.GetString(reader.GetOrdinal("ds_tpdata"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Data")))
                    {
                        reg.Data = reader.GetDateTime(reader.GetOrdinal("Data"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
示例#20
0
        public TList_Abastecidas Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_Abastecidas lista = new TList_Abastecidas();

            System.Data.SqlClient.SqlDataReader reader = null;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }

            try
            {
                reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
                while (reader.Read())
                {
                    TRegistro_Abastecidas reg = new TRegistro_Abastecidas();
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_Abastecimento")))
                    {
                        reg.Id_abastecimento = reader.GetDecimal(reader.GetOrdinal("ID_Abastecimento"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("CD_Empresa")))
                    {
                        reg.Cd_empresa = reader.GetString(reader.GetOrdinal("CD_Empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nm_empresa")))
                    {
                        reg.Nm_empresa = reader.GetString(reader.GetOrdinal("nm_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_Abastecida")))
                    {
                        reg.Id_abastecida = reader.GetDecimal(reader.GetOrdinal("ID_Abastecida"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Volume")))
                    {
                        reg.Volume = reader.GetDecimal(reader.GetOrdinal("Volume"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DT_Abastecida")))
                    {
                        reg.Dt_abastecida = reader.GetDateTime(reader.GetOrdinal("DT_Abastecida"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
示例#21
0
        public System.Collections.Generic.List <Mess> GetAll()
        {
            System.Data.SqlClient.SqlCommand       cmd     = null;
            System.Data.SqlClient.SqlDataReader    SDR     = null;
            System.Collections.Generic.List <Mess> ListTmp = new System.Collections.Generic.List <Mess>();
            Mess  ObjTmp = null;
            DBCon Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM MESS WHERE Deleted=0 ORDER BY MID DESC";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new Mess
                    {
                        MID           = SDR.GetInt32(0),
                        Image         = SDR.GetString(1),
                        Mess_Name     = SDR.GetString(2),
                        Address       = SDR.GetString(3),
                        Mobile        = SDR.GetString(4),
                        Password      = SDR.GetString(5),
                        Owner_Name    = SDR.GetString(6),
                        Bank_Name     = SDR.GetString(7),
                        Account_No    = SDR.GetString(8),
                        IFSC          = SDR.GetString(9),
                        Aadhar_No     = SDR.GetString(10),
                        Pan_No        = SDR.GetString(11),
                        Create_By     = SDR.GetInt32(12),
                        Create_Date   = SDR.GetDateTime(13),
                        Update_By     = SDR.GetInt32(14),
                        Update_Date   = SDR.GetDateTime(15),
                        Mobile2       = SDR.IsDBNull(17)?"":SDR.GetString(17),
                        NumberOfTifin = SDR.IsDBNull(18)?0:SDR.GetInt32(18),
                        MessType      = SDR.IsDBNull(19)?"":SDR.GetString(19),
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
示例#22
0
        public System.Collections.Generic.List <Food> GetAll()
        {
            System.Data.SqlClient.SqlCommand       cmd     = null;
            System.Data.SqlClient.SqlDataReader    SDR     = null;
            System.Collections.Generic.List <Food> ListTmp = new System.Collections.Generic.List <Food>();
            Food  ObjTmp = null;
            DBCon Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM FOOD WHERE Deleted=0 ORDER BY FID DESC";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new Food
                    {
                        FID                = SDR.GetInt64(0),
                        Food_Image         = SDR.GetString(1),
                        Food_Name          = SDR.GetString(2),
                        Price              = SDR.GetDouble(3),
                        Qty                = SDR.GetString(4),
                        Description        = SDR.GetString(5),
                        Category_ID        = SDR.GetInt32(6),
                        MID                = SDR.GetInt32(7),
                        Status             = SDR.GetBoolean(8),
                        Rating             = SDR.IsDBNull(9)?"0": SDR.GetString(9),
                        Create_By          = SDR.GetInt32(10),
                        Create_Date        = SDR.GetDateTime(11),
                        Update_By          = SDR.GetInt32(12),
                        Update_Date        = SDR.GetDateTime(13),
                        FoodType           = SDR.IsDBNull(15)?"":SDR.GetString(15),
                        CostPrice          = SDR.IsDBNull(16)?SDR.GetDouble(3):SDR.GetDouble(16),
                        AdminAprovalStatus = SDR.IsDBNull(17)?1:SDR.GetInt32(17),
                        MealsType          = SDR.IsDBNull(18)?"Lunch,":SDR.GetString(18)
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
示例#23
0
        /// <summary>
        /// Calls the "sp_EmployeeSchedule" stored procedure
        /// </summary>
        /// <param name="id"></param>
        /// <param name="day"></param>
        /// <returns></returns>
        public ActionResult Schedule(int?id, DateTime?day)
        {
            if (!day.HasValue)
            {
                day = DateTime.Today;
            }
            //TODO: call the sp_GetEmployeesWorking procedure

            string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["StoreDB"].ConnectionString;

            System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(connectionString);

            connection.Open();

            System.Data.SqlClient.SqlCommand command = connection.CreateCommand();
            command.CommandText = "sp_GetStoreRevenue";
            command.CommandType = System.Data.CommandType.StoredProcedure;

            System.Data.SqlClient.SqlParameter parameter = command.CreateParameter();
            parameter.Direction     = System.Data.ParameterDirection.Input;
            parameter.ParameterName = "@store";
            parameter.SqlDbType     = System.Data.SqlDbType.Int;
            parameter.SqlValue      = id;

            command.Parameters.Add(parameter);

            List <Models.ERPScheduleModel> schedules = new List <Models.ERPScheduleModel>();

            System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                Models.ERPScheduleModel schedule = new Models.ERPScheduleModel();
                schedule.EmployeeName = reader.GetString(reader.GetOrdinal("Name"));
                schedule.StartTime    = reader.GetDateTime(1);
                schedule.EndTime      = reader.GetDateTime(2);

                schedules.Add(schedule);
            }
            connection.Close();

            return(View(schedules));
        }
示例#24
0
        public TList_LacreBomba Select(Utils.TpBusca[] vBusca, int vTop, string vNM_Campo)
        {
            TList_LacreBomba lista         = new TList_LacreBomba();
            bool             podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
            try
            {
                while (reader.Read())
                {
                    TRegistro_LacreBomba reg = new TRegistro_LacreBomba();
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_Bomba")))
                    {
                        reg.Id_bomba = reader.GetDecimal(reader.GetOrdinal("ID_Bomba"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_empresa")))
                    {
                        reg.Cd_empresa = reader.GetString(reader.GetOrdinal("cd_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nm_empresa")))
                    {
                        reg.Nm_empresa = reader.GetString(reader.GetOrdinal("nm_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_lacre")))
                    {
                        reg.Id_lacre = reader.GetDecimal(reader.GetOrdinal("id_lacre"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nr_lacre")))
                    {
                        reg.Nr_lacre = reader.GetString(reader.GetOrdinal("nr_lacre"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_aplicacao")))
                    {
                        reg.Dt_aplicacao = reader.GetDateTime(reader.GetOrdinal("dt_aplicacao"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
示例#25
0
        public TList_Historico Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            bool            podeFecharBco = false;
            TList_Historico lista         = new TList_Historico();

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, vTop, vNM_Campo));
            try
            {
                while (reader.Read())
                {
                    TRegistro_Historico reg = new TRegistro_Historico();
                    if (!(reader.IsDBNull(reader.GetOrdinal("ID_OS"))))
                    {
                        reg.Id_os = reader.GetDecimal(reader.GetOrdinal("ID_OS"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("CD_Empresa"))))
                    {
                        reg.Cd_empresa = reader.GetString(reader.GetOrdinal("CD_Empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_historico")))
                    {
                        reg.Id_historico = reader.GetDecimal(reader.GetOrdinal("id_historico"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("ds_historico"))))
                    {
                        reg.Ds_historico = reader.GetString(reader.GetOrdinal("ds_historico"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("login"))))
                    {
                        reg.Login = reader.GetString(reader.GetOrdinal("login"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("dt_historico"))))
                    {
                        reg.Dt_historico = reader.GetDateTime(reader.GetOrdinal("dt_historico"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
示例#26
0
        public TList_Auditoria Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_Auditoria lista         = new TList_Auditoria();
            bool            podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), string.Empty));
            try
            {
                while (reader.Read())
                {
                    TRegistro_Auditoria reg = new TRegistro_Auditoria();
                    if (!reader.IsDBNull(reader.GetOrdinal("id_auditoria")))
                    {
                        reg.Id_auditoria = reader.GetDecimal(reader.GetOrdinal("id_auditoria"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("login")))
                    {
                        reg.Login = reader.GetString(reader.GetOrdinal("login"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_evento")))
                    {
                        reg.Dt_evento = reader.GetDateTime(reader.GetOrdinal("dt_evento"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nm_tabela")))
                    {
                        reg.Nm_tabela = reader.GetString(reader.GetOrdinal("nm_tabela"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("tp_evento")))
                    {
                        reg.Tp_evento = reader.GetString(reader.GetOrdinal("tp_evento"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_chave")))
                    {
                        reg.id_chave = reader.GetString(reader.GetOrdinal("id_chave"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
示例#27
0
        private void VisualizarPub_Load(object sender, EventArgs e)
        {
            //Traigo la informacion del la publicacion
            System.Data.SqlClient.SqlCommand comUsu = new System.Data.SqlClient.SqlCommand("LOS_GESTORES.sp_app_getInfoPublicacionXId");

            //Defino los parametros
            System.Data.SqlClient.SqlParameter pUsu = new System.Data.SqlClient.SqlParameter("@id_publ", this.id_pub);
            comUsu.Parameters.Add(pUsu);

            // Abro la conexion
            AccesoDatos.getInstancia().abrirConexion();

            System.Data.SqlClient.SqlDataReader pub = AccesoDatos.getInstancia().ejecutaSP(comUsu);

            if (!pub.HasRows)
            {
                MessageBox.Show("Publicacion invalida");
                return;
            }

            pub.Read();
            this.lblUsu.Text     = pub.GetString(0);
            this.txtBoxDesc.Text = pub.GetString(1);
            this.lblTipo.Text    = pub.GetString(2);

            if (this.lblTipo.Text.Equals("Subasta"))
            {
                this.lblStock.Text      = "NO APLICABLE";
                this.lblPrecio.Text     = pub.GetDecimal(5).ToString();
                this.btnComprar.Enabled = false;
                this.txtCant.Enabled    = false;
            }
            if (this.lblTipo.Text.Equals("Compra Inmediata"))
            {
                this.lblStock.Text      = pub.GetDecimal(3).ToString();
                this.lblPrecio.Text     = pub.GetDecimal(4).ToString();
                this.btnOfertar.Enabled = false;
                this.txtOferta.Enabled  = false;
            }

            this.lblFecVen.Text = pub.GetDateTime(6).ToShortDateString();

            if (pub.GetInt16(7) == 0)
            {
                this.btnPreg.Enabled = false;
            }

            //id del vendedor
            this.id_vendedor = pub.GetInt32(8);

            // Cierro la conexion
            pub.Close();
            AccesoDatos.getInstancia().cerrarConexion();
        }
示例#28
0
        public HG_OrderItem GetOne(Int64 OIID = 0)
        {
            System.Data.SqlClient.SqlCommand    cmd = null;
            System.Data.SqlClient.SqlDataReader SDR = null;
            HG_OrderItem ObjTmp = new HG_OrderItem();
            DBCon        Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM HG_ORDERITEM WHERE OIID=" + OIID.ToString() + " and Deleted=0 ";
                //if (TicketNo > 0)
                //{
                //    Query = "SELECT * FROM HG_ORDERITEM WHERE TickedNo=" + TicketNo.ToString() + " and Deleted=0 ";
                //}
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp              = new HG_OrderItem();
                    ObjTmp.OIID         = SDR.GetInt64(0);
                    ObjTmp.FID          = SDR.GetInt64(1);
                    ObjTmp.Price        = SDR.GetDouble(2);
                    ObjTmp.Count        = SDR.GetInt32(3);
                    ObjTmp.IsAddon      = SDR.GetString(4);
                    ObjTmp.OID          = SDR.GetInt64(5);
                    ObjTmp.Status       = SDR.GetInt32(7);
                    ObjTmp.OrderDate    = SDR.GetDateTime(8);
                    ObjTmp.UpdatedBy    = SDR.GetInt32(9);
                    ObjTmp.UpdationDate = SDR.GetDateTime(10);
                    ObjTmp.TickedNo     = SDR.GetInt32(11);
                    ObjTmp.ChefSeenBy   = SDR.GetInt32(12);
                    ObjTmp.OrgId        = SDR.GetInt32(13);
                    ObjTmp.OrdById      = SDR.GetInt64(14);
                    ObjTmp.TaxInItm     = SDR.GetDouble(15);
                    ObjTmp.CostPrice    = SDR.GetDouble(16);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ObjTmp);
        }
示例#29
0
        private Dictionary <Tuple <long, DateTime>, DERMSCommon.SCADACommon.DayItem> ReadFromCollectTable(string connectionString)
        {
            DERMSCommon.SCADACommon.DayItem itemDay = null;
            Dictionary <Tuple <long, DateTime>, DERMSCommon.SCADACommon.DayItem> dayItems = new Dictionary <Tuple <long, DateTime>, DERMSCommon.SCADACommon.DayItem>();
            Tuple <long, DateTime> key = null;
            Dictionary <Tuple <long, DateTime>, DERMSCommon.SCADACommon.CollectItem> collectItemsData = new Dictionary <Tuple <long, DateTime>, DERMSCommon.SCADACommon.CollectItem>();

            using (System.Data.SqlClient.SqlConnection _con = new System.Data.SqlClient.SqlConnection(connectionString))
            {
                using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("SELECT Timestamp, Gid, Production FROM dbo.Collect", _con))
                {
                    _con.Open();
                    using (System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader())
                    {
                        // Check is the reader has any rows at all before starting to read.
                        if (reader.HasRows)
                        {
                            // Read advances to the next row.
                            while (reader.Read())
                            {
                                DERMSCommon.SCADACommon.CollectItem c = new DERMSCommon.SCADACommon.CollectItem();
                                // To avoid unexpected bugs access columns by name.
                                try
                                {
                                    c.Timestamp = reader.GetDateTime(reader.GetOrdinal("Timestamp"));
                                    c.Gid       = reader.GetInt64(reader.GetOrdinal("Gid"));
                                    c.P         = reader.GetDouble(reader.GetOrdinal("Production"));
                                    key         = new Tuple <long, DateTime>(c.Gid, c.Timestamp);

                                    collectItemsData.Add(key, c);
                                }
                                catch (Exception e)
                                { }
                            }
                        }
                    }

                    _con.Close();
                }
            }

            foreach (var d in collectItemsData)
            {
                itemDay = new DERMSCommon.SCADACommon.DayItem(d.Key.Item1, d.Key.Item2.Date.AddHours(d.Key.Item2.Hour), MinProductionPerHour(d.Key.Item2.Hour, d.Key.Item2.DayOfYear, collectItemsData), MaxProductionPerHour(d.Key.Item2.Hour, d.Key.Item2.DayOfYear, collectItemsData), AvgProductionPerHour(d.Key.Item2.Hour, d.Key.Item2.DayOfYear, collectItemsData), 0, 0);
                key     = new Tuple <long, DateTime>(itemDay.Gid, itemDay.Timestamp);
                if (!dayItems.ContainsKey(key))
                {
                    dayItems.Add(key, itemDay);
                }
            }

            return(dayItems);
        }
示例#30
0
        public TxItem Add(System.Data.SqlClient.SqlDataReader reader)
        {
            var item = new TxItem
            {
                IntValue  = reader.GetInt32(0),
                DateValue = reader.GetDateTime(1),
                LongValue = reader.GetInt64(2),
            };

            Items.Add(item);

            return(item);
        }