Ejemplo n.º 1
0
        private List <dynamic> GetDataTypeData(RequestData requestData)
        {
            SqlModel sqlmodel = null;
            string   sql      = @"
                         select *, a.rowid from {0} a
                         left join T_BASE_COMANY_PK_TX b  on a.devicecode = b.mn
                         left join T_BASE_COMANY_PK c on b.pkid = c.id  
                         where  RECTIME>= to_date('{0}','yyyy/MM/dd hh24:mi:ss')  
                         and   RECTIME<=to_date('{2}','yyyy/MM/dd hh24:mi:ss') ";

            switch (requestData.Get("DataType"))
            {
            case "M":
                sql = string.Format(sql, "T_MID_MINUTE", requestData.Get("BeginTime"), requestData.Get("EndTime"));
                break;

            case "H":
                sql = string.Format(sql, "T_MID_HOUR", requestData.Get("BeginTime"), requestData.Get("EndTime"));
                break;

            case "D":
                sql = string.Format(sql, "T_MID_DAY", requestData.Get("BeginTime"), requestData.Get("EndTime"));
                break;
            }
            return(SqlModel.Select(sql).ExecToDynamicList());
        }
Ejemplo n.º 2
0
        private bool ChangeWarnState(string warnClass, string warnID, string state)
        {
            FieldModel where = null;
            string sql = "";
            //switch (warnClass)
            //{
            //    // yecha、peak、voc、dache
            //    case "voc":
            //        where = T_DATA_WARNING.ID == warnID;
            //        sql = string.Format("update t_data_warning t set t.state = '{0}' where t.id = {1}", state, warnID);
            //        break;
            //    case "peak":
            //        where = T_DATA_WARNING_PEAK.ID == warnID;
            //        sql = string.Format("update t_data_warning_peak t set t.state = '{0}' where t.id = {1}", state, warnID);
            //        break;
            //    case "yecha":
            //        where = T_WARNING.ID == warnID;
            //        sql = string.Format("update t_Warning t set t.state = '{0}' where t.id = {1}", state, warnID);
            //        break;
            //    case "dache":
            //        where = T_TRAFFIC_WARNING.ID == warnID;
            //        sql = string.Format("update t_traffic_warning t set t.state = '{0}' where t.id = {1}", state, warnID);
            //        break;
            //}
            int result = SqlModel.Select(sql).Native().ExecuteNonQuery();

            if (result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        protected override SqlModel GetSqlModel(RequestData data)
        {
            FieldModel where = null;
            where           &= T_BASE_COMPANY.ISDEL == "0";
            string CompanyName = data.Get("CompanyName");

            if (!string.IsNullOrEmpty(CompanyName))
            {
                where &= T_BASE_COMPANY.NAME.Like(CompanyName);
            }
            //string UTYPE = data.Get("UTYPESEA");
            //if (string.IsNullOrEmpty(UTYPE) == false)
            //    where &= T_BAS_ANNOUNCEMENT_MANAGE.UTYPE == UTYPE;
            //if (string.IsNullOrEmpty(data.Get("sDate")) == false && string.IsNullOrEmpty(data.Get("eDate")) == false)
            //{
            //    string sDate = data.Get("sDate") + " 00:00:00";
            //    string eDate = data.Get("eDate") + " 23:59:59";
            //    where &= T_BAS_ANNOUNCEMENT_MANAGE.RELEASETIME.BetweenAnd(DateTime.Parse(sDate), DateTime.Parse(eDate));
            //}
            SqlModel sql = SqlModel.SelectAll()
                           .From(DB.T_BASE_COMPANY)
                           //.LeftJoin(DB.BASDIC.As("d1")).On("d1".Field(BASDIC.CODE) == T_BAS_ANNOUNCEMENT_MANAGE.UTYPE & "d1".Field(BASDIC.TYPECODE) == "ANN_TYPE")
                           //.LeftJoin(DB.BASUSER.As("d2")).On("d2".Field(BASUSER.USERNAME) == T_BAS_ANNOUNCEMENT_MANAGE.PUBLISHER)
                           .Where(where).OrderByDesc(T_BASE_COMPANY.ID);

            return(sql);
        }
Ejemplo n.º 4
0
        //
        // GET: /Bas/SmsTemplate/

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

            string opBegDate = data.Get("opBegDate").Trim();
            string opEndDate = data.Get("opEndDate").Trim();

            if (TEMPNAME != "")
            {
                where &= SMSTEMPLATE.TEMPNAME.Like(TEMPNAME);
            }
            if (SMSTEMPTYPE != "")
            {
                where &= SMSTEMPLATE.SMSTEMPTYPE == SMSTEMPTYPE;
            }
            //if (SMSBASTYPE != "")
            //{
            //    where &= SMSTEMPLATE.SMSBASTYPE == SMSBASTYPE;
            //}
            SqlModel SqlModel = SqlModel.SelectAll(BASDIC.TITLE.As("SMSTEMPTYPE_TEXT"), "D1".Field("TITLE").As("SMSBASTYPE_TEXT"), "T1".Field("TRUENAME").As("CREATENAMEREAL"))
                                .From(DB.SMSTEMPLATE)
                                .LeftJoin(DB.BASDIC).On(SMSTEMPLATE.SMSTEMPTYPE == BASDIC.CODE & BASDIC.TYPECODE == "SMSTEMPTYPE")
                                .LeftJoin(DB.BASDIC.As("D1")).On(SMSTEMPLATE.SMSBASTYPE == "D1".Field("CODE") & "D1".Field("TYPECODE") == "SMSBASTYPE")
                                .LeftJoin(DB.BASUSER.As("T1")).On(SMSTEMPLATE.CREATEUSER == "T1".Field("USERNAME"))
                                .Where(where).OrderByDesc(SMSTEMPLATE.CREATETIME);

            return(SqlModel);
        }
Ejemplo n.º 5
0
        public ActionResult GetZLDeviceData(string id)
        {
            string page = Request["page"].Trim();
            string rows = Request["rows"].Trim();

            FieldModel where =
                T_BASE_COMPANY_ZL.ISDEL == "0";
            if (!string.IsNullOrEmpty(id))
            {
                id     = id.Trim();
                where &= T_BASE_COMPANY_ZL.COMPANYID == id;
            }
            else
            {
                where &= T_BASE_COMPANY_ZL.COMPANYID == "0";
            }
            SqlModel sql = SqlModel.SelectAll(T_BASE_COMPANY_ZL.NAME.As("PKNAME")
                                              )
                           .From(DB.T_BASE_COMPANY_ZL)
                           .LeftJoin(DB.T_BASE_COMPANY_PK).On(T_BASE_COMPANY_ZL.PKID == T_BASE_COMPANY_PK.ID)
                           //.LeftJoin(DB.BASDIC.As("ISHB")).On(T_BASE_COMPANY_CONTACT.ISHB == "ISHB".Field("CODE") & "ISHB".Field("TYPECODE") == "TrueOrFalse")
                           .Where(where)
                           .OrderByDesc(T_BASE_COMPANY_ZL.CREATETIME);

            PagedDataTable dtResult = sql.ExecToPagedTable(Convert.ToInt32(page), Convert.ToInt32(rows), new OrderByModel()
            {
                OrderType = OrderType.Desc, FieldModel = T_BASE_COMPANY_ZL.CREATETIME
            });

            return(Content(JsonConvert.SerializeObject(new
            {
                total = dtResult.TotalCount,
                rows = dtResult.Data
            }), "application/json", Encoding.UTF8));
        }
Ejemplo n.º 6
0
        public ActionResult GetTXInfoInfoByID(RequestData data)
        {
            string rowID = string.Empty;
            var    msg   = new { success = false, data = "查询失败" };

            if (!string.IsNullOrEmpty(data.Get("rowID")))
            {
                rowID = data.Get("rowID").Trim();
            }
            else
            {
                return(Json(msg));
            }
            var dt = SqlModel.SelectAll(T_BASE_COMPANY_PK.TYPE.As("PKTYPE"))
                     .From(DB.T_BASE_COMPANY_PK_TX)
                     .InnerJoin(DB.T_BASE_COMPANY_PK).On(T_BASE_COMPANY_PK.ID == T_BASE_COMPANY_PK_TX.PKID)
                     .Where(T_BASE_COMPANY_PK_TX.ID == rowID)
                     .ExecToDataTable();

            if (dt != null && dt.Rows.Count > 0)
            {
                msg = new { success = true, data = dt.ToJson() };
            }
            return(Json(msg));
        }
Ejemplo n.º 7
0
        public ActionResult GetButtonTable(RequestData data)
        {
            List <dynamic> list = SqlModel.SelectAll().From(DB.BASBUTTON)
                                  .OrderByAsc(BASBUTTON.SORTNO).ExecToDynamicList();

            return(Json(list));
        }
Ejemplo n.º 8
0
        public ActionResult GetBtnColumns(RequestData data)
        {
            DataTableModel dt = SqlModel.Select(BASBUTTON.BUTTONTEXT, BASBUTTON.BUTTONTAG)
                                .From(DB.BASBUTTON).OrderByAsc(BASBUTTON.SORTNO).ExecToTableModel();
            List <dynamic> list = new List <dynamic>();

            if (dt != null && dt.Count > 0)
            {
                foreach (DataRowModel r in dt)
                {
                    list.Add(new
                    {
                        title  = r[BASBUTTON.BUTTONTEXT].ToString(),
                        field  = r[BASBUTTON.BUTTONTAG].ToString(),
                        width  = 60,
                        align  = "center",
                        editor = new
                        {
                            type    = "checkbox",
                            options = new
                            {
                                on  = "√",
                                off = "x"
                            }
                        },
                    });
                }
            }
            string jsonStr = string.Format("var btns = {0}", Newtonsoft.Json.JsonConvert.SerializeObject(list));

            return(Content(jsonStr));
        }
Ejemplo n.º 9
0
        private static void GetCIN(SqlModel model)
        {
            int i      = 0;
            int length = model.Struction.Members.Count;

            MemberInfo[] members = model.Struction.Members.ToArray();
            while (i < length)
            {
                string           temp_Name             = members[i].Name;
                ColumnAttribute  temp_ColumnAttribute  = members[i].GetCustomAttribute <ColumnAttribute>();
                IgnoreAttribute  temp_IgnoreAttribute  = members[i].GetCustomAttribute <IgnoreAttribute>();
                RepeateAttribute temp_RepeateAttribute = members[i].GetCustomAttribute <RepeateAttribute>();
                //字段映射缓存
                if (temp_ColumnAttribute != null)
                {
                    model.ColumnToRealMap[temp_ColumnAttribute.Name] = members[i].Name;
                    model.RealToColumnMap[members[i].Name]           = temp_ColumnAttribute.Name;
                }
                //字段忽略缓存
                if (temp_IgnoreAttribute != null)
                {
                    model.IgnoreMembers.Add(temp_Name);
                }
                //字段查重缓存
                if (temp_RepeateAttribute != null)
                {
                    model.RepeateMembers.Add(temp_Name);
                }
                i += 1;
            }
        }
Ejemplo n.º 10
0
        private static void GetPrimaryKey(SqlModel model)
        {
            int i      = 0;
            int length = model.Struction.Members.Count;

            MemberInfo[] members = model.Struction.Members.ToArray();
            while (i < length)
            {
                if (model.PrimaryKey == null || model.PrimaryKey == string.Empty)
                {
                    PrimaryKeyAttribute temp_PrimaryKeyAttributer = members[i].GetCustomAttribute <PrimaryKeyAttribute>(true);
                    if (temp_PrimaryKeyAttributer != null)
                    {
                        model.PrimaryKey = members[i].Name;
                        model.IsMaunally = temp_PrimaryKeyAttributer.IsManually;
                        break;
                    }
                }
                i += 1;
            }
            if (model.PrimaryKey != null && !model.IsMaunally)
            {
                model.IgnoreMembers.Add(model.PrimaryKey);
            }
        }
Ejemplo n.º 11
0
        private static string GetPageButtonHtml(int navId, int userId)
        {
            object ret = SqlModel.Select(BASUSER.ISADMIN).From(DB.BASUSER).Where(BASUSER.ID == userId).ExecuteScalar();

            FieldModel where = BASBUTTON.BUTTONTAG != "browser";
            if (ret == null)
            {
                return("");
            }
            else if (ret.ToBoolean() == true)
            {
                where &= BASNAVBTN.NAVID == navId;
            }
            else
            {
                DataTable rTab     = GetRightButtonTable(navId, userId);
                string    btnIdStr = rTab.Join((r, i) => (i > 0 ? "," : "") + r[BASUSERNAVBTN.BTNID.Name]);
                where &= BASNAVBTN.NAVID == navId& BASBUTTON.ID.In(btnIdStr);
            }
            DataTable btnTab = SqlModel.Select(BASBUTTON.BUTTONHTML, BASBUTTON.BUTTONHTMLEN)
                               .From(DB.BASNAVBTN)
                               .InnerJoin(DB.BASBUTTON).On(BASBUTTON.ID == BASNAVBTN.BTNID).OrderByAsc(BASNAVBTN.SORTNO)
                               .Where(where).ExecToDataTable();
            string        split   = @"<div class='datagrid-btn-separator'></div>";
            List <string> btnList = new List <string>();

            btnTab.Each(r => btnList.Add(LangHelper.Name == LangEnum.ZHCN.ToString().ToLower() ?
                                         r[BASBUTTON.BUTTONHTML.Name].ToString() : r[BASBUTTON.BUTTONHTMLEN.Name].ToString()));
            return(string.Join(split, btnList.ToArray()));
        }
Ejemplo n.º 12
0
        protected override SqlModel GetSqlModel(RequestData data)
        {
            DateTime stime = data.GetDateTime("stime");
            DateTime etime = data.GetDateTime("etime");

            etime = etime.AddDays(1).AddSeconds(-1);
            string pkIds = data.Get("PKId");

            FieldModel where = T_MID_CHECKRECORD.CHECKTIME.BetweenAnd(stime, etime);
            //if (!string.IsNullOrEmpty(pkIds))
            {
                where &= T_BASE_COMPANY_PK.ID.In("'" + string.Join("','", pkIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + "'");
            }

            return(SqlModel.Select(T_BASE_COMPANY.NAME.As("COMPANYNAME"), T_BASE_COMPANY_PK.NAME.As("PKNAME"), ("D1").Field("TITLE").As("ITEMTEXT"), ("D2").Field("TITLE").As("SUBITEMTEXT")
                                   , T_MID_CHECKRECORD.RECTIME, T_MID_CHECKRECORD.VALUE, T_MID_CHECKRECORD.CHECKVALUE, T_MID_CHECKRECORD.CHECKTIME, ("D3").Field("TITLE").As("CHECKTYPETEXT")
                                   , BASUSER.TRUENAME.As("CHECKUSERNAME"), T_MID_CHECKRECORD.FJ, T_MID_CHECKRECORD.REMARK)
                   .From(DB.T_MID_CHECKRECORD)
                   .LeftJoin(DB.T_BASE_COMPANY_PK_TX).On(T_BASE_COMPANY_PK_TX.MN == T_MID_CHECKRECORD.MN)
                   .LeftJoin(DB.T_BASE_COMPANY_PK).On(T_BASE_COMPANY_PK.ID == T_BASE_COMPANY_PK_TX.PKID)
                   .LeftJoin(DB.T_BASE_COMPANY).On(T_BASE_COMPANY.ID == T_BASE_COMPANY_PK.COMPANYID)
                   .LeftJoin(DB.BASDIC.As("D1")).On(("D1").Field("CODE") == T_MID_CHECKRECORD.ITEMCODE)
                   .LeftJoin(DB.BASDIC.As("D2")).On(("D2").Field("CODE") == T_MID_CHECKRECORD.SUBITEMCODE & ("D2").Field("TYPECODE") == T_MID_CHECKRECORD.ITEMCODE)
                   .LeftJoin(DB.BASDIC.As("D3")).On(("D3").Field("CODE") == T_MID_CHECKRECORD.CHECKTYPE & ("D3").Field("TYPECODE") == "CHECKTYPE")
                   .LeftJoin(DB.BASUSER).On(BASUSER.USERNAME == T_MID_CHECKRECORD.CHECKUSER)
                   .Where(where));
        }
Ejemplo n.º 13
0
        public IActionResult deletestock(int id)
        {
            var model = new SqlModel();

            model.Remove(id);
            return(View("index"));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 污染物超标
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private DataTable GetExcessivePollutSource(RequestData data, DataTable dataTable)
        {
            FieldModel where = null;
            if (data.Get("CompanyID") != "-1")
            {
                where &= T_MID_ALERT.COMPANYID == data.Get("CompanyID");
            }
            else
            {
                where &= T_MID_ALERT.PKID == data.Get("PKID");
            }
            where &= T_MID_ALERT.TYPE == 0;
            SqlModel model = SqlModel.SelectAll("A".Field("TITLE").As("CODE_TEXT"), "B".Field("TITLE").As("CODE_TEXT2"), "C".Field("NAME").As("PK_NAME")).From(DB.T_MID_ALERT)
                             .LeftJoin(DB.BASDIC.As("A")).On(T_MID_ALERT.ITEMCODE == "A".Field("CODE"))
                             .LeftJoin(DB.BASDIC.As("B")).On(T_MID_ALERT.SUBITEMCODE == "B".Field("CODE"))
                             .LeftJoin(DB.T_BASE_COMPANY_PK.As("C")).On(T_MID_ALERT.PKID == "C".Field("ID"))
                             .Where(where);
            List <dynamic> query = model.ExecToDynamicList();
            // List<T_MID_ALERTModel> lis = SerializerHelper.Deserialize<List<T_MID_ALERTModel>>(SerializerHelper.Serialize(query));
            DataRow dr = null;

            query.ForEach(d =>
            {
                dr               = dataTable.NewRow();
                dr["PK_NAME"]    = d["PK_NAME"];
                dr["STAIN_TEXT"] = d["CODE_TEXT"] + "(" + d["CODE_TEXT2"] + ")";
                dr["VALUE"]      = d["VALUE"] == System.DBNull.Value ? 0: d["VALUE"];
                dr["LIMIT"]      = d["LIMIT"];
                dr["STATE"]      = d["STATE"] == 0 ? "未处理" : "处理";
                dr["STARTTIME"]  = d["STARTTIME"];
                dr["ENDTIME"]    = d["ENDTIME"];
                dataTable.Rows.Add(dr);
            });
            return(dataTable);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 创建新增语句
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <param name="cols"></param>
        /// <returns></returns>
        public static SqlModel InsertSql <T>(T t, string cols, bool needReturn)
        {
            Type type = typeof(T);

            PropertyInfo[] propertyInfos = PropertyHelper.GetProperties <T>(cols);

            //生成要插入的列 $的出现{}就是占位符 里面就可以放变量
            string colums = string.Join(",", propertyInfos.Where(p => !p.IsPrimaryKey() && p.IsExist()).Select(p => $"[{p.GetColumnName()}]"));

            //生成插入的参数
            string paramColums = string.Join(",", propertyInfos.Where(p => !p.IsPrimaryKey() && p.IsExist()).Select(p => $"@{p.GetColumnName()}"));

            //生成参数数组
            SQLiteParameter[] arrParams = CreateParameters(propertyInfos, t);

            string sql = $"INSERT INTO [{type.GetTableName()}] ({colums}) values({paramColums})";

            //需要返回主键id
            if (needReturn)
            {
                //sql += " ;select @@identity"; //sqlserver 支持
                sql += ";select last_insert_rowid();"; //sqlserver 支持
            }


            SqlModel sqlModel = new SqlModel()
            {
                Sql           = sql,
                SqlParameters = arrParams
            };

            return(sqlModel);
        }
Ejemplo n.º 16
0
        /// <summary>
        ///  条件查询结果 总数
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="pageInfo"></param>
        /// <param name="cols"></param>
        /// <param name="whereCols"></param>
        /// <param name="whereType"></param>
        /// <returns></returns>
        public static SqlModel SelectCount <T>(T t, string whereCols, WhereType whereType)
        {
            Type type = typeof(T);

            PropertyInfo[] whereProp = null;

            //参数数组
            SQLiteParameter[] arrParams = null;

            bool isSql = WhereType.Columns.Equals(whereType);

            if (isSql && !string.IsNullOrEmpty(whereCols))
            {
                whereProp = PropertyHelper.GetProperties <T>(whereCols);
                whereCols = string.Join(",", whereProp.Select(p => string.Format("[{0}]=@{0}", p.GetColumnName())));
                //生成参数数组
                arrParams = CreateParameters(whereProp, t);
            }

            if (string.IsNullOrEmpty(whereCols))
            {
                whereCols = "  1=1 ";
            }

            string sql = $"SELECT COUNT(0) FROM [{type.GetTableName()}] WHERE {whereCols}";

            SqlModel sqlModel = new SqlModel()
            {
                Sql           = sql,
                SqlParameters = arrParams
            };

            return(sqlModel);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 治理设施停运
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private DataTable GetControlFacilitiesSource(RequestData data, DataTable dataTable)
        {
            FieldModel where = null;
            if (data.Get("CompanyID") != "-1")
            {
                where &= T_MID_ALERT.COMPANYID == data.Get("CompanyID");
            }
            else
            {
                where &= T_MID_ALERT.PKID == data.Get("PKID");
            }
            where &= T_MID_ALERT.TYPE == 3;
            List <dynamic> query = SqlModel.SelectAll("A".Field("TITLE").As("CODE_TEXT"), "B".Field("TITLE").As("CODE_TEXT2"), "C".Field("NAME").As("PK_NAME")).From(DB.T_MID_ALERT)
                                   .LeftJoin(DB.BASDIC.As("A")).On(T_MID_ALERT.ITEMCODE == "A".Field("CODE"))
                                   .LeftJoin(DB.BASDIC.As("B")).On(T_MID_ALERT.SUBITEMCODE == "B".Field("CODE"))
                                   .LeftJoin(DB.T_BASE_COMPANY_PK.As("C")).On(T_MID_ALERT.PKID == "C".Field("ID") | T_MID_ALERT.COMPANYID == "C".Field("COMPANYID"))
                                   .Where(where)
                                   .ExecToDynamicList();
            // List<T_MID_ALERTModel> lis = SerializerHelper.Deserialize<List<T_MID_ALERTModel>>(SerializerHelper.Serialize(query));
            DataRow dr = null;

            query.ForEach(d =>
            {
                dr            = dataTable.NewRow();
                dr["PK_NAME"] = d["PK_NAME"];
                // dr["STAIN_TEXT"] = d["PK_NAME"] ;
                dr["STATE"]     = d["STATE"] == 0 ? "未处理" : "处理";
                dr["STARTTIME"] = d["STARTTIME"];
                dr["ENDTIME"]   = d["ENDTIME"];
                dr["LENTIME"]   = new TimeSpan(Convert.ToDateTime(d["STARTTIME"]) - Convert.ToDateTime(d["ENDTIME"])).TotalMinutes;
                dataTable.Rows.Add(dr);
            });
            return(dataTable);
        }
Ejemplo n.º 18
0
        //仅给予标签层调用,其他层不要调
        public static DataTable ExecuteTable(string sql, List <SqlParameter> sp = null)
        {
            SqlModel model = new SqlModel();

            model.sql    = sql;
            model.spList = sp;
            return(DB.ExecuteTable(model));
        }
Ejemplo n.º 19
0
        protected override SqlModel GetSqlModel(RequestData data)
        {
            SqlModel model = SqlModel.SelectAll(BASNAV.PARENTID.As("\"_parentId\""))
                             .From(DB.BASNAV)
                             .OrderByAsc(BASNAV.SORTNO);

            return(model);
        }
Ejemplo n.º 20
0
        //得到所有用户
        public ActionResult GetUsers()
        {
            DataTable dt = SqlModel.Select(BASUSER.USERNAME, BASUSER.TRUENAME)
                           .From(DB.BASUSER).OrderByAsc(BASUSER.ID).Where(BASUSER.ISDEL == "0")
                           .ExecToDataTable();

            return(Json(dt.ToDynamicList()));
        }
Ejemplo n.º 21
0
        public ActionResult GetCreateTreeData()
        {
            SqlModel model = SqlModel.Select(@"select a.area_code,a.area_text,b.area_text parenttext from T_SYS_AREA a left join T_SYS_AREA b on a.parent_code = b.area_code WHERE a.RELATION_TYPE < 4 AND a.Remark = 1 and a.parent_code='410100'").Native();

            DataTable dt = model.ExecToDataTable();

            return(Json(dt.ToDynamicList()));
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 获取区域的企业
        /// </summary>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        private static List <dynamic> GetCompanyInfo(string areaCode)
        {
            SqlModel sql = SqlModel.SelectAll()
                           .From(DB.T_BASE_COMPANY)
                           .Where(T_BASE_COMPANY.AREA.In(StringHelper.SqlInCondition(areaCode)));

            return(sql.ExecToDynamicList());
        }
Ejemplo n.º 23
0
        protected override bool DoEdit(RequestData data)
        {
            bool result = true;

            try
            {
                decimal levelID = decimal.Parse(data.Get("id"));
                T_THEPEAK_LEVEL_LIST_INFOModel model = new T_THEPEAK_LEVEL_LIST_INFOModel();
                this.GetModelValue(model, data);
                result = model.Update(T_THEPEAK_LEVEL_LIST_INFO.ID == levelID);

                var configSql  = SqlModel.SelectAll().From(DB.T_THEPEAK_LEVEL_CONFIG).Where(T_THEPEAK_LEVEL_CONFIG.PEAK_LEVE_ID == levelID);
                var configList = configSql.ExecToDynamicList();
                List <T_THEPEAK_LEVEL_CONFIGModel> listExit    = data.Get("extraData").Deserialize <List <T_THEPEAK_LEVEL_CONFIGModel> >();
                T_THEPEAK_LEVEL_CONFIGModel        configModel = new T_THEPEAK_LEVEL_CONFIGModel();
                List <decimal> configDelList = new List <decimal>();
                //信息保存
                if (listExit != null && listExit.Count > 0)
                {
                    foreach (var item in listExit)
                    {
                        bool exit = configList.FindIndex(c => StringHelper.DynamicToString(c["ID"]) == StringHelper.DynamicToString(item.ID)) > -1 ? true : false;
                        if (item.IS_STOP != 1 && item.LIMIT_CONFIG != 1)
                        {
                            continue;                                             //没用的配置信息,删除处理
                        }
                        //添加
                        if (!exit)
                        {
                            item.PEAK_LEVE_ID = levelID;
                            item.Insert();
                        }
                        //更新
                        else
                        {
                            item.Update(T_THEPEAK_LEVEL_CONFIG.ID == item.ID);
                        }
                        configDelList.Add(item.ID);
                    }
                    //删除子表
                    foreach (var delKey in configList)
                    {
                        if (!configDelList.Contains(decimal.Parse(delKey["ID"].ToString())))
                        {
                            configModel.Delete(T_THEPEAK_LEVEL_CONFIG.ID == decimal.Parse(delKey["ID"].ToString()));
                        }
                    }
                }

                FileUploadHandle.FileMessageSave(data, levelID.ToString());
            }
            catch (Exception ex)
            {
                result = false;
                base.AddLog(null, LogType.InsertOperate, "【编辑错峰等级配置】 " + ex.Message + ex.StackTrace);
            }
            return(result);
        }
Ejemplo n.º 24
0
        public ActionResult GetDicCodeData(string typeCode)
        {
            DataTable dt = SqlModel.Select(BASDIC.CODE, BASDIC.TITLE)
                           .From(DB.BASDIC)
                           .Where(BASDIC.TYPECODE == typeCode).OrderByAsc(BASDIC.SORTNO)
                           .ExecToDataTable();

            return(Json(dt.ToDynamicList()));
        }
Ejemplo n.º 25
0
        public ActionResult GetCompanyTypeData(RequestData data)
        {
            DataTable dt = SqlModel.Select(BASDIC.CODE, BASDIC.TITLE, BASDIC.SORTNO)
                           .From(DB.BASDIC)
                           .Where(BASDIC.TYPECODE == ConstStrings.CompanyType)
                           .ExecToDataTable();

            return(Json(dt.ToDynamicList()));
        }
Ejemplo n.º 26
0
        public ActionResult GetFuelSpecData()
        {
            DataTable dt = SqlModel.Select(BASDIC.CODE, BASDIC.TITLE)
                           .From(DB.BASDIC)
                           .Where(BASDIC.TYPECODE == ConstStrings.FuelSpec)
                           .ExecToDataTable();

            return(Json(dt.ToDynamicList()));
        }
Ejemplo n.º 27
0
        public ActionResult GetIllegalRealStatusData()
        {
            DataTable dt = SqlModel.Select(BASDIC.CODE, BASDIC.TITLE)
                           .From(DB.BASDIC)
                           .Where(BASDIC.TYPECODE == ConstStrings.IllegalDealType)
                           .ExecToDataTable();

            return(Json(dt.AddNoneSelectItem(" ", "全部").ToDynamicList()));
        }
Ejemplo n.º 28
0
        public ActionResult GetUserTypeData()
        {
            DataTable dt = SqlModel.Select(BASDIC.CODE, BASDIC.TITLE)
                           .From(DB.BASDIC)
                           .Where(BASDIC.TYPECODE == ConstStrings.PowerType).OrderByAsc(BASDIC.SORTNO)
                           .ExecToDataTable();

            return(Json(dt.ToDynamicList()));
        }
Ejemplo n.º 29
0
        public ActionResult GetLogTypeData(RequestData data)
        {
            DataTable dt = SqlModel.Select(BASDIC.CODE, BASDIC.TITLE)
                           .From(DB.BASDIC)
                           .LeftJoin(DB.BASDICTYPE).On(BASDICTYPE.ID == BASDIC.TYPEID)
                           .Where(BASDICTYPE.CODE == ConstStrings.LogType).ExecToDataTable();

            return(Json(dt.AddNoneSelectItem(" ", "全部").ToDynamicList()));
        }
Ejemplo n.º 30
0
 private VasilyLink(Type type)
 {
     if (!VasilyCache.SqlModelCache.ContainsKey(type))
     {
         SqlAnalyser.Initialization(type);
     }
     _model = VasilyCache.SqlModelCache[type];
     _maker = new SqlMaker(_model);
 }
        private TagCommandReceiver()
        {
            sql = new SqlModel("tr.TagCommandReceiver");

            sql.Add("@TagStatus", System.Data.SqlDbType.Int);
            sql.Add("@PlanningDate", System.Data.SqlDbType.DateTime);
            sql.Add("@Comment", System.Data.SqlDbType.NVarChar);
            sql.Add("@Effort", System.Data.SqlDbType.Int);
            sql.Add("@Efficacy", System.Data.SqlDbType.Int);
            sql.Add("@Priority", System.Data.SqlDbType.Int);
            sql.Add("@AssignationId", System.Data.SqlDbType.Int);
            sql.Add("@AssigrationType", System.Data.SqlDbType.Int);
        }
Ejemplo n.º 32
0
 public string[] Descs()
 {
     SqlModel s = new SqlModel("select description from tags");
     return s.Fill<string>(0);
 }