Beispiel #1
0
        public bool Update(Model.Products products)
        {
            String sql = "update Products set ProductName='{0}',Unit='{1}',UnitPrice={2},UpdatePerson='{3}',UpdateTime='{4}',State={5} where Id='{6}'";

            sql = String.Format(sql, products.ProductName, products.Unit, products.UnitPrice, products.UpdatePerson, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                products.State, products.Id);
            return(DataBase.Base_cmd(sql));
        }
Beispiel #2
0
        public bool Update(Model.Orders orders, OleDbTransaction tr)
        {
            String sql  = "update Orders set State=0 where Id='" + orders.Id + "';";
            String sql2 = "update OrdersDetail set State=0 where OrdersId='" + orders.Id + "'";

            DataBase.Base_cmd(sql + sql2, tr);
            return(true);
        }
Beispiel #3
0
 public void UpdateForJisuan(List <Agents> agentsList, OleDbTransaction tr)
 {
     foreach (Agents agents in agentsList)
     {
         String sql = @"UPDATE [dbo].[Agents]
                        SET [Name] = '{0}'
                           ,[Province] = '{1}'
                           ,[City] = '{2}'
                           ,[Village] = '{3}'
                           ,[Birthday] = '{4}'
                           ,[CareerStatus] = '{5}'
                           ,[JoinDate] = '{6}'
                           ,[Rank] = '{7}'
                           ,[RefereeId] = '{8}'
                           ,[RefereeName] = '{9}'
                           ,[AgencyId] = '{10}'
                           ,[AgencyName] = '{11}'
                           ,[AccountBank] = '{12}'
                           ,[AccountBankBranch] = '{13}'
                           ,[Account] = '{14}'
                           ,[Address] = '{15}'
                           ,[ZipCode] = '{16}'
                           ,[Phone] = '{17}'
                           ,[CreateTime] = '{18}'
                           ,[CreatePerson] = '{19}'
                           ,[UpdateTime] = '{20}'
                           ,[UpdatePerson] = '{21}'
                           ,[State] = {22}
                           ,[AgentsStatus] = {23}
                      WHERE Id='" + agents.Id + "'";
         sql = String.Format(sql, agents.Name
                             , agents.Province
                             , agents.City
                             , agents.Village
                             , agents.Birthday
                             , agents.CareerStatus
                             , agents.JoinDate
                             , agents.Rank
                             , agents.RefereeId
                             , agents.RefereeName
                             , agents.AgencyId
                             , agents.AgencyName
                             , agents.AccountBank
                             , agents.AccountBankBranch
                             , agents.Account
                             , agents.Address
                             , agents.ZipCode
                             , agents.Phone
                             , agents.CreateTime
                             , agents.CreatePerson
                             , DateTime.Now
                             , agents.UpdatePerson
                             , agents.State
                             , agents.AgentsStatus);
         DataBase.Base_cmd(sql, tr);
     }
 }
Beispiel #4
0
        public bool Insert(Model.Agents agents)
        {
            String sql = @"INSERT INTO [dbo].[Agents]
                           ([Id]
                           ,[Name]
                           ,[Province]
                           ,[City]
                           ,[Village]
                           ,[Birthday]
                           ,[CareerStatus]
                           ,[JoinDate]
                           ,[Rank]
                           ,[RefereeId]
                           ,[RefereeName]
                           ,[AgencyId]
                           ,[AgencyName]
                           ,[AccountBank]
                           ,[AccountBankBranch]
                           ,[Account]
                           ,[Address]
                           ,[ZipCode]
                           ,[Phone]
                           ,[CreateTime]
                           ,[CreatePerson]
                           ,[UpdateTime]
                           ,[UpdatePerson]
                           ,[State],[AgentsStatus])
                     VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}')";

            sql = String.Format(sql, agents.Id
                                , agents.Name
                                , agents.Province
                                , agents.City
                                , agents.Village
                                , agents.Birthday
                                , agents.CareerStatus
                                , agents.JoinDate
                                , agents.Rank
                                , agents.RefereeId
                                , agents.RefereeName
                                , agents.AgencyId
                                , agents.AgencyName
                                , agents.AccountBank
                                , agents.AccountBankBranch
                                , agents.Account
                                , agents.Address
                                , agents.ZipCode
                                , agents.Phone
                                , agents.CreateTime
                                , agents.CreatePerson
                                , agents.UpdateTime
                                , agents.UpdatePerson
                                , agents.State, agents.AgentsStatus);
            return(DataBase.Base_cmd(sql));
        }
Beispiel #5
0
        public bool Insert(Model.Products products)
        {
            String sql = "insert into Products ([Id],[ProductName],[Unit] ,[UnitPrice],[CreatePerson],[CreateTime],[UpdatePerson],[UpdateTime],[State]) values (";

            sql += "'" + products.Id + "',";
            sql += "'" + products.ProductName + "',";
            sql += "'" + products.Unit + "',";
            sql += "" + products.UnitPrice + ",";
            sql += "'" + products.CreatePerson + "',";
            sql += "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
            sql += "'" + products.UpdatePerson + "',";
            sql += "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
            sql += products.State + ")";
            return(DataBase.Base_cmd(sql));
        }
Beispiel #6
0
        public void Insert(Model.LogMonthCreate logMonthCreate)
        {
            String sql = @"INSERT INTO [dbo].[LogMonthCreate]
                                   ([Id]
                                   ,[YearMonth]
                                   ,[CreateTime]
                                   ,[CreatePerson]
                                   ,[UpdateTime]
                                   ,[UpdatePerson]
                                   ,[State])
                             VALUES
                                   ('{0}'
                                   ,'{1}'
                                   ,'{2}'
                                   ,'{3}'
                                   ,'{4}'
                                   ,'{5}'
                                   ,{6})";

            sql = String.Format(sql, logMonthCreate.Id, logMonthCreate.YearMonth, logMonthCreate.CreateTime, logMonthCreate.CreatePerson, logMonthCreate.UpdateTime,
                                logMonthCreate.UpdatePerson, logMonthCreate.State);
            DataBase.Base_cmd(sql);
        }
Beispiel #7
0
 public bool Insert(Model.OrdersDetail ordersdetail)
 {
     if (!String.IsNullOrWhiteSpace(ordersdetail.CreatePerson))
     {
         String sql = @"INSERT INTO [dbo].[OrdersDetail]
                    ([Id]
                    ,[OrdersId]
                    ,[ProductId]
                    ,[ProductName]
                    ,[UnitPrice]
                    ,[Num]
                    ,[Price]
                    ,[CreateTime]
                    ,[CreatePerson]
                    ,[UpdateTime]
                    ,[UpdatePerson],[State])
              VALUES ('{0}','{1}','{2}','{3}',{4},{5},{6},'{7}','{8}','{9}','{10}',{11} );";
         sql = String.Format(sql, ordersdetail.Id, ordersdetail.OrdersId, ordersdetail.ProductId, ordersdetail.ProductName, ordersdetail.UnitPrice, ordersdetail.Num,
                             ordersdetail.Price, ordersdetail.CreateTime, ordersdetail.CreatePerson, ordersdetail.UpdateTime, ordersdetail.UpdatePerson, ordersdetail.State);
         return(DataBase.Base_cmd(sql));
     }
     return(false);
 }
Beispiel #8
0
        public bool Update(Model.Agents agents)
        {
            String sql = @"UPDATE [dbo].[Agents]
                           SET [Name] = '{0}'
                              ,[Province] = '{1}'
                              ,[City] = '{2}'
                              ,[Birthday] = '{3}'
                              ,[JoinDate] = '{4}'
                              ,[RefereeId] = '{5}'
                              ,[RefereeName] = '{6}'
                              ,[AccountBank] = '{7}'
                              ,[AccountBankBranch] = '{8}'
                              ,[Account] =  '{9}'
                              ,[Address] =  '{10}'
                              ,[ZipCode] =  '{11}'
                              ,[Phone] =  '{12}'
                              ,[UpdateTime] =  '{13}'
                              ,[UpdatePerson] =  '{14}'
                         WHERE Id='{15}'";

            sql = String.Format(sql, agents.Name
                                , agents.Province
                                , agents.City
                                , agents.Birthday
                                , agents.JoinDate
                                , agents.RefereeId
                                , agents.RefereeName
                                , agents.AccountBank
                                , agents.AccountBankBranch
                                , agents.Account
                                , agents.Address
                                , agents.ZipCode
                                , agents.Phone
                                , agents.UpdateTime
                                , agents.UpdatePerson, agents.Id);
            return(DataBase.Base_cmd(sql));
        }
Beispiel #9
0
        public void InsertOrUpdateIncome(OleDbTransaction tr, Model.Income income, bool isInsert)
        {
            if (isInsert)
            {
                String sql = @"INSERT INTO [dbo].[Income]
                               ([YearMonth]
                               ,[AgentId]
                               ,[AgentName]
                               ,[CareerStatus]
                               ,[Rank]
                               ,[RefereeId]
                               ,[RefereeName]
                               ,[AgencyId]
                               ,[AgencyName]
                               ,[CreateTime]
                               ,[CreatePerson]
                               ,[UpdateTime]
                               ,[UpdatePerson]
                               ,[State]
                               ,[AllMonthMoney]
                               ,[LastMonthMoney]
                               ,[NearlyThreeMonthsMoney]
                               ,[NearlySixMonthsMoney]
                               ,[SalesMoney]
                               ,[SalesServiceMoney]
                               ,[PersonalMoney]
                               ,[PersonalServiceMoney]
                               ,[MarketMoney]
                               ,[MarketServiceMoney]
                               ,[OneMoney]
                               ,[TwoMoney]
                               ,[ThreeMoney]
                               ,[RegionServiceMoney]
                               ,[RegionYum]
                               ,[RegionServiceYum]
                               ,[IncomeMoney],[AllSalesMoney])
                         VALUES ({0} ,'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}'
                                   ,'{11}','{12}',{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31});";
                sql = String.Format(sql, income.YearMonth
                                    , income.AgentId
                                    , income.AgentName
                                    , income.CareerStatus
                                    , income.Rank
                                    , income.RefereeId
                                    , income.RefereeName
                                    , income.AgencyId
                                    , income.AgencyName
                                    , income.CreateTime
                                    , income.CreatePerson
                                    , income.UpdateTime
                                    , income.UpdatePerson
                                    , income.State
                                    , income.AllMonthMoney
                                    , income.LastMonthMoney
                                    , income.NearlyThreeMonthsMoney
                                    , income.NearlySixMonthsMoney
                                    , income.SalesMoney
                                    , income.SalesServiceMoney
                                    , income.PersonalMoney
                                    , income.PersonalServiceMoney
                                    , income.MarketMoney
                                    , income.MarketServiceMoney
                                    , income.OneMoney
                                    , income.TwoMoney
                                    , income.ThreeMoney
                                    , income.RegionServiceMoney
                                    , income.RegionYum
                                    , income.RegionServiceYum
                                    , income.IncomeMoney, income.AllSalesMoney);

                DataBase.Base_cmd(sql, tr);
            }
            else
            {
                String sql = @"UPDATE [dbo].[Income]
                               SET [AgentName] = '{0}'
                                  ,[CareerStatus] = '{1}'
                                  ,[Rank] = '{2}'
                                  ,[RefereeId] = '{3}'
                                  ,[RefereeName] = '{4}'
                                  ,[AgencyId] = '{5}'
                                  ,[AgencyName] = '{6}'
                                  ,[CreateTime] = '{7}'
                                  ,[CreatePerson] = '{8}'
                                  ,[UpdateTime] = '{9}'
                                  ,[UpdatePerson] = '{10}'
                                  ,[State] = {11}
                                  ,[AllMonthMoney] = {12}
                                  ,[LastMonthMoney] = {13}
                                  ,[NearlyThreeMonthsMoney] = {14}
                                  ,[NearlySixMonthsMoney] = {15}
                                  ,[SalesMoney] = {16}
                                  ,[SalesServiceMoney] = {17}
                                  ,[PersonalMoney] = {18}
                                  ,[PersonalServiceMoney] = {19}
                                  ,[MarketMoney] = {20}
                                  ,[MarketServiceMoney] = {21}
                                  ,[OneMoney] = {22}
                                  ,[TwoMoney] = {23}
                                  ,[ThreeMoney] = {24}
                                  ,[RegionServiceMoney] = {25}
                                  ,[RegionYum] = {26}
                                  ,[RegionServiceYum] = {27}
                                  ,[IncomeMoney] = {28}
                                  ,[AllSalesMoney]={29}
                             WHERE YearMonth=" + income.YearMonth + " and AgentId='" + income.AgentId + "'";
                sql = String.Format(sql, income.AgentName
                                    , income.CareerStatus
                                    , income.Rank
                                    , income.RefereeId
                                    , income.RefereeName
                                    , income.AgencyId
                                    , income.AgencyName
                                    , income.CreateTime
                                    , income.CreatePerson
                                    , income.UpdateTime
                                    , income.UpdatePerson
                                    , income.State
                                    , income.AllMonthMoney
                                    , income.LastMonthMoney
                                    , income.NearlyThreeMonthsMoney
                                    , income.NearlySixMonthsMoney
                                    , income.SalesMoney
                                    , income.SalesServiceMoney
                                    , income.PersonalMoney
                                    , income.PersonalServiceMoney
                                    , income.MarketMoney
                                    , income.MarketServiceMoney
                                    , income.OneMoney
                                    , income.TwoMoney
                                    , income.ThreeMoney
                                    , income.RegionServiceMoney
                                    , income.RegionYum
                                    , income.RegionServiceYum
                                    , income.IncomeMoney, income.AllSalesMoney);
                DataBase.Base_cmd(sql, tr);
            }
        }
Beispiel #10
0
        public void UpdateState(String id)
        {
            String sql = "update [dbo].[LogMonthCreate] set State=1 where Id='" + id + "'";

            DataBase.Base_cmd(sql);
        }
Beispiel #11
0
        public bool UpdateAgents(Model.Agents agents)
        {
            String sql = "update [dbo].[Agents] set Rank='" + agents.Rank + "',CareerStatus='" + agents.CareerStatus + "',State='" + agents.State + "' where Id='" + agents.Id + "'";

            return(DataBase.Base_cmd(sql));
        }
Beispiel #12
0
        public bool Delete(String id)
        {
            String sql = "delete [dbo].[OrdersDetail] where Id='" + id + "'";

            return(DataBase.Base_cmd(sql));
        }