コード例 #1
0
ファイル: Device.cs プロジェクト: NickQi/TianheDemo
 public List<Model.Device> GetDeviceList(string whereStr, string sortStr)
 {
     var cmd = new DataCommand("getDevice", new SqlCustomDbCommand());
     cmd.ReplaceParameterValue("#whereStr#",whereStr);
     cmd.ReplaceParameterValue("#Sort#", sortStr);
     return cmd.ExecuteEntityList<Model.Device>();
 }
コード例 #2
0
ファイル: Alloction.cs プロジェクト: NickQi/TianheDemo
 public List<Model.TB_ALLOCTION_CONFIG_History> GetConfigLogList(string whereStr, string orderBy)
 {
     var cmd = new DataCommand("getConfigLogList", new SqlCustomDbCommand());
     cmd.ReplaceParameterValue("#whereStr#", whereStr);
     cmd.ReplaceParameterValue("#orderBy#", orderBy);
     return cmd.ExecuteEntityList<Model.TB_ALLOCTION_CONFIG_History>();
 }
コード例 #3
0
        public static List <OnlineList> GetSaleHightItem(int num, int C2Sysno, List <int> ItemSysnolist)
        {
            List <OnlineList> onlineList = null;

            if (num > 0)
            {
                if (ItemSysnolist != null && ItemSysnolist.Count > 0)
                {
                    DataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("GetSaleHightItemForHomePage");
                    command.ReplaceParameterValue("@num", num.ToString());
                    command.ReplaceParameterValue("@C2SysNo", C2Sysno.ToString());
                    command.ReplaceParameterValue("@ItemSysnolist", ItemSysnolist.ToListString());
                    command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                    onlineList = command.ExecuteEntityList <OnlineList>();
                }
                else
                {
                    DataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("GetSaleHightItemForHomePageSingle");
                    command.ReplaceParameterValue("@num", num.ToString());
                    command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                    command.ReplaceParameterValue("@C2SysNo", C2Sysno.ToString());
                    onlineList = command.ExecuteEntityList <OnlineList>();
                }
            }
            return(onlineList);
        }
コード例 #4
0
ファイル: Alloction.cs プロジェクト: NickQi/TianheDemo
 public List<Model.TB_ALLOCTION_CONFIG_History> GetConfigLogList(string whereStr, string orderBy)
 {
     var cmd = new DataCommand("getConfigLogList", new SqlCustomDbCommand());
     cmd.ReplaceParameterValue("#whereStr#", whereStr);
     cmd.ReplaceParameterValue("#orderBy#", orderBy);
     return cmd.ExecuteEntityList<Model.TB_ALLOCTION_CONFIG_History>();
 }
コード例 #5
0
ファイル: AlarmAccess.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取告警类型数据
        /// </summary>
        /// <param name="whereStr"></param>
        /// <returns></returns>
        public DataTable GetAlarmListIndex(QueryAlarmNew alarmNew)
        {
            int       intPazeSize = alarmNew.PageSize;
            int       intNext     = intPazeSize * (alarmNew.PageIndex - 1);
            DataTable dtAlarmType = new DataTable();
            //string strSql = @" SELECT distinct TOP " + intPazeSize + " id, ALARMOBJID,ALARMTYPE,ALARMTYPENAME,ALARMLEVEL,ALARMOBJNAME,ALARMCONTENT,STATUS,ALARMTIME,location " +
            //     " from AlarmAreaDevice WHERE id not in " +
            //   "  ( SELECT TOP " + intNext + " id from AlarmAreaDevice ) and 1=1 ";
            string whereStr = "";
            string orderStr = "ORDER BY id desc";

            whereStr += " and ALARMTIME between '" + alarmNew.StartTime.ToString("yyyy-MM-dd 00:00:00") + "' and '" + alarmNew.EndTime.ToString("yyyy-MM-dd 23:59:59") + "'";
            if (alarmNew.AlarmStatus != "")
            {
                whereStr += " and STATUS = " + alarmNew.AlarmStatus;
            }

            var cmd = new DataCommand("GetAlarmListIndex", new SqlCustomDbCommand());

            cmd.ReplaceParameterValue("#PageSize#", intPazeSize.ToString());
            cmd.ReplaceParameterValue("#Next#", intNext.ToString());
            cmd.ReplaceParameterValue("#whereStr#", whereStr);
            cmd.ReplaceParameterValue("#orderStr#", orderStr);
            return(cmd.ExecuteDataSet().Tables[0]);
        }
コード例 #6
0
        public static List <OnlineList> GetNewItemForBrand(int diffnum, List <int> HasItemSysnolist, int BrandSysNo)
        {
            List <OnlineList> onlineList = null;

            if (diffnum > 0)
            {
                if (HasItemSysnolist != null && HasItemSysnolist.Count > 0)
                {
                    DataCommand command = DataCommandManager.GetDataCommand("GetNewItemForBrand");
                    command.ReplaceParameterValue("@num", diffnum.ToString());
                    command.ReplaceParameterValue("@BrandSysNo", BrandSysNo.ToString());
                    command.ReplaceParameterValue("@HasItemSysnolist", HasItemSysnolist.ToListString());
                    command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                    onlineList = command.ExecuteEntityList <OnlineList>();
                }
                if (onlineList == null || onlineList.Count == 0)
                {
                    DataCommand command = DataCommandManager.GetDataCommand("GetNewItemForBrandSingle");
                    command.ReplaceParameterValue("@num", diffnum.ToString());
                    command.ReplaceParameterValue("@BrandSysNo", BrandSysNo.ToString());
                    command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                    onlineList = command.ExecuteEntityList <OnlineList>();
                }
            }
            return(onlineList);
        }
コード例 #7
0
        public static List <OnlineList> GetPriceDownPercentItemForC2(int diffnum, List <int> HasItemSysnolist, int C2Sysno)
        {
            List <OnlineList> onlineList = null;

            if (diffnum > 0)
            {
                if (HasItemSysnolist != null && HasItemSysnolist.Count > 0)
                {
                    DataCommand command = DataCommandManager.GetDataCommand("GetPriceDownPercentItemForC2");
                    command.ReplaceParameterValue("@num", diffnum.ToString());
                    command.ReplaceParameterValue("@C2SysNo", C2Sysno.ToString());
                    command.ReplaceParameterValue("@HasItemSysnolist", HasItemSysnolist.ToListString());
                    command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                    onlineList = command.ExecuteEntityList <OnlineList>();
                }
                else
                {
                    DataCommand command = DataCommandManager.GetDataCommand("GetPriceDownPercentItemForC2Single");
                    command.ReplaceParameterValue("@num", diffnum.ToString());
                    command.ReplaceParameterValue("@C2SysNo", C2Sysno.ToString());
                    command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                    onlineList = command.ExecuteEntityList <OnlineList>();
                }
            }
            return(onlineList);
        }
コード例 #8
0
ファイル: QuotaObject.cs プロジェクト: NickQi/TianheDemo
 public List<Model.TS_DataCenter_Area_Month> GetTsDataCenterAreaMonth(string whereStr, string Year)
 {
     var cmd = new DataCommand("GetTsDataCenterAreaMonth", new SqlCustomDbCommand());
     cmd.ReplaceParameterValue("#whereStr#", whereStr);
     cmd.ReplaceParameterValue("#Year#", Year);
     return cmd.ExecuteEntityList<Model.TS_DataCenter_Area_Month>();
 }
コード例 #9
0
        public DataTable GetWaitingRegisters(int?soSysNo)
        {
            DataCommand command = DataCommandManager.GetDataCommand("QueryWaitingRegisterForRefund");

            if (soSysNo == null)
            {
                List <int> waitingSO = ObjectFactory <IRefundDA> .Instance.GetWaitingSOForRefund();

                if (waitingSO != null && waitingSO.Count > 0)
                {
                    string sql = "C.[SOSysNo] IN(";

                    waitingSO.ForEach(item => sql += item + ",");

                    sql  = sql.TrimEnd(',');
                    sql += ")";

                    command.ReplaceParameterValue("#SOSysNo#", sql);
                }
                else
                {
                    command.ReplaceParameterValue("#SOSysNo#", "C.[SOSysNo] IS NULL");
                }
            }
            else
            {
                command.ReplaceParameterValue("#SOSysNo#", "C.[SOSysNo] = @SOSysNo");
            }

            command.SetParameterValue("@SOSysNo", soSysNo);
            command.SetParameterValue("@RefundStatus", RMARefundStatus.Abandon);

            return(command.ExecuteDataTable());
        }
コード例 #10
0
ファイル: ComplexReport.cs プロジェクト: NickQi/TianheDemo
        ///// <summary>
        ///// 根据区域和项目代码获取是否含有数据
        ///// </summary>
        ///// <param name="itemcode"></param>
        ///// <param name="areaid"></param>
        ///// <returns></returns>
        //public int GetCountItemCodeAreaId(string itemcode, string areaid)
        //{
        //    string strSql = @"select count(distinct s1.areaid) from Becm_Device s1 "
        //                    + " inner join ( select * from f_GetChildAreaId(" + areaid + " ) ) s2 on s1.areaid = s2.id "
        //                    + " inner join Becm_ItemCode s3 on s1.itemcodeid = s3.itemcodenumber where s1.itemcodeid = '" + itemcode + "'";

        //    return int.Parse(SqlHelper.ExecuteScalar(strSql.ToString()).ToString());
        //}


        /// <summary>
        /// 根据区域和项目代码获取是否含有数据
        /// </summary>
        /// <param name="itemcode"></param>
        /// <param name="areaid"></param>
        /// <returns></returns>
        public int GetCountItemCodeAreaId(string itemcode, string areaid, int classid)
        {
            string strSql = "";

            if (classid == 1)
            {
                //strSql = @" select count(distinct s1.areaid) from Becm_Device s1 "
                // + "inner join ( select * from f_GetChildAreaId(" + areaid + ") ) s2 on s1.areaid = s2.id "
                // + " inner join Becm_ItemCode s3 on s1.itemcodeid = s3.itemcodenumber "
                // + " inner join ( select * from f_GetChildItemCode('" + itemcode + "') ) s4 on s1.itemcodeid=s4.code";

                var cmd = new DataCommand("GetCountItemCodeAreaId1", new SqlCustomDbCommand());
                cmd.ReplaceParameterValue("#Areaid#", areaid);
                cmd.ReplaceParameterValue("#ItemCode#", itemcode);
                return(int.Parse(cmd.ExecuteScalar().ToString()));
            }
            else
            {
                var cmd = new DataCommand("GetCountItemCodeAreaId2", new SqlCustomDbCommand());
                cmd.ReplaceParameterValue("#Areaid#", areaid);
                cmd.ReplaceParameterValue("#ItemCode#", itemcode);
                return(int.Parse(cmd.ExecuteScalar().ToString()));
                //          strSql = @" select count(distinct s1.areaid) from Becm_Device s1 "
                //+ "inner join ( select * from f_GetChildFuncAreaId(" + areaid + ") ) s2 on s1.areaid2 = s2.id "
                //+ " inner join Becm_ItemCode s3 on s1.itemcodeid = s3.itemcodenumber "
                //+ " inner join ( select * from f_GetChildItemCode('" + itemcode + "') ) s4 on s1.itemcodeid=s4.code";
            }


            //return int.Parse(SqlHelper.ExecuteScalar(strSql.ToString()).ToString());
        }
コード例 #11
0
ファイル: UserGroupObject.cs プロジェクト: NickQi/TianheDemo
 public List<Model.TB_Menu> GetMenuList(string where, string order)
 {
     var cmd = new DataCommand("GetMenuList", new SqlCustomDbCommand());
     cmd.ReplaceParameterValue("#whereStr#", where);
     cmd.ReplaceParameterValue("#orderby#", order);
     return cmd.ExecuteEntityList<Model.TB_Menu>();
 }
コード例 #12
0
        internal static void ClearTableOnLinelist(string day)
        {
            DataCommand command = DataCommandManager.GetDataCommand("ClearTableOnLinelist");

            command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
            command.ReplaceParameterValue("@Day", day);
            command.ExecuteNonQuery();
        }
コード例 #13
0
ファイル: OnlinelistDA.cs プロジェクト: sanlonezhang/ql
        public static void ClearTableOnLinelist(string day)
        {
            DataCommand command = DataCommandManager.GetDataCommand("ClearTableOnLinelist");

            command.ReplaceParameterValue("@CompanyCode", CompanyCode);
            command.ReplaceParameterValue("@Day", day);
            command.ExecuteNonQuery();
        }
コード例 #14
0
        public List <Model.TS_DataCenter_Area_Month> GetTsDataCenterAreaMonth(string whereStr, string Year)
        {
            var cmd = new DataCommand("GetTsDataCenterAreaMonth", new SqlCustomDbCommand());

            cmd.ReplaceParameterValue("#whereStr#", whereStr);
            cmd.ReplaceParameterValue("#Year#", Year);
            return(cmd.ExecuteEntityList <Model.TS_DataCenter_Area_Month>());
        }
コード例 #15
0
ファイル: UserGroupObject.cs プロジェクト: NickQi/TianheDemo
        public List <Model.TB_Menu> GetMenuList(string where, string order)
        {
            var cmd = new DataCommand("GetMenuList", new SqlCustomDbCommand());

            cmd.ReplaceParameterValue("#whereStr#", where);
            cmd.ReplaceParameterValue("#orderby#", order);
            return(cmd.ExecuteEntityList <Model.TB_Menu>());
        }
コード例 #16
0
ファイル: Device.cs プロジェクト: NickQi/TianheDemo
        public List <Model.Device> GetDeviceList(string whereStr, string sortStr)
        {
            var cmd = new DataCommand("getDevice", new SqlCustomDbCommand());

            cmd.ReplaceParameterValue("#whereStr#", whereStr);
            cmd.ReplaceParameterValue("#Sort#", sortStr);
            return(cmd.ExecuteEntityList <Model.Device>());
        }
コード例 #17
0
        internal static List <OnlineList> CheckC2ItemNumOnC1(int C1sysno)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CheckC2ItemNumOnC1");

            command.ReplaceParameterValue("@Category1Sysno", C1sysno.ToString());
            command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
            return(command.ExecuteEntityList <OnlineList>());
        }
コード例 #18
0
ファイル: AlarmAccess.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取告警类型数据
        /// </summary>
        /// <param name="whereStr"></param>
        /// <returns></returns>
        public DataTable GetAlarmList(QueryAlarmNew alarmNew, string groupId)
        {
            try
            {
                int intPazeSize = alarmNew.PageSize;
                int intNext     = intPazeSize * (alarmNew.PageIndex - 1);

                string whereStr = "";
                string orderStr = "ORDER BY id desc";
                whereStr += " and ALARMTIME between '" + alarmNew.StartTime.ToString("yyyy-MM-dd 00:00:00") + "' and '" + alarmNew.EndTime.ToString("yyyy-MM-dd 23:59:59") + "'";
                if (alarmNew.AlarmLevel != "")
                {
                    whereStr += " and ALARMLEVEL = " + alarmNew.AlarmLevel;
                }
                if (alarmNew.AlarmStatus != "")
                {
                    whereStr += " and STATUS = " + alarmNew.AlarmStatus;
                }
                if (alarmNew.AlarmType != "")
                {
                    whereStr += " and alarmtype = " + alarmNew.AlarmType;
                }
                IList <string> lstAreaId   = GetAlarmListAreaId(alarmNew.ObjectId, alarmNew.ObjType);
                IList <string> lstDeviceId = GetAlarmListDeviceId(alarmNew.ObjectId, alarmNew.ObjType);
                whereStr += " and (";
                if (lstAreaId.Count > 0)
                {
                    string strAreaId = string.Join(",", lstAreaId.ToArray());
                    whereStr += " ALARMOBJID in (" + strAreaId + ") and alarmObjType=32  ";
                }
                else
                {
                    whereStr += "1=2";
                }
                whereStr += " or ";
                if (lstDeviceId.Count > 0)
                {
                    string strDeviceId = string.Join(",", lstDeviceId.ToArray());
                    whereStr += " ALARMOBJID in (" + strDeviceId + ") and alarmObjType=31 ";
                }
                else
                {
                    whereStr += "1=2";
                }
                whereStr += ")";

                var cmd = new DataCommand("GetAlarmList", new SqlCustomDbCommand());
                cmd.ReplaceParameterValue("#PageSize#", intPazeSize.ToString());
                cmd.ReplaceParameterValue("#Next#", intNext.ToString());
                cmd.ReplaceParameterValue("#whereStr#", whereStr);
                cmd.ReplaceParameterValue("#orderStr#", orderStr);
                return(cmd.ExecuteDataSet().Tables[0]);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #19
0
ファイル: OnlinelistDA.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 删除作废已标记数据
        /// </summary>
        /// <param name="pagetype"></param>
        /// <param name="positionid"></param>
        /// <param name="pageID"></param>
        public static void DeleteOnlineListItem(int pagetype, int positionid, int pageID)
        {
            DataCommand command = DataCommandManager.GetDataCommand("DeleteOnlineListSystem");

            command.ReplaceParameterValue("@PageType", pagetype.ToString());
            command.ReplaceParameterValue("@PageID", pageID.ToString());
            command.ReplaceParameterValue("@PositionID", positionid.ToString());
            command.ReplaceParameterValue("@CompanyCode", CompanyCode);
            command.ExecuteNonQuery();
        }
コード例 #20
0
ファイル: OnlinelistDA.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 将该位置系统之前添加的数据标记为待删除
        /// </summary>
        /// <param name="pagetype"></param>
        /// <param name="positionid"></param>
        /// <param name="pageID"></param>
        public static void UpdateInvalidData(int pagetype, int positionid, int pageID)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdateInvalidData");

            command.ReplaceParameterValue("@PageType", pagetype.ToString());
            command.ReplaceParameterValue("@PageID", pageID.ToString());
            command.ReplaceParameterValue("@PositionID", positionid.ToString());
            command.ReplaceParameterValue("@CompanyCode", CompanyCode);
            command.ExecuteNonQuery();
        }
コード例 #21
0
ファイル: CommonDA.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 获取商品配送规则
        /// </summary>
        /// <param name="c3SysNoStr">商品3级分类编号序列(如:254,256)</param>
        /// <param name="productSysNoStr">商品编号序列(如:157856,157896)</param>
        /// <param name="provinceSysNo">省编号</param>
        /// <param name="citySysNo">市编号</param>
        /// <param name="areaSysno">区编号</param>
        /// <param name="companyCode">公司编号</param>
        /// <returns></returns>
        public List <ItemShipRuleInfo> GetItemShipRuleList(string c3SysNoStr, string productSysNoStr, int?provinceSysNo, int?citySysNo, int?areaSysno, string companyCode)
        {
            DataCommand command = DataCommandManager.GetDataCommand("GetItemShipRuleList");

            command.ReplaceParameterValue("#C3SysNoStr#", c3SysNoStr);
            command.ReplaceParameterValue("#ProductSysNoStr#", productSysNoStr);
            command.SetParameterValue("@ProvinceSysNo", provinceSysNo);
            command.SetParameterValue("@CitySysNo", citySysNo);
            command.SetParameterValue("@AreaSysNo", areaSysno);
            command.SetParameterValue("@CompanyCode", companyCode);
            return(command.ExecuteEntityList <ItemShipRuleInfo>());
        }
コード例 #22
0
        /// <summary>
        /// 获取查询的列表
        /// </summary>
        /// <param name="whereStr">查询的条件</param>
        /// <param name="order">排序的方式</param>
        /// <param name="parameters">查询的参数</param>
        /// <returns></returns>
        public List <Model.BaseLayerObject> GetBaseLayerObjectList(string whereStr, string sortStr, string username = "")
        {
            // var cmd = new DataCommand("getBaseLayerObject", new SqlCustomDbCommand());
            //string username = "";
            //try
            //{
            //    //username = HttpContext.Current.Cache["username"].ToString();
            //    username = GetCookie("userid");
            //     username = HttpContext.Current.Session["userid"].ToString() ;

            //    username = NTS.WEB.Common.CacheHelper.GetCache("username").ToString();

            //}
            //catch(Exception ee)
            //{
            //}
            string viewname = "";

            if (!string.IsNullOrEmpty(username))
            {
                viewname  = "Becm_LayerObjectByUser";
                whereStr += string.Format(" and username='******'", username);
            }
            else
            {
                viewname = "getBaseLayerObject";
            }
            var cmd = new DataCommand(viewname, new SqlCustomDbCommand());

            cmd.ReplaceParameterValue("#whereStr#", whereStr);
            cmd.ReplaceParameterValue("#Sort#", sortStr);



            //username = HttpContext.Current.Cache["username"].ToString();
            //username = GetCookie("username");
            //if (HttpContext.Current.Session["username"] != null)
            //{
            //    username = HttpContext.Current.Session["username"].ToString();
            //}

            //if (!string.IsNullOrEmpty(username))
            //{
            //    cmd.SetParameterValue("@username", username);
            //}
            //else
            //{
            //    cmd.SetParameterValue("@username", DBNull.Value);
            //}
            return(cmd.ExecuteEntityList <Model.BaseLayerObject>());
        }
コード例 #23
0
ファイル: Itemcode.cs プロジェクト: NickQi/TianheDemo
 public List<Model.Itemcode> GetItemcodeList(string whereStr, string sortStr)
 {
     try
     {
         var cmd = new DataCommand("getItemCode", new SqlCustomDbCommand());
         cmd.ReplaceParameterValue("#whereStr#", whereStr);
         cmd.ReplaceParameterValue("#Sort#", sortStr);
         return cmd.ExecuteEntityList<Model.Itemcode>();
     }
     catch(Exception ee)
     {
         return null;
     }
 }
コード例 #24
0
ファイル: Itemcode.cs プロジェクト: NickQi/TianheDemo
 public List <Model.Itemcode> GetItemcodeList(string whereStr, string sortStr)
 {
     try
     {
         var cmd = new DataCommand("getItemCode", new SqlCustomDbCommand());
         cmd.ReplaceParameterValue("#whereStr#", whereStr);
         cmd.ReplaceParameterValue("#Sort#", sortStr);
         return(cmd.ExecuteEntityList <Model.Itemcode>());
     }
     catch (Exception ee)
     {
         return(null);
     }
 }
コード例 #25
0
        public static List <OnlineList> GetNewItem(int num, int C2Sysno)
        {
            List <OnlineList> onlineList = null;

            if (num > 0)
            {
                DataCommand command = DataCommandManager.GetDataCommand("GetSaleHightItem");
                command.ReplaceParameterValue("@num", num.ToString());
                command.ReplaceParameterValue("@C2SysNo", C2Sysno.ToString());
                command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                onlineList = command.ExecuteEntityList <OnlineList>();
            }
            return(onlineList);
        }
コード例 #26
0
        public static List <OnlineList> GetSaleHightItemForC1Page(int diffnum, List <int> HasItemSysnolist, int C1Sysno, int C2Sysno)
        {
            List <OnlineList> onlineList = null;

            if (diffnum > 0)
            {
                if (HasItemSysnolist != null && HasItemSysnolist.Count > 0)
                {
                    if (C2Sysno != -1)
                    {
                        DataCommand command = DataCommandManager.GetDataCommand("GetSaleHightItemForC1PagebyC2sysno");
                        command.ReplaceParameterValue("@num", diffnum.ToString());
                        command.ReplaceParameterValue("@C2SysNo", C2Sysno.ToString());
                        command.ReplaceParameterValue("@ItemSysnolist", HasItemSysnolist.ToListString());
                        command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                        onlineList = command.ExecuteEntityList <OnlineList>();
                    }
                    else
                    {
                        DataCommand command = DataCommandManager.GetDataCommand("GetSaleHightItemForC1Page");
                        command.ReplaceParameterValue("@num", diffnum.ToString());
                        command.ReplaceParameterValue("@C1SysNo", C1Sysno.ToString());
                        command.ReplaceParameterValue("@ItemSysnolist", HasItemSysnolist.ToListString());
                        command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                        onlineList = command.ExecuteEntityList <OnlineList>();
                    }
                }
                else
                {
                    if (C2Sysno != -1)
                    {
                        DataCommand command = DataCommandManager.GetDataCommand("GetSaleHightItemForC1PageByC2sysnoSingle");
                        command.ReplaceParameterValue("@num", diffnum.ToString());
                        command.ReplaceParameterValue("@C2SysNo", C2Sysno.ToString());
                        command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                        onlineList = command.ExecuteEntityList <OnlineList>();
                    }
                    else
                    {
                        DataCommand command = DataCommandManager.GetDataCommand("GetSaleHightItemForC1PageSingle");
                        command.ReplaceParameterValue("@num", diffnum.ToString());
                        command.ReplaceParameterValue("@C1SysNo", C1Sysno.ToString());
                        command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
                        onlineList = command.ExecuteEntityList <OnlineList>();
                    }
                }
            }
            return(onlineList);
        }
コード例 #27
0
        internal static int CheckBrandItemNum(int brandsysno)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CheckBrandItemNum");

            command.ReplaceParameterValue("@BrandSysNo", brandsysno.ToString());
            command.ReplaceParameterValue("@CompanyCode", ConfigurationManager.AppSettings["CompanyCode"]);
            try
            {
                return(command.ExecuteScalar <int>());
            }
            catch
            {
                return(0);
            }
        }
コード例 #28
0
ファイル: BrandRequestDA.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 是否存在该审核
        /// 当中文名或者英文名存在重的名称即认为存在品牌重复
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public bool IsExistsBrandRequest_New(BrandRequestInfo info)
        {
            string      queryStr = "";
            DataCommand cmd      = DataCommandManager.GetDataCommand("IsExistsBrandRequest_New");

            if ((!string.IsNullOrWhiteSpace(info.BrandNameLocal.Content)) && string.IsNullOrWhiteSpace(info.BrandNameGlobal))
            {
                queryStr = " AND BrandName_Ch=@BrandName_Ch";
            }
            if ((!string.IsNullOrWhiteSpace(info.BrandNameGlobal)) && string.IsNullOrWhiteSpace(info.BrandNameLocal.Content))
            {
                queryStr = " AND BrandName_En=@BrandName_En";
            }
            if ((!string.IsNullOrWhiteSpace(info.BrandNameGlobal)) && (!string.IsNullOrWhiteSpace(info.BrandNameLocal.Content)))
            {
                queryStr = " AND (BrandName_Ch=@BrandName_Ch or BrandName_En=@BrandName_En)";
            }
            if ((!string.IsNullOrWhiteSpace(info.BrandNameGlobal)) && string.IsNullOrWhiteSpace(info.BrandNameLocal.Content))
            {
                queryStr = " AND BrandName_Ch='' AND BrandName_En='' ";
            }
            cmd.SetParameterValue("@BrandName_Ch", info.BrandNameLocal.Content);
            cmd.SetParameterValue("@BrandName_En", info.BrandNameGlobal);

            cmd.ReplaceParameterValue("#strWhere#", queryStr);
            cmd.ExecuteNonQuery();
            return((int)cmd.GetParameterValue("@flag") < 0);
        }
コード例 #29
0
ファイル: ComplexReport.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取查询的列表
        /// </summary>
        /// <param name="whereStr">查询的条件</param>
        /// <param name="order">排序的方式</param>
        /// <param name="parameters">查询的参数</param>
        /// <returns></returns>
        public DataTable GetList(string whereStr, string order)
        {
//            StringBuilder strSql = new StringBuilder();
//            strSql.Append(@"select layerobjectid,layerobjectname,layerobjectpic,layerobjectcontent,layerobjectparentid,bgflag,areatype
//            from (select layerobjectid,layerobjectname,layerobjectpic,layerobjectcontent,layerobjectparentid,bgflag,areatype
//            from Becm_LayerObject union
//            select layerobjectid,layerobjectname,layerobjectpic,layerobjectcontent,layerobjectparentid,bgflag,areatype
//            from Becm_FunctionObject)
//            aa where 1=1");
//            if (!whereStr.Equals(string.Empty))
//            {
//                strSql.AppendFormat(" and {0}", whereStr);
//            }
//            strSql.AppendFormat(" order by {0}", order);

//            DataTable dt = SqlHelper.Query(strSql.ToString(), parameters).Tables[0];
//            return dt;

            try
            {
                var cmd = new DataCommand("GetList", new SqlCustomDbCommand());
                cmd.ReplaceParameterValue("#whereStr#", whereStr);
                //cmd.ReplaceParameterValue("#Sort#", order);
                return(cmd.ExecuteDataSet().Tables[0]);
            }
            catch (Exception ee)
            {
                throw ee;
            }
        }
コード例 #30
0
        public List <Model.SysLog> GetSysLogList(string whereStr)
        {
            var cmd = new DataCommand("GetSysLog", new SqlCustomDbCommand());

            cmd.ReplaceParameterValue("#whereStr#", whereStr);
            return(cmd.ExecuteEntityList <Model.SysLog>());
        }
コード例 #31
0
ファイル: MonthDataObject.cs プロジェクト: NickQi/TianheDemo
        public List<Model.MonthSumData> GetMonthDataObjectList(string tableName,string date)
        {
            var cmd = new DataCommand("getMonthData", new SqlCustomDbCommand());
            cmd.ReplaceParameterValue("#TableName#", tableName);

            return cmd.ExecuteEntityList<Model.MonthSumData>();
        }
コード例 #32
0
ファイル: AlarmAccess.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取告警类型
        /// </summary>
        /// <param name="whereStr"></param>
        /// <returns></returns>
        public int GetAlarmIndexCount(QueryAlarmNew alarmNew)
        {
            int       intPazeSize = alarmNew.PageSize;
            int       intNext     = intPazeSize * (alarmNew.PageIndex - 1);
            DataTable dtAlarmType = new DataTable();
            string    strSql      = @" SELECT count(id) from AlarmAreaDevice where 1=1";
            string    whereStr    = "";

            whereStr += " and ALARMTIME between '" + alarmNew.StartTime.ToString("yyyy-MM-dd 00:00:00") + "' and '" + alarmNew.EndTime.ToString("yyyy-MM-dd 23:59:59") + "'";
            if (alarmNew.AlarmStatus != "")
            {
                whereStr += " and STATUS = " + alarmNew.AlarmStatus;
            }

            if (!whereStr.Equals(string.Empty))
            {
                strSql = strSql + whereStr;
            }

            // Object obj = SqlHelper.GetSingle(strSql);
            var cmd = new DataCommand("GetBaseDataItem", new SqlCustomDbCommand());

            cmd.ReplaceParameterValue("#SQLSTR#", strSql);
            return(int.Parse(cmd.ExecuteScalar().ToString()));
        }
コード例 #33
0
ファイル: Alloction.cs プロジェクト: NickQi/TianheDemo
 public List<Model.TS_FEE_DAY> GetFeeDayList(int year, string whereStr)
 {
     try
     {
         var cmd = new DataCommand("getFeeDay", new SqlCustomDbCommand());
         cmd.ReplaceParameterValue("#TableName#", "TS_FEE_DAY_" + year);
         cmd.ReplaceParameterValue("#whereStr#", whereStr);
         List<Model.TS_FEE_DAY> list = cmd.ExecuteEntityList<Model.TS_FEE_DAY>();
         return list;
     }
     catch (Exception ex)
     {
         string message = ex.Message;
     }
     return null;
 }
コード例 #34
0
ファイル: CostQuery.cs プロジェクト: NickQi/TianheDemo
        public List<CostQueryModel> GetCostQuery(QueryCost query)
        {
            try
            {
                var cmd = new DataCommand("getCostQuery", new SqlCustomDbCommand());
                string table = "";
                switch (query.Particle)
                {
                    case Particle.Month:
                        table = string.Format("TS_FEE_DAY_{0}", query.StartTime.Year);
                        break;
                    case Particle.Year:
                        table = string.Format("TS_FEE_MONTH_{0}", query.StartTime.Year);
                        break;
                    default:
                        table = string.Format("TS_FEE_DAY_{0}", query.StartTime.Year);
                        break;
                }
                cmd.ReplaceParameterValue("#TableName#", table);
                cmd.SetParameterValue("@OBJECTID", query.ObjectId.ToString());
                cmd.SetParameterValue("@ITEMCODE", query.ItemCode);
                cmd.SetParameterValue("@StartTime", query.StartTime);
                cmd.SetParameterValue("@EndTime", query.EndTime);

                return cmd.ExecuteEntityList<CostQueryModel>();
            }
            catch (Exception ee)
            {
                throw ee;
            }
        }
コード例 #35
0
ファイル: AlarmDiagnose.cs プロジェクト: NickQi/TianheDemo
        public List<AlarmDiagnoseModel> GetAlarmDiagnose(QueryAlarm query)
        {
            try
            {
                var cmd = new DataCommand("getAlarmDiagnose", new SqlCustomDbCommand());
                IList<string> objectIds = new AlarmAccess().GetAlarmListAreaId(query.ObjectId, query.ObjType);
                StringBuilder sb = new StringBuilder();
                foreach (string s in objectIds)
                {
                    sb.Append(s);
                    sb.Append(",");
                }
                sb.Remove(sb.Length - 1, 1);
                cmd.ReplaceParameterValue("#ObjectId#", sb.ToString());
                cmd.SetParameterValue("@StartTime", query.StartTime);
                cmd.SetParameterValue("@EndTime", query.EndTime);

                return cmd.ExecuteEntityList<AlarmDiagnoseModel>();
            }
            catch(Exception ee)
            {
                throw ee;
                //return null;
            }
        }
コード例 #36
0
        public void DeleteSOInterceptInfo(SOInterceptInfo info)
        {
            DataCommand command = DataCommandManager.GetDataCommand("BatchDeleteSOIntercept");

            command.ReplaceParameterValue("#SysNoString#", " SysNo IN (" + info.Sysnolist + ")");
            command.ExecuteNonQuery();
        }
コード例 #37
0
ファイル: UserGroupObject.cs プロジェクト: NickQi/TianheDemo
        public List <Model.TB_UserGroup> GetUserGroupList(string whereStr)
        {
            var cmd = new DataCommand("GetUserGroupList", new SqlCustomDbCommand());

            cmd.ReplaceParameterValue("#whereStr#", whereStr);
            return(cmd.ExecuteEntityList <Model.TB_UserGroup>());
        }
コード例 #38
0
        /// <summary>
        /// 获取告警类型表所有数据
        /// </summary>
        /// <returns>List<Model.TB_AlarmType></returns>
        public List <Model.TB_AlarmType> GetAlarmTypeList(string whereStr)
        {
            var cmd = new DataCommand("getAlarmTypeList", new SqlCustomDbCommand());

            cmd.ReplaceParameterValue("#whereStr#", whereStr);
            return(cmd.ExecuteEntityList <Model.TB_AlarmType>());
        }
コード例 #39
0
ファイル: PMMPIInventoryDA.cs プロジェクト: sanlonezhang/ql
        public static int InsertMPI(string PMSysNos)
        {
            DataCommand command = DataCommandManager.GetDataCommand("QueryPMMPIEntityInfoByCategoryV2");

            command.ReplaceParameterValue("#PMSysNos#", PMSysNos);
            return(command.ExecuteNonQuery());
        }
コード例 #40
0
ファイル: BaseLayerObject.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取查询的列表
        /// </summary>
        /// <param name="whereStr">查询的条件</param>
        /// <param name="order">排序的方式</param>
        /// <param name="parameters">查询的参数</param>
        /// <returns></returns>
        public List<Model.BaseLayerObject> GetBaseLayerObjectList(string whereStr, string sortStr, string username = "")
        {
            // var cmd = new DataCommand("getBaseLayerObject", new SqlCustomDbCommand());
            //string username = "";
            //try
            //{
            //    //username = HttpContext.Current.Cache["username"].ToString();
            //    username = GetCookie("userid");
            //     username = HttpContext.Current.Session["userid"].ToString() ;

            //    username = NTS.WEB.Common.CacheHelper.GetCache("username").ToString();

            //}
            //catch(Exception ee)
            //{
            //}
            string viewname = "";
            if (!string.IsNullOrEmpty(username))
            {
                viewname = "Becm_LayerObjectByUser";
                whereStr += string.Format(" and username='******'", username);
            }
            else
            {
                viewname = "getBaseLayerObject";
            }
            var cmd = new DataCommand(viewname, new SqlCustomDbCommand());
            cmd.ReplaceParameterValue("#whereStr#", whereStr);
            cmd.ReplaceParameterValue("#Sort#", sortStr);

            //username = HttpContext.Current.Cache["username"].ToString();
            //username = GetCookie("username");
            //if (HttpContext.Current.Session["username"] != null)
            //{
            //    username = HttpContext.Current.Session["username"].ToString();
            //}

            //if (!string.IsNullOrEmpty(username))
            //{
            //    cmd.SetParameterValue("@username", username);
            //}
            //else
            //{
            //    cmd.SetParameterValue("@username", DBNull.Value);
            //}
            return cmd.ExecuteEntityList<Model.BaseLayerObject>();
        }
コード例 #41
0
ファイル: BaseLayerObject.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取查询的列表
        /// </summary>
        /// <param name="whereStr">查询的条件</param>
        /// <param name="order">排序的方式</param>
        /// <param name="parameters">查询的参数</param>
        /// <returns></returns>
        public List<Model.BaseLayerObject> GetBaseFuncLayerObjectList(string whereStr, string sortStr, string username = "")
        {
            string viewname = "";
            if (!string.IsNullOrEmpty(username))
            {
                viewname = "Becm_FunctionObjectByUser";
                whereStr += string.Format(" and username='******'", username);
            }
            else
            {
                viewname = "getBaseFuncLayerObject";
            }
            var cmd = new DataCommand(viewname, new SqlCustomDbCommand());
            cmd.ReplaceParameterValue("#whereStr#", whereStr);
            cmd.ReplaceParameterValue("#Sort#", sortStr);

            return cmd.ExecuteEntityList<Model.BaseLayerObject>();
        }
コード例 #42
0
ファイル: Import.cs プロジェクト: NickQi/TianheDemo
 public HistoryImport GetResultImportList(HistoryQuery import, int action)
 {
     var result = new HistoryImport { HistoryItem = new List<ResultImport>(), PageInfo = new PageInfo() };
     var cmd = new DataCommand("SearchImportData", new SqlCustomDbCommand());
     var whereStr = new StringBuilder();
     if (import.DeviceId == null || import.DeviceId==0)
     {
         if (!string.IsNullOrEmpty(import.ObjectId.ToString()))
         {
             whereStr.Append(string.Format(" and import.ObjectID={0}", import.ObjectId));
         }
     }
     else
     {
         whereStr.Append(string.Format(" and import.ObjectID={0}", import.DeviceId));
     }
     if (!string.IsNullOrEmpty(import.Starttime.ToString()))
     {
         whereStr.Append(string.Format(" and import.Starttime>='{0}'", import.Starttime));
     }
     if (!string.IsNullOrEmpty(import.Endtime.ToString()))
     {
         whereStr.Append(string.Format(" and import.Starttime<='{0}'", import.Endtime));
     }
     if (!string.IsNullOrEmpty(import.ItemCode))
     {
         whereStr.Append(string.Format(" and import.ItemCode='{0}'", import.ItemCode));
     }
     if (!string.IsNullOrEmpty(import.DateUnit.ToString(CultureInfo.InvariantCulture)))
     {
         whereStr.Append(string.Format(" and import.MonthType={0}", import.DateUnit));
     }
     cmd.SetParameterValue("@action", action);
     cmd.ReplaceParameterValue("#whereStr#", whereStr.ToString());
     cmd.ReplaceParameterValue("#pagesize#",import.PaddingInfo.PageSize.ToString(CultureInfo.InvariantCulture));
     cmd.ReplaceParameterValue("#pagenums#", ((import.PaddingInfo.Page - 1) * import.PaddingInfo.PageSize).ToString(CultureInfo.InvariantCulture));
     result.HistoryItem = cmd.ExecuteEntityList<ResultImport>();
     foreach (var item in result.HistoryItem)
     {
         item.ObjectName = GetObjectName(item.IsArea, item.ObjectId);
     }
     result.PageInfo.Total = (int)cmd.GetParameterValue("@Count");
     return result;
 }
コード例 #43
0
ファイル: Alloction.cs プロジェクト: NickQi/TianheDemo
 public bool SaveAlloctionAndLog(string sql)
 {
     var cmd = new DataCommand("saveAlloctionAndLog", new SqlCustomDbCommand());
     cmd.ReplaceParameterValue("#sql#", sql);
     int result = cmd.ExecuteNonQuery();
     if (result > 0)
         return true;
     else
         return false;
 }
コード例 #44
0
        /// <summary>
        /// 获取表的基础数据集
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static DataTable GetBaseData(BaseDataModel model)
        {
            var dtold = new DataTable();
            var tcount = new List<string>();
            var cmdName = string.Empty;
            tcount = GetTcountNames(model, tcount);
            switch (model.Unit)
            {
                case ChartUnit.unit_hour:
                    cmdName = "getBaseDataByHour";
                    break;
                case ChartUnit.unit_day:
                    cmdName = "getBaseDataByDate";
                    break;
                case ChartUnit.unit_month:
                    cmdName = "getBaseDataByMonth";
                    break;
                default:
                    cmdName = "getBaseDataByMonth";
                    break;
            }
            //var cmd = new DataCommand(cmdName, new SqlCustomDbCommand());
            //cmd.SetParameterValue("@countid", model.ObjectId);
            //cmd.SetParameterValue("@itemcode", model.ItemCode);
            for (var i = 0; i < tcount.Count; i++)
            {
                var cmd = new DataCommand(cmdName, new SqlCustomDbCommand());
                cmd.SetParameterValue("@countid", model.ObjectId);
                cmd.SetParameterValue("@itemcode", model.ItemCode);

                cmd.ReplaceParameterValue("#TableName#", tcount[i]);
                //cmd.SetParameterValue("#TableName#", tcount[i]);
                //object param = cmd.GetParameterValue("#TableName#");
                //cmd.SetParameterValue("@tname", tcount[i]);
                DataTable dts;
                if (model.Unit == ChartUnit.unit_hour)
                {
                    cmd.SetParameterValue("@cdate", model.Starttime.ToString("yyyy-MM-dd"));
                }
                try
                {
                    dts = cmd.ExecuteDataSet().Tables[0];

                    dtold = i.Equals(0) ? dts.Clone() : dtold;
                    dtold = UniteDataTable(dtold, dts.Copy());
                }
                catch (Exception e)
                {
                    //throw new Exception(e.Message);
                }
            }
            return MakerData(dtold, model);
        }
コード例 #45
0
ファイル: RightObject.cs プロジェクト: NickQi/TianheDemo
 public bool HasMenuRight(string where)
 {
     try
     {
         var cmd = new DataCommand("HasMenuRight", new SqlCustomDbCommand());
         cmd.ReplaceParameterValue("#whereStr#", where);
         return int.Parse(cmd.ExecuteScalar().ToString()) == 0 ? false : true;
     }
     catch (Exception)
     {
         return false;
     }
 }
コード例 #46
0
ファイル: QuotaAnalyse.cs プロジェクト: NickQi/TianheDemo
        public QuotaAnalyseModel GetQuotaAnalyse(string whereStr)
        {
            try
            {
                var cmd = new DataCommand("getQuotaValue", new SqlCustomDbCommand());
                cmd.ReplaceParameterValue("#whereStr#", whereStr);
                //return  cmd.ExecuteEntity<QuotaAnalyseModel>();
                var list = cmd.ExecuteEntityList<QuotaAnalyseModel>();
                if (list.Count > 0)
                {
                    return list[0];
                }
            }
            catch(Exception ee)
            {

            }
            return null;
        }
コード例 #47
0
ファイル: Fee_Apportion.cs プロジェクト: NickQi/TianheDemo
        public List<CostQueryModel> GetCostQuery(Queryfeeapportion query, DateTime dtBegin, DateTime dtEnd)
        {
            try
            {
                var cmd = new DataCommand("getCostQuery2", new SqlCustomDbCommand());
                string table = "TS_FEE_DAY_" + query.StartTime.Year;
                cmd.ReplaceParameterValue("#TableName#", table);
                cmd.SetParameterValue("@OBJECTID", query.ObjectId.ToString());
                cmd.SetParameterValue("@ITEMCODE", query.ItemCode);
                cmd.SetParameterValue("@StartTime", dtBegin);
                cmd.SetParameterValue("@EndTime", dtEnd);

                return cmd.ExecuteEntityList<CostQueryModel>();
            }
            catch (Exception ee)
            {
                throw ee;
            }
        }
コード例 #48
0
ファイル: AlarmAccess.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取告警数量
        /// </summary>
        /// <param name="whereStr"></param>
        /// <returns></returns>
        public int GetAlarmCount(string whereStr)
        {
            //DataTable dtAlarmType = new DataTable();
            //string strSql = "select count(id) from TE_ALARM where 1=1 ";
            //if (!whereStr.Equals(string.Empty))
            //{
            //    strSql = strSql + whereStr;
            //}
            //Object obj = SqlHelper.GetSingle(strSql);
            //int Count = 0;
            //if (obj != DBNull.Value)
            //{
            //    Count = int.Parse(obj.ToString());
            //}
            //return Count;

            var cmd = new DataCommand("GetAlarmCount", new SqlCustomDbCommand());
            cmd.ReplaceParameterValue("#whereStr#", whereStr);
            return int.Parse(cmd.ExecuteScalar().ToString());
        }
コード例 #49
0
ファイル: DevicePropObject.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 更新设备属性
        /// </summary>
        /// <param name="areaId"></param>
        /// <param name="itemCodeId"></param>
        /// <param name="areaType"></param>
        /// <param name="deviceIds"></param>
        /// <returns></returns>
        public int UpdateDeviceProp(int areaId, int itemCodeId, int areaType, List<int> deviceIds)
        {
            string sql = string.Empty;
            string columName = "areaid1";
            if (areaType == 2)
            {
                columName = "areaid2";
            }
            // sql = string.Format("update tb_device_property set {0}=null where device_itemcode in (select ID from dbo.GetAllChildren({1}))  or device_itemcode={2} ", columName, itemCodeId, itemCodeId);

            foreach (var item in deviceIds)
            {
                sql += string.Format(" update tb_device_property set {0}={1} where id= {2} ", columName, areaId, item);
            }
            if (string.IsNullOrEmpty(sql))
            {
                return 0;
            }
            var cmd = new DataCommand("updateDeviceProp", new SqlCustomDbCommand());
            cmd.ReplaceParameterValue("#sql#", sql);
            int result = cmd.ExecuteNonQuery();
            return result;
        }
コード例 #50
0
ファイル: AlarmAccess.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取告警类型
        /// </summary>
        /// <param name="whereStr"></param>
        /// <returns></returns>
        public int GetAlarmIndexCount(QueryAlarmNew alarmNew)
        {
            int intPazeSize = alarmNew.PageSize;
            int intNext = intPazeSize * (alarmNew.PageIndex - 1);
            DataTable dtAlarmType = new DataTable();
            string strSql = @" SELECT count(id) from AlarmAreaDevice where 1=1";
            string whereStr = "";
            whereStr += " and ALARMTIME between '" + alarmNew.StartTime.ToString("yyyy-MM-dd 00:00:00") + "' and '" + alarmNew.EndTime.ToString("yyyy-MM-dd 23:59:59") + "'";
            if (alarmNew.AlarmStatus != "")
            {
                whereStr += " and STATUS = " + alarmNew.AlarmStatus;
            }

            if (!whereStr.Equals(string.Empty))
            {
                strSql = strSql + whereStr;
            }

            // Object obj = SqlHelper.GetSingle(strSql);
            var cmd = new DataCommand("GetBaseDataItem", new SqlCustomDbCommand());
            cmd.ReplaceParameterValue("#SQLSTR#", strSql);
            return int.Parse(cmd.ExecuteScalar().ToString());
        }
コード例 #51
0
ファイル: Rate.cs プロジェクト: NickQi/TianheDemo
 /// <summary>
 /// 阶梯模式保存 (新增、修改)
 /// </summary>
 /// <param name="sql"></param>
 /// <returns></returns>
 public bool SaveRatePrice(string sql)
 {
     var cmd = new DataCommand("addRatePrice", new SqlCustomDbCommand());
     //cmd.SetParameterValue("@sql", sql);
     cmd.ReplaceParameterValue("#sql#", sql);
     int result = cmd.ExecuteNonQuery();
     if (result > 0)
         return true;
     else
         return false;
 }
コード例 #52
0
ファイル: DataCommon.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取表的基础数据集
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static DataTable GetBaseDataItem(BaseDataModelNew model)
        {
            DataTable dtold = new DataTable();
            try
            {
                List<string> Tcount = new List<string>();
                Tcount = GetTcountNames(model, Tcount);

                for (int i = 0; i < Tcount.Count; i++)
                {
                    string basesql = "";

                    string sql = "";
                    switch (model.Unit)
                    {
                        case "1":
                            basesql = " select top 1 CountID,Value24 as value,ItemCode from \"{0}\" where CountID='{1}' and  CONVERT(varchar(100), CDate, 23)='{2}' and ItemCode='{3}'";
                            break;
                        case "2":
                            basesql = " select top 1 CountID,Value365 as value,ItemCode from \"{0}\" where CountID={1} and ItemCode='{3}'";
                            sql = string.Format(basesql, new object[] { Tcount[i], model.ObjectId, model.Starttime.ToString("yyyy-MM-dd"), model.ItemCode });
                            break;
                        case "3":
                            basesql = " select top 1 CountID,Value30 as value,ItemCode from \"{0}\" where CountID={1} and ItemCode='{3}'";
                            break;
                        default:
                            basesql = " select top 1 CountID,Value24 as value,ItemCode from \"{0}\" where CountID='{1}' and  CONVERT(varchar(100), CDate, 23)='{2}' and ItemCode='{3}'";
                            break;
                    }
                    //  sql = string.Format(basesql, new object[] { Tcount[i], model.Starttime, model.Endtime, model.ItemCode });
                    sql = string.Format(basesql, new object[] { Tcount[i], model.ObjectId, model.Starttime.ToString("yyyy-MM-dd"), model.ItemCode });
                    var cmd = new DataCommand("GetBaseDataItem", new SqlCustomDbCommand());
                    cmd.ReplaceParameterValue("#SQLSTR#", sql);

                    //DataTable dts = SqlHelper.Query(sql).Tables[0];
                    DataTable dts = cmd.ExecuteDataSet().Tables[0];

                    DataTable dtNew = GetNewDataByDts(model, dts);

                    dtold = i.Equals(0) ? dtNew.Clone() : dtold;
                    dtold = UniteDataTable(dtold, dtNew.Copy());
                }
                return dtold;
            }
            catch (Exception ex)
            {
                if (ex.ToString().IndexOf("对象名") > -1)
                {
                    throw new Exception("缺少对应的数据表!");
                }
                else if (ex.ToString().IndexOf("列名") > -1)
                {
                    throw new Exception("缺少对应的数据列!");
                }
                else
                {
                    throw new Exception("数据表发生异常!");
                }
            }
        }
コード例 #53
0
ファイル: UserGroupObject.cs プロジェクト: NickQi/TianheDemo
 public List<Model.TB_UserGroup> GetUserGroupList(string whereStr)
 {
     var cmd = new DataCommand("GetUserGroupList", new SqlCustomDbCommand());
     cmd.ReplaceParameterValue("#whereStr#", whereStr);
     return cmd.ExecuteEntityList<Model.TB_UserGroup>();
 }
コード例 #54
0
ファイル: Alloction.cs プロジェクト: NickQi/TianheDemo
 public List<Model.TB_ALLOCTION_CONFIG> GetAlloctionList(string whereStr)
 {
     var cmd = new DataCommand("getAlloctionList", new SqlCustomDbCommand());
     cmd.ReplaceParameterValue("#whereStr#", whereStr);
     return cmd.ExecuteEntityList<Model.TB_ALLOCTION_CONFIG>();
 }
コード例 #55
0
ファイル: ComplexReport.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取查询的列表
        /// </summary>
        /// <param name="whereStr">查询的条件</param>
        /// <param name="order">排序的方式</param>
        /// <param name="parameters">查询的参数</param>
        /// <returns></returns>
        public DataSet GetItemCode(string whereStr)
        {
            //DataSet dsItemCode = new DataSet();
            //string strSql = "select * from \"Becm_ItemCode\" where 1=1";
            //if (!whereStr.Equals(string.Empty))
            //{
            //    strSql = strSql + whereStr;
            //}
            //dsItemCode = SqlHelper.Query(strSql);
            //return dsItemCode;

            try
            {
                var cmd = new DataCommand("GetItemCode", new SqlCustomDbCommand());
                cmd.ReplaceParameterValue("#whereStr#", whereStr);
                //cmd.ReplaceParameterValue("#Sort#", order);
                return cmd.ExecuteDataSet();
            }
            catch (Exception ee)
            {
                throw ee;
            }
            //return ds.Tables[0];
        }
コード例 #56
0
ファイル: ComplexReport.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取查询的列表
        /// </summary>
        /// <param name="whereStr">查询的条件</param>
        /// <param name="order">排序的方式</param>
        /// <param name="parameters">查询的参数</param>
        /// <returns></returns>
        public DataTable GetList(string whereStr, string order)
        {
            //            StringBuilder strSql = new StringBuilder();
            //            strSql.Append(@"select layerobjectid,layerobjectname,layerobjectpic,layerobjectcontent,layerobjectparentid,bgflag,areatype
            //            from (select layerobjectid,layerobjectname,layerobjectpic,layerobjectcontent,layerobjectparentid,bgflag,areatype
            //            from Becm_LayerObject union
            //            select layerobjectid,layerobjectname,layerobjectpic,layerobjectcontent,layerobjectparentid,bgflag,areatype
            //            from Becm_FunctionObject)
            //            aa where 1=1");
            //            if (!whereStr.Equals(string.Empty))
            //            {
            //                strSql.AppendFormat(" and {0}", whereStr);
            //            }
            //            strSql.AppendFormat(" order by {0}", order);

            //            DataTable dt = SqlHelper.Query(strSql.ToString(), parameters).Tables[0];
            //            return dt;

            try
            {
                var cmd = new DataCommand("GetList", new SqlCustomDbCommand());
                cmd.ReplaceParameterValue("#whereStr#", whereStr);
                //cmd.ReplaceParameterValue("#Sort#", order);
                return cmd.ExecuteDataSet().Tables[0];
            }
            catch (Exception ee)
            {
                throw ee;
            }
        }
コード例 #57
0
ファイル: ComplexReport.cs プロジェクト: NickQi/TianheDemo
 /// <summary>
 /// 获取查询的列表
 /// </summary>
 /// <param name="whereStr">查询的条件</param>
 /// <param name="order">排序的方式</param>
 /// <param name="parameters">查询的参数</param>
 /// <returns></returns>
 public DataTable GetListItemCode(string whereStr, string order)
 {
     //StringBuilder strSql = new StringBuilder();
     //strSql.Append("select * from \"Becm_ItemCode\" where 1=1");
     //if (!whereStr.Equals(string.Empty))
     //{
     //    strSql.AppendFormat(" and {0}", whereStr);
     //}
     //strSql.AppendFormat(" order by {0}", order);
     //DataTable dt = SqlHelper.Query(strSql.ToString(), parameters).Tables[0];
     //return dt;
     try
     {
         var cmd = new DataCommand("GetListItemCode", new SqlCustomDbCommand());
         cmd.ReplaceParameterValue("#whereStr#", whereStr);
         return cmd.ExecuteDataSet().Tables[0];
     }
     catch (Exception ee)
     {
         throw ee;
     }
 }
コード例 #58
0
ファイル: ComplexReport.cs プロジェクト: NickQi/TianheDemo
        ///// <summary>
        ///// 根据区域和项目代码获取是否含有数据
        ///// </summary>
        ///// <param name="itemcode"></param>
        ///// <param name="areaid"></param>
        ///// <returns></returns>
        //public int GetCountItemCodeAreaId(string itemcode, string areaid)
        //{
        //    string strSql = @"select count(distinct s1.areaid) from Becm_Device s1 "
        //                    + " inner join ( select * from f_GetChildAreaId(" + areaid + " ) ) s2 on s1.areaid = s2.id "
        //                    + " inner join Becm_ItemCode s3 on s1.itemcodeid = s3.itemcodenumber where s1.itemcodeid = '" + itemcode + "'";
        //    return int.Parse(SqlHelper.ExecuteScalar(strSql.ToString()).ToString());
        //}
        /// <summary>
        /// 根据区域和项目代码获取是否含有数据
        /// </summary>
        /// <param name="itemcode"></param>
        /// <param name="areaid"></param>
        /// <returns></returns>
        public int GetCountItemCodeAreaId(string itemcode, string areaid, int classid)
        {
            string strSql = "";
            if (classid == 1)
            {
                //strSql = @" select count(distinct s1.areaid) from Becm_Device s1 "
                // + "inner join ( select * from f_GetChildAreaId(" + areaid + ") ) s2 on s1.areaid = s2.id "
                // + " inner join Becm_ItemCode s3 on s1.itemcodeid = s3.itemcodenumber "
                // + " inner join ( select * from f_GetChildItemCode('" + itemcode + "') ) s4 on s1.itemcodeid=s4.code";

                var cmd = new DataCommand("GetCountItemCodeAreaId1", new SqlCustomDbCommand());
                cmd.ReplaceParameterValue("#Areaid#", areaid);
                cmd.ReplaceParameterValue("#ItemCode#", itemcode);
                return int.Parse(cmd.ExecuteScalar().ToString());
            }
            else
            {
                var cmd = new DataCommand("GetCountItemCodeAreaId2", new SqlCustomDbCommand());
                cmd.ReplaceParameterValue("#Areaid#", areaid);
                cmd.ReplaceParameterValue("#ItemCode#", itemcode);
                return int.Parse(cmd.ExecuteScalar().ToString());
              //          strSql = @" select count(distinct s1.areaid) from Becm_Device s1 "
              //+ "inner join ( select * from f_GetChildFuncAreaId(" + areaid + ") ) s2 on s1.areaid2 = s2.id "
              //+ " inner join Becm_ItemCode s3 on s1.itemcodeid = s3.itemcodenumber "
              //+ " inner join ( select * from f_GetChildItemCode('" + itemcode + "') ) s4 on s1.itemcodeid=s4.code";
            }

            //return int.Parse(SqlHelper.ExecuteScalar(strSql.ToString()).ToString());
        }
コード例 #59
0
ファイル: SysLogObject.cs プロジェクト: NickQi/TianheDemo
 public List<Model.SysLog> GetSysLogList(string whereStr)
 {
     var cmd = new DataCommand("GetSysLog", new SqlCustomDbCommand());
     cmd.ReplaceParameterValue("#whereStr#", whereStr);
     return cmd.ExecuteEntityList<Model.SysLog>();
 }
コード例 #60
0
ファイル: AlarmSetting.cs プロジェクト: NickQi/TianheDemo
 /// <summary>
 /// 获取告警类型表所有数据
 /// </summary>
 /// <returns>List<Model.TB_AlarmType></returns>
 public List<Model.TB_AlarmType> GetAlarmTypeList(string whereStr)
 {
     var cmd = new DataCommand("getAlarmTypeList", new SqlCustomDbCommand());
     cmd.ReplaceParameterValue("#whereStr#", whereStr);
     return cmd.ExecuteEntityList<Model.TB_AlarmType>();
 }