Exemple #1
0
        //protected void AddLog(ActionType actionType, dynamic data)
        //{
        //    WebHelp.Instance.AddLog(actionType, data);
        //}

        /// <summary>
        /// 设置datagrid过滤条件
        /// </summary>
        /// <param name="item">参数</param>
        /// <param name="fielName">字段名称</param>
        /// <param name="fieldModel"></param>
        /// <param name="where">SQL</param>
        protected void SetWhere(dynamic item, string fielName, FieldModel fieldModel, ref FieldModel where)
        {
            //where &= 1 == 1;
            if (item.field == fielName && item.value.ToString() != "")
            {
                if (item.op == "contains")
                {
                    where &= fieldModel.Like(item.value.ToString());
                }
                if (item.op == "equal")
                {
                    where &= fieldModel == item.value;
                }
                if (item.op == "less")
                {
                    where &= fieldModel < item.value;
                }
                if (item.op == "greater")
                {
                    where &= fieldModel > item.value;
                }
                //2017.5.5 姜拓
                if (item.op == "notin")
                {
                    where &= fieldModel.NotIn(item.value);
                }
                //2017.05.31 liwu
                if (item.op == "notEqual")
                {
                    where &= fieldModel != item.value;
                }
            }
        }
Exemple #2
0
        //
        // GET: /Bas/SmsTemplate/

        protected override SqlModel GetSqlModel(RequestData data)
        {
            FieldModel where = null;
            string SMSTEMPTYPE = data.Get("TEMPTYPE").Trim();

            if (SMSTEMPTYPE != "")
            {
                where &= SMSTEMPLATE.SMSTEMPTYPE == SMSTEMPTYPE;
            }

            DateTime dtNow   = DateTime.Now;
            DateTime tmStart = new DateTime(dtNow.Year, dtNow.Month, 1);
            DateTime tmEnd   = dtNow.Date;

            if (!string.IsNullOrEmpty(data.Get("opBegDate")))
            {
                DateTime.TryParse(data.Get("opBegDate"), out tmStart);
            }
            if (!string.IsNullOrEmpty(data.Get("opEndDate")))
            {
                DateTime.TryParse(data.Get("opEndDate"), out tmEnd);
            }

            tmEnd  = tmEnd.AddHours(23).AddMinutes(59).AddSeconds(59);
            where &= SMSLOG.SENDTIME.BetweenAnd(tmStart, tmEnd);

            SqlModel sqlmode = SqlModel.SelectAll(
                BASDIC.TITLE.As("SMSTEMPTYPE_TEXT"),
                "u".Field(BASUSER.TRUENAME).ListAgg("u".Field(BASUSER.TRUENAME).ToChar(), ',').As("USERNAME_TEXT")
                )
                               .From(DB.SMSLOG)
                               .LeftJoin(DB.BASDIC).On(SMSLOG.SMSTEMPTYPE == BASDIC.CODE & BASDIC.TYPECODE == "SMSTEMPTYPE")
                               .LeftJoin(DB.BASUSER.As("u")).On(SMSLOG.RECEIVEUSER.Instr("u".Field(BASUSER.MOBILE).ToChar(), ','))
                               .Where(where).OrderByDesc(SMSLOG.SENDTIME)
                               .GroupBy(
                SMSLOG.ID,
                SMSLOG.CONTENT,
                SMSLOG.STATUS,
                SMSLOG.SENDTIME,
                SMSLOG.RECEIVEUSER,
                SMSLOG.SMSTEMPTYPE,
                SMSLOG.SMSBASTYPE,
                BASDIC.TITLE,
                "u".Field(BASUSER.TRUENAME)
                );

            if (!string.IsNullOrEmpty(data.Get("USERNAME_TEXT")))
            {
                FieldModel field = new FieldModel();
                field.Name      = "SEND_PERSON_TEXT";
                field.TableName = "t";

                sqlmode = SqlModel.Select(new FieldModel[] {
                    new FieldModel()
                    {
                        Name = SMSLOG.ID.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = SMSLOG.CONTENT.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = SMSLOG.STATUS.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = SMSLOG.SENDTIME.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = SMSLOG.RECEIVEUSER.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = SMSLOG.SMSTEMPTYPE.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = "USERNAME_TEXT", TableName = "t"
                    }
                }).From(sqlmode.As("t")).Where(field.Like(data.Get("USERNAME_TEXT")));
            }

            return(sqlmode);
        }