Exemple #1
0
 public PageList <SmsMoInfo> GetList(int PageIndex, int PageSize, string phone, string content, string starttime, string endtime, int eid)
 {
     using (SelectAction action = new SelectAction(this.Entity))
     {
         if (!string.IsNullOrEmpty(phone))
         {
             action.SqlWhere(SmsMoInfo.Columns.Phone, phone, ConditionEnum.And, RelationEnum.Like);
         }
         if (!string.IsNullOrEmpty(content))
         {
             action.SqlWhere(SmsMoInfo.Columns.Content, content, ConditionEnum.And, RelationEnum.Like);
         }
         if (!string.IsNullOrEmpty(starttime) && string.IsNullOrEmpty(endtime))
         {
             action.SqlWhere(SmsMoInfo.Columns.ReceiveTime, starttime, ConditionEnum.And, RelationEnum.LargeThen);
         }
         if (!string.IsNullOrEmpty(endtime) && string.IsNullOrEmpty(starttime))
         {
             action.SqlWhere(SmsMoInfo.Columns.ReceiveTime, endtime, ConditionEnum.And, RelationEnum.LessThen);
         }
         if (!string.IsNullOrEmpty(endtime) && !string.IsNullOrEmpty(starttime))
         {
             action.SqlWhere(SmsMoInfo.Columns.ReceiveTime, starttime, endtime, ConditionEnum.And, RelationEnum.Between);
         }
         action.PageSize = PageSize;
         action.SqlWhere(SmsMoInfo.Columns.EnterpriseID, eid);
         action.SqlOrderBy(SmsMoInfo.Columns.CreateTime, OrderByEnum.Desc);
         return(action.QueryPage <SmsMoInfo>(PageIndex));
     }
 }
Exemple #2
0
        public List <SmsContactInfo> GetContacts(List <string> cids, int enterpriseId)
        {
            List <SmsContactInfo> infos = new List <SmsContactInfo>();
            string ids   = "";
            int    index = 0;

            foreach (string id in cids)
            {
                index++;
                ids += id + ",";
                if (index % 100 == 0 || index == cids.Count)
                {
                    using (SelectAction action = new SelectAction(this.Entity))
                    {
                        action.SqlWhere(SmsContactInfo.Columns.ID, ids.TrimEnd(','), ConditionEnum.And, RelationEnum.In);
                        action.SqlWhere(SmsContactInfo.Columns.EnterpriseId, enterpriseId);
                        action.SqlPageParms(-1);
                        List <SmsContactInfo> result = action.QueryPage <SmsContactInfo>(0);
                        if (result != null && result.Count > 0)
                        {
                            infos.AddRange(result);
                        }
                    }
                }
            }
            return(infos);
        }
Exemple #3
0
        /// <summary>
        /// 自定义视图
        /// </summary>
        public cms_user viewtestModel()
        {
            using (SelectAction action = new SelectAction(""))
            {
                action.SqlClomns = "_cms_user.*,_cms_manager.name as  managername";
                {
                    //添加视图的关联关系
                    List <QueryField> field = new List <QueryField>();
                    field.Add(new QueryField()
                    {
                        FiledName = "mangerid", Condition = ConditionEnum.And, Value = "id"
                    });
                    action.AddJoin(ViewJoinEnum.leftjoin, "cms_user", "cms_manager", field);
                }


                action.SqlWhere(
                    new QueryField {
                    FiledName = cms_user.Columns.username, Value = "wangjun"
                });
                action.SqlWhere(cms_user.Columns.password, "123456");
                PageList <cms_user> lists = action.QueryPage <cms_user>(1);
                return(null);
            }
        }
Exemple #4
0
        public List <SendingBatchModel> GetReadyBatch(int batchCount)
        {
            List <SendingBatchModel> models = new List <SendingBatchModel>();

            using (SelectAction action = new SelectAction(this.Entity))
            {
                action.PageSize = batchCount;
                action.SqlWhere(SmsBatchInfo.Columns.BatchState, (int)BatchState.Waiting);
                models = action.QueryPage <SendingBatchModel>(1);
            }
            string ids = "";

            foreach (var sendingBatchModel in models)
            {
                ids += sendingBatchModel.ID + ",";
            }
            if (ids.Length > 0)
            {
                using (UpdateAction update = new UpdateAction(this.Entity))
                {
                    update.SqlWhere(SmsBatchInfo.Columns.ID, ids.TrimEnd(','), ConditionEnum.And, RelationEnum.In);
                    update.SqlKeyValue(SmsBatchInfo.Columns.BatchState, (int)BatchState.Sending);
                    update.Excute();
                }
            }
            return(models);
        }
Exemple #5
0
 public PageList <SmsAccountInfo> GetList(int PageIndex, int PageSize)
 {
     using (SelectAction action = new SelectAction(this.Entity))
     {
         action.SqlPageParms(PageSize);
         return(action.QueryPage <SmsAccountInfo>(PageIndex));
     }
 }
Exemple #6
0
 public PageList <SmsBlackphoneInfo> GetList(int PageIndex, int PageSize, int enterpriseId)
 {
     using (SelectAction action = new SelectAction(this.Entity))
     {
         action.SqlWhere(SmsBlackphoneInfo.Columns.EnterpriseID, enterpriseId);
         action.SqlPageParms(PageSize);
         return(action.QueryPage <SmsBlackphoneInfo>(PageIndex));
     }
 }
Exemple #7
0
 public List <SmsEnterpriseCfgInfo> getCfgInfos(int enterpriseid)
 {
     using (SelectAction action = new SelectAction(this.Entity))
     {
         action.SqlWhere(SmsEnterpriseCfgInfo.Columns.EnterpriseID, enterpriseid);
         action.SqlPageParms(-1);
         return(action.QueryPage <SmsEnterpriseCfgInfo>(0));
     }
 }
Exemple #8
0
 public PageList <SmsBatchWaitInfo> GetReadyMt(int batchWaitCount, string batchids)
 {
     using (SelectAction action = new SelectAction(new SmsBatchWaitInfo()))
     {
         action.SqlPageParms(batchWaitCount);
         action.SqlWhere(SmsBatchWaitInfo.Columns.BatchID, batchids, RelationEnum.In);
         return(action.QueryPage <SmsBatchWaitInfo>(0));
     }
 }
Exemple #9
0
 /// <summary>
 /// 获取第3组30条数据
 /// </summary>
 /// <returns></returns>
 public PageList <cms_user> SelectDemo2()
 {
     using (SelectAction action = new SelectAction(Entity))
     {
         action.SqlPageParms(30).Cast <cms_user>()
         .Where(user1 => user1.username == "wangjun");
         return(action.QueryPage <cms_user>(3));
     }
 }
Exemple #10
0
 public PageList <SmsTemplateInfo> GetList(int PageIndex, int PageSize, int eid)
 {
     using (SelectAction action = new SelectAction(this.Entity))
     {
         if (eid > 0)
         {
             action.SqlWhere(SmsTemplateInfo.Columns.EnterpriseID, eid);
         }
         action.SqlPageParms(PageSize);
         return(action.QueryPage <SmsTemplateInfo>(PageIndex));
     }
 }
Exemple #11
0
 public List <SmsContactgroupInfo> getList(int parentId, int eid)
 {
     using (SelectAction action = new SelectAction(this.Entity))
     {
         if (eid > 0)
         {
             action.SqlWhere(SmsContactgroupInfo.Columns.EnterPriseID, eid);
         }
         action.SqlWhere(SmsContactgroupInfo.Columns.ParentGroupID, parentId);
         action.SqlPageParms(-1);
         return(action.QueryPage <SmsContactgroupInfo>(0));
     }
 }
Exemple #12
0
 public PageList <SmsEnterpriseInfo> GetList(int PageIndex, int PageSize)
 {
     using (SelectAction action = new SelectAction("`sms_enterprise` AS e"))
     {
         action.SqlClomns = "e.*,(select CfgValue from sms_enterprise_cfg WHERE CfgKey='smsprice' AND enterpriseid=e.`ID`) AS SmsPrice," +
                            "(select CfgValue from sms_enterprise_cfg WHERE CfgKey='chinamobile' AND enterpriseid=e.`ID`) AS chinamobile," +
                            "(select CfgValue from sms_enterprise_cfg WHERE CfgKey='union' AND enterpriseid=e.`ID`) AS `union`," +
                            "(select CfgValue from sms_enterprise_cfg WHERE CfgKey='cdma' AND enterpriseid=e.`ID`) AS cdma," +
                            "(select CfgValue from sms_enterprise_cfg WHERE CfgKey='smslength' AND enterpriseid=e.`ID`) AS smslength" +
                            "";
         action.SqlPageParms(PageSize);
         return(action.QueryPage <SmsEnterpriseInfo>(PageIndex));
     }
 }
Exemple #13
0
 public PageList <BatchMoreInfo> GetList(int PageIndex, int PageSize, string batchname, string state, string starttime, string endtime, int eid)
 {
     using (SelectAction action = new SelectAction(""))
     {
         action.SqlClomns = "_sms_batch.*,_sms_batch_amount.RealAmount,_sms_batch_amount.SendAmount,_sms_batch_amount.SuccessAmount";
         {
             //添加视图的关联关系
             List <QueryField> field = new List <QueryField>();
             field.Add(new QueryField()
             {
                 Value     = SmsBatchAmountInfo.Columns.BatchID,
                 Condition = ConditionEnum.And,
                 FiledName = SmsBatchInfo.Columns.ID
             });
             action.AddJoin(ViewJoinEnum.leftjoin, "sms_batch", "sms_batch_amount", field);
         }
         if (eid != 1)
         {
             action.SqlWhere("_sms_batch." + SmsBatchInfo.Columns.EnterPriseID, eid);
         }
         if (!string.IsNullOrEmpty(batchname))
         {
             action.SqlWhere(SmsBatchInfo.Columns.BatchName, batchname, ConditionEnum.And, RelationEnum.Like);
         }
         if (!string.IsNullOrEmpty(state) && int.Parse(state) > 0)
         {
             action.SqlWhere(SmsBatchInfo.Columns.BatchState, state);
         }
         if (!string.IsNullOrEmpty(starttime) && string.IsNullOrEmpty(endtime))
         {
             action.SqlWhere(SmsBatchInfo.Columns.PostTime, starttime, ConditionEnum.And, RelationEnum.LargeThen);
         }
         if (!string.IsNullOrEmpty(endtime) && string.IsNullOrEmpty(starttime))
         {
             action.SqlWhere(SmsBatchInfo.Columns.PostTime, endtime, ConditionEnum.And, RelationEnum.LessThen);
         }
         if (!string.IsNullOrEmpty(endtime) && !string.IsNullOrEmpty(starttime))
         {
             action.SqlWhere(SmsBatchInfo.Columns.PostTime, starttime, endtime, ConditionEnum.And, RelationEnum.Between);
         }
         action.SqlOrderBy("_sms_batch.Createtime", OrderByEnum.Desc);
         action.PageSize = PageSize;
         return(action.QueryPage <BatchMoreInfo>(PageIndex));
     }
 }
Exemple #14
0
 public PageList <SmsBatchDetailsMoreInfo> GetList(int PageIndex, int PageSize, string phone, string state, string starttime, string endtime, int eid)
 {
     using (SelectAction action = new SelectAction(""))
     {
         action.SqlClomns = "_sms_batch_details.*,_sms_batch.batchname";
         {
             //添加视图的关联关系
             List <QueryField> field = new List <QueryField>();
             field.Add(new QueryField()
             {
                 Value     = SmsBatchDetailsInfo.Columns.BatchID,
                 Condition = ConditionEnum.And,
                 FiledName = SmsBatchInfo.Columns.ID
             });
             action.AddJoin(ViewJoinEnum.innerjoin, "sms_batch", "sms_batch_details", field);
         }
         if (eid != 1)
         {
             action.SqlWhere("_sms_batch." + SmsBatchInfo.Columns.EnterPriseID, eid);
         }
         if (!string.IsNullOrEmpty(phone))
         {
             action.SqlWhere(SmsBatchDetailsInfo.Columns.Phone, phone, RelationEnum.Like);
         }
         if (!string.IsNullOrEmpty(state) && int.Parse(state) > 0)
         {
             action.SqlWhere(SmsBatchDetailsInfo.Columns.State, state);
         }
         if (!string.IsNullOrEmpty(starttime) && string.IsNullOrEmpty(endtime))
         {
             action.SqlWhere(SmsBatchDetailsInfo.Columns.SubmitTime, starttime, ConditionEnum.And, RelationEnum.LargeThen);
         }
         if (!string.IsNullOrEmpty(endtime) && string.IsNullOrEmpty(starttime))
         {
             action.SqlWhere(SmsBatchDetailsInfo.Columns.SubmitTime, endtime, ConditionEnum.And, RelationEnum.LessThen);
         }
         if (!string.IsNullOrEmpty(endtime) && !string.IsNullOrEmpty(starttime))
         {
             action.SqlWhere(SmsBatchDetailsInfo.Columns.SubmitTime, starttime, endtime, ConditionEnum.And, RelationEnum.Between);
         }
         action.SqlOrderBy("_sms_batch_details.SubmitTime", OrderByEnum.Desc);
         action.PageSize = PageSize;
         return(action.QueryPage <SmsBatchDetailsMoreInfo>(PageIndex));
     }
 }
Exemple #15
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();
                }
            }
        }
Exemple #16
0
 public List <SmsMoInfo> GetUserMo(string username, string password)
 {
     using (SelectAction action = new SelectAction(""))
     {
         action.SqlClomns = "_SmsMoInfo.*";
         {
             //添加视图的关联关系
             List <QueryField> field = new List <QueryField>();
             field.Add(new QueryField()
             {
                 Value     = SmsMoInfo.Columns.AccountID,
                 Condition = ConditionEnum.And,
                 FiledName = SmsAccountInfo.Columns.ID
             });
             action.AddJoin(ViewJoinEnum.innerjoin, "sms_account", "sms_mo", field);
         }
         action.SqlWhere(SmsAccountInfo.Columns.Account, username);
         action.SqlWhere(SmsAccountInfo.Columns.Password, password);
         action.PageSize = 20;
         return(action.QueryPage <SmsMoInfo>(1));
     }
 }
Exemple #17
0
 public PageList <SmsContactInfo> getList(int pageindex, int pagesize, int gid, string name, string phone, int enterpriseId)
 {
     using (SelectAction action = new SelectAction(this.Entity))
     {
         if (gid != 0)
         {
             action.SqlWhere(SmsContactInfo.Columns.GroupID, gid);
         }
         else
         {
             action.SqlWhere(SmsContactInfo.Columns.EnterpriseId, enterpriseId);
         }
         if (!string.IsNullOrEmpty(name))
         {
             action.SqlWhere(SmsContactInfo.Columns.Name, name, RelationEnum.Like);
         }
         if (!string.IsNullOrEmpty(phone))
         {
             action.SqlWhere(SmsContactInfo.Columns.Mobile, phone, RelationEnum.Like);
         }
         action.SqlPageParms(pagesize);
         return(action.QueryPage <SmsContactInfo>(pageindex));
     }
 }