Exemplo n.º 1
0
        public static List <ProductViewModel> SearchBysql(string name)
        {
            string sql = "select a.*,b.[ProductName] from Products a join ProductTypes b on a.[ProductType_Id] = b.[Id] where a.[Name] like '%" + name + "%'";
            List <ProductViewModel> modelArr = new List <ProductViewModel>();

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        ProductViewModel model = new ProductViewModel();
                        model.Id              = Convert.ToInt32(reader[EProducts.Id.ToString()]);
                        model.Name            = reader[EProducts.Name.ToString()].ToString();
                        model.ProductType_Id  = Convert.ToInt32(reader[EProducts.ProductType_Id.ToString()]);
                        model.ProductTypeName = reader["ProductName"].ToString();
                        model.Price           = Convert.ToDouble(reader[EProducts.Price.ToString()]);
                        model.AddedTime       = Convert.ToDateTime(reader[EProducts.AddedTime.ToString()]);
                        model.UpdateTime      = Convert.ToDateTime(reader[EProducts.UpdateTime.ToString()]);
                        modelArr.Add(model);
                    }
                }
            }
                                                                                   ));
            return(modelArr);
        }
Exemplo n.º 2
0
        public static List <ProductViewModel> SearchAll()
        {
            string sql = "select * from AllProsView ";
            List <ProductViewModel> modelArr = new List <ProductViewModel>();

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        ProductViewModel model = new ProductViewModel();
                        model.Id              = Convert.ToInt32(reader[EProducts.Id.ToString()]);
                        model.Name            = reader[EProducts.Name.ToString()].ToString();
                        model.Price           = Convert.ToDouble(reader[EProducts.Price.ToString()]);
                        model.KamiNum         = Convert.ToInt32(reader["kamiNum"]);
                        model.ProductType_Id  = Convert.ToInt32(reader[EProducts.ProductType_Id.ToString()]);
                        model.ProductTypeName = reader["ProductName"].ToString();
                        model.AddedTime       = Convert.ToDateTime(reader[EProducts.AddedTime.ToString()]);
                        model.UpdateTime      = Convert.ToDateTime(reader[EProducts.UpdateTime.ToString()]);
                        modelArr.Add(model);
                    }
                }
            }
                                                                                   ));
            return(modelArr);
        }
Exemplo n.º 3
0
        public static ProductViewModel SearchById(string id)
        {
            string           sql   = "select a.*,b.[ProductName] from Products a join ProductTypes b on a.[ProductType_Id] = b.[Id] where a.[Id]=" + id;
            ProductViewModel model = null;

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        model                 = new ProductViewModel();
                        model.Id              = Convert.ToInt32(reader[EProducts.Id.ToString()]);
                        model.Name            = reader[EProducts.Name.ToString()].ToString();
                        model.ProductType_Id  = Convert.ToInt32(reader[EProducts.ProductType_Id.ToString()]);
                        model.ProductTypeName = reader["ProductName"].ToString();
                        model.Price           = Convert.ToDouble(reader[EProducts.Price.ToString()]);
                        model.AddedTime       = Convert.ToDateTime(reader[EProducts.AddedTime.ToString()]);
                        model.UpdateTime      = Convert.ToDateTime(reader[EProducts.UpdateTime.ToString()]);
                    }
                }
            }
                                                                                   ));
            return(model);
        }
Exemplo n.º 4
0
        public static List <OrderViewModel> SearchByContact(string contacts)
        {
            if (string.IsNullOrEmpty(contacts))
            {
                return(null);
            }
            string sql = "select * from Orders where Remark ='" + contacts.Trim() + "' ";
            List <OrderViewModel> modelArr = new List <OrderViewModel>();

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        OrderViewModel model = new OrderViewModel();
                        model.Id             = Convert.ToInt32(reader[EOrders.Id.ToString()]);
                        model.NO             = reader[EOrders.NO.ToString()].ToString();
                        model.Type           = reader[EOrders.Type.ToString()].ToString();
                        model.Product_Id     = Convert.ToInt32(reader[EOrders.Product_Id.ToString()]);
                        model.Price          = Convert.ToDouble(reader[EOrders.Price.ToString()]);
                        model.Count          = Convert.ToInt32(reader[EOrders.Count.ToString()]);
                        model.Status         = reader[EOrders.Status.ToString()].ToString();
                        model.LocalStatus    = reader[EOrders.LocalStatus.ToString()].ToString();
                        model.UpdateTime     = Convert.ToDateTime(reader[EOrders.UpdateTime.ToString()]);
                        model.Remark         = reader[EOrders.Remark.ToString()].ToString();
                        modelArr.Add(model);
                    }
                }
            }
                                                                                   ));
            return(modelArr);
        }
Exemplo n.º 5
0
        public static OrderViewModel SearchBySql(string sql)
        {
            if (string.IsNullOrEmpty(sql))
            {
                return(null);
            }
            OrderViewModel model = new OrderViewModel();

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        model.Id          = Convert.ToInt32(reader[EOrders.Id.ToString()]);
                        model.NO          = reader[EOrders.NO.ToString()].ToString();
                        model.Type        = reader[EOrders.Type.ToString()].ToString();
                        model.Product_Id  = Convert.ToInt32(reader[EOrders.Product_Id.ToString()]);
                        model.Price       = Convert.ToDouble(reader[EOrders.Price.ToString()]);
                        model.Count       = Convert.ToInt32(reader[EOrders.Count.ToString()]);
                        model.Status      = reader[EOrders.Status.ToString()].ToString();
                        model.LocalStatus = reader[EOrders.LocalStatus.ToString()].ToString();
                        model.UpdateTime  = Convert.ToDateTime(reader[EOrders.UpdateTime.ToString()]);
                        model.Remark      = reader[EOrders.Remark.ToString()].ToString();
                    }
                }
            }
                                                                                   ));
            return(model);
        }
Exemplo n.º 6
0
        public static UsersViewModel SearchById(int id)
        {
            string sql = "select * from Users where id=" + id;

            UsersViewModel model = new UsersViewModel();

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        model.Id         = Convert.ToInt32(reader[EUsers.Id.ToString()]);
                        model.userName   = reader[EUsers.userName.ToString()].ToString();
                        model.isRemmber  = Convert.ToInt32(reader[EUsers.isRemmber.ToString()]);
                        model.UpdateTime = Convert.ToDateTime(reader[EUsers.UpdateTime.ToString()]);
                        model.password   = reader[EUsers.password.ToString()].ToString();
                    }
                }
            }
                                                                                   ));


            return(model);
        }
Exemplo n.º 7
0
Arquivo: BKaMi.cs Projeto: bowena/faka
        public static KaMiViewModel SearchById(int id)
        {
            string sql = "select * from Kamis where id=" + id;

            KaMiViewModel model = new KaMiViewModel();

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        model.Id             = Convert.ToInt32(reader[EKamis.Id.ToString()]);
                        model.Content        = reader[EKamis.Content.ToString()].ToString();
                        model.State          = Convert.ToInt32(reader[EKamis.State.ToString()]);
                        model.Product_Id     = Convert.ToInt32(reader[EKamis.Product_Id.ToString()]);
                        model.ProductType_Id = Convert.ToInt32(reader[EKamis.ProductType_Id.ToString()]);
                        model.AddedTime      = Convert.ToDateTime(reader[EKamis.AddedTime.ToString()]);
                        model.UpdateTime     = Convert.ToDateTime(reader[EKamis.UpdateTime.ToString()]);
                        model.Trade_No       = reader[EKamis.Trade_No.ToString()].ToString();
                        model.Remark         = reader[EKamis.Remark.ToString()].ToString();
                    }
                }
            }
                                                                                   ));


            return(model);
        }
Exemplo n.º 8
0
Arquivo: BKaMi.cs Projeto: bowena/faka
        public static Dictionary <int, string> SearchKamiByContact(string email, ref string tradeNo)
        {
            string sql = "";

            if (!string.IsNullOrEmpty(email))
            {
                sql = "select a.Id,a.Content,b.NO from Kamis a join Orders b on a.Product_Id=b.Product_Id where a.Remark='" + email + "' and b.Remark='" + email + "' ";
            }
            else
            {
                sql = "select a.Id,a.Content,b.NO from Kamis a join Orders b on a.Product_Id=b.Product_Id where a.Trade_No='" + tradeNo + "' and b.NO='" + tradeNo + "' ";
            }
            string no = "";
            Dictionary <int, string> modelArr = new Dictionary <int, string>();

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        int id         = Convert.ToInt32(reader[EKamis.Id.ToString()]);
                        string content = reader[EKamis.Content.ToString()].ToString();
                        no             = reader["NO"].ToString();
                        modelArr.Add(id, content);
                    }
                }
            }));
            tradeNo = no;
            return(modelArr);
        }
Exemplo n.º 9
0
Arquivo: BKaMi.cs Projeto: bowena/faka
        public static List <KaMiViewModel> SearchBysql(string name, string typeId, string Id)
        {
            string sql = "select a.*,b.Name,c.ProductName FROM Kamis a JOIN Products b on a.Product_Id = b.Id JOIN ProductTypes c on a.ProductType_Id = c.Id where a.[ProductType_Id]=" + typeId + "  and a.[Product_Id]=" + Id + " and a.[Content] like '%" + name + "%'";
            List <KaMiViewModel> modelArr = new List <KaMiViewModel>();

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        KaMiViewModel model   = new KaMiViewModel();
                        model.Id              = Convert.ToInt32(reader[EKamis.Id.ToString()]);
                        model.Content         = reader[EKamis.Content.ToString()].ToString();
                        model.State           = Convert.ToInt32(reader[EKamis.State.ToString()]);
                        model.Product_Id      = Convert.ToInt32(reader[EKamis.Product_Id.ToString()]);
                        model.ProductName     = reader["Name"].ToString();
                        model.ProductType_Id  = Convert.ToInt32(reader[EKamis.ProductType_Id.ToString()]);
                        model.ProductTypeName = reader["ProductName"].ToString();
                        model.AddedTime       = Convert.ToDateTime(reader[EKamis.AddedTime.ToString()]);
                        model.UpdateTime      = Convert.ToDateTime(reader[EKamis.UpdateTime.ToString()]);
                        model.Trade_No        = reader[EKamis.Trade_No.ToString()].ToString();
                        model.Remark          = reader[EKamis.Remark.ToString()].ToString();
                        modelArr.Add(model);
                    }
                }
            }
                                                                                   ));
            return(modelArr);
        }
Exemplo n.º 10
0
Arquivo: BKaMi.cs Projeto: bowena/faka
        public static Dictionary <int, string> SearchKamiByTrade(OrderViewModel order)
        {
            string sql = "select Id,Content from Kamis where Product_Id=" + order.Product_Id + " and State=" + (int)KamiState.NotUse + " order by AddedTime asc limit " + order.Count;
            Dictionary <int, string> modelArr = new Dictionary <int, string>();

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        int id         = Convert.ToInt32(reader[EKamis.Id.ToString()]);
                        string content = reader[EKamis.Content.ToString()].ToString();
                        modelArr.Add(id, content);
                    }
                }
            }
                                                                                   ));
            return(modelArr);
        }
Exemplo n.º 11
0
        public static List <ProductTypeViewModel> SearchBysql(string name)
        {
            string sql = "select * from ProductTypes where ProductName like '%" + name + "%'";
            List <ProductTypeViewModel> modelArr = new List <ProductTypeViewModel>();

            ManagerSqlite.GetSQLiteDataReader(sql, null, new IDbDataReaderCallBack(delegate(DbDataReader reader)
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        ProductTypeViewModel model = new ProductTypeViewModel();
                        model.Id          = Convert.ToInt32(reader[EProductTypes.Id.ToString()]);
                        model.ProductName = reader[EProductTypes.ProductName.ToString()].ToString();
                        model.UpdateTime  = Convert.ToDateTime(reader[EProductTypes.UpdateTime.ToString()]);
                        modelArr.Add(model);
                    }
                }
            }
                                                                                   ));
            return(modelArr);
        }