Exemplo n.º 1
0
        public void CreateTable()
        {
            string     tablsestr = @"CREATE TABLE TestUser (
                id int,
                firstName varchar(32))";
            TradAction action    = new TradAction();

            action.Excute(tablsestr);
            ////Data Source=file::memory:,version=3
            //string connectionString = "Data Source=:memory:;Version=3";

            //dbcon = (IDbConnection)new System.Data.SQLite.SQLiteConnection(connectionString);
            //dbcon.Open();
            //IDbCommand dbcmd = dbcon.CreateCommand();
            //dbcmd.CommandText = tablsestr;
            //dbcmd.ExecuteScalar();

            //// requires a table to be created named employee
            //// with columns firstname and lastname
            //// such as,
            ////        CREATE TABLE employee (
            ////           firstname varchar(32),
            ////           lastname varchar(32));
            //string sql = "insert into TestUser(id,firstName) values(1,'123asdasd');";
            //   //"SELECT * " +
            //   //"FROM TestUser";
            //dbcmd.CommandText = sql;
            //dbcmd.ExecuteScalar();
            //dbcmd.Dispose();
            //dbcmd = null;
        }
Exemplo n.º 2
0
 public void SetStae(string ids, int state)
 {
     using (TradAction action = new TradAction())
     {
         string sql = "update sms_account set `state`='" + state + "' where id in (" + ids + ")";
         action.Excute(sql);
     }
 }
Exemplo n.º 3
0
 public void UpdatePwd(string pwd, string accountid)
 {
     using (TradAction action = new TradAction())
     {
         string sql = "update sms_account set `PASSWORD`='" + md5.Encrypt(pwd) + "' where id=" + accountid + "";
         action.Excute(sql);
     }
 }
Exemplo n.º 4
0
 public bool UpdateMyPwd(string pwd, string accountid, string oldpwd)
 {
     using (TradAction action = new TradAction())
     {
         string sql = "update sms_account set `PASSWORD`='" + md5.Encrypt(pwd) + "' where id=" + accountid + " and `PASSWORD`='" + md5.Encrypt(oldpwd) + "'";
         action.Excute(sql);
         return(action.ReturnCode > 0);
     }
 }
Exemplo n.º 5
0
 public void UpdatePrice(int enterpriseid, float prices)
 {
     if (prices > 0)
     {
         using (TradAction action = new TradAction())
         {
             string sql = "update sms_enterprise set Capital=Capital-" + prices + " where id=" + enterpriseid + "";
             action.Excute(sql);
         }
     }
 }
Exemplo n.º 6
0
 public void UpdateSuccessCount(int batchid, int count)
 {
     if (count > 0)
     {
         using (TradAction action = new TradAction())
         {
             string sql = "update sms_batch_amount set SuccessAmount=SuccessAmount+" + count + " where BatchID=" + batchid + "";
             action.Excute(sql);
         }
     }
 }
Exemplo n.º 7
0
 public void AddList(List <SmsBatchDetailsInfo> infos)
 {
     using (TradAction action = new TradAction())
     {
         List <string> sqls = new List <string>();
         foreach (var info in infos)
         {
             InserAction inserAction = new InserAction(info);
             sqls.Add(inserAction.CreateSql(OperateEnum.Insert));
         }
         action.ExecuteSqlTran(sqls);
     }
 }
Exemplo n.º 8
0
 public void AddList(List <SmsMoInfo> molists)
 {
     using (TradAction action = new TradAction())
     {
         List <string> sqls = new List <string>();
         foreach (var mo in molists)
         {
             InserAction inserAction = new InserAction(mo);
             sqls.Add(inserAction.CreateSql(OperateEnum.Insert));
         }
         action.ExecuteSqlTran(sqls);
     }
 }
Exemplo n.º 9
0
        public void AddList(List <SmsEnterpriseCfgInfo> infos)
        {
            StringBuilder stringBuilder = new StringBuilder();

            foreach (SmsEnterpriseCfgInfo smsEnterpriseCfgInfo in infos)
            {
                stringBuilder.AppendLine("delete from sms_enterprise_cfg where EnterpriseID=" + smsEnterpriseCfgInfo.EnterpriseID + " and CfgKey='" + smsEnterpriseCfgInfo.CfgKey + "';");
                using (InserAction action = new InserAction(smsEnterpriseCfgInfo))
                {
                    stringBuilder.AppendLine(action.CreateSql(OperateEnum.Insert));
                }
            }
            TradAction taction = new TradAction();

            taction.Excute(stringBuilder.ToString());
        }
Exemplo n.º 10
0
        public void UpdateState(int batchId, BatchState batchState, int waitCount)
        {
            string sql = "";

            if (waitCount > -1)
            {
                sql = "update sms_batch set batchstate=" + (int)batchState + ",mtcount=" + waitCount + " where id=" + batchId + "";
            }

            else
            {
                sql = "update sms_batch set batchstate=" + (int)batchState + "  where id=" + batchId + "";
            }
            using (TradAction acion = new TradAction())
            {
                acion.Excute(sql);
            }
        }
Exemplo n.º 11
0
        public void ImportList(List <SmsContactInfo> contacts, int groupid)
        {
            if (contacts.Count > 0)
            {
                using (TradAction action = new TradAction())
                {
                    List <string> sqls = new List <string>();
                    foreach (var filterkey in contacts)
                    {
                        InserAction inserAction = new InserAction(filterkey);
                        sqls.Add(inserAction.CreateSql(OperateEnum.Insert));
                    }
                    action.ExecuteSqlTran(sqls);
                }
                string ids = "";
                using (SelectAction action = new SelectAction(this.Entity))
                {
                    action.SqlClomns = " min(id) as id ";
                    action.SqlGroupBy("Mobile,EnterpriseID,GroupID HAVING COUNT(1)>1");
                    action.SqlWhere("EnterpriseID", contacts[0].EnterpriseId);
                    if (groupid > 0)
                    {
                        action.SqlWhere("GroupID", groupid);
                    }
                    action.SqlPageParms(-1);
                    List <SmsBlackphoneInfo> idlist = action.QueryPage <SmsBlackphoneInfo>(0);

                    foreach (SmsBlackphoneInfo info in idlist)
                    {
                        ids += info.ID + ",";
                    }
                }
                using (DeleteAction taction = new DeleteAction(this.Entity))
                {
                    taction.SqlWhere(SmsBlackphoneInfo.Columns.ID, ids.TrimEnd(','), ConditionEnum.And,
                                     RelationEnum.In);
                    taction.SqlWhere(SmsBlackphoneInfo.Columns.EnterpriseID, contacts[0].EnterpriseId);

                    taction.Excute();
                }
            }
        }