Exemplo n.º 1
0
        public StringBuilder GetTrueCountID(string[] ItemcodeArr, string[] ObjectArr, ReportQueryModel model)
        {
            StringBuilder CountList = new StringBuilder();

            for (int i = 0; i < ObjectArr.Length; i++)
            {
                for (int j = 0; j < ItemcodeArr.Length; j++)
                {
                    int tempid = 0;
                    ReportQueryModel newmodel = model;
                    model.objectid = ObjectArr[i];
                    model.itemcode = int.Parse(ItemcodeArr[j]);
                    if (ObjectIsConfig(newmodel, out tempid))
                    {
                        CountList.AppendFormat(",{0}", tempid.ToString());
                    }
                }
            }
            return CountList;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 判断是否配置数据统计
        /// </summary>
        /// <returns></returns>
        public bool ObjectIsConfig(ReportQueryModel model, out int objectid)
        {
            objectid = 0;
            IObjectConfig dal = DataSwitchConfig.CreateObjectConfig();
            SqlParameter[] parameter = {
                                            new SqlParameter("@objectid", SqlDbType.NVarChar),
                                            new SqlParameter("@itemcodeid", SqlDbType.Int),
                                            new SqlParameter("@unit", SqlDbType.Int),
                                            new SqlParameter("@objecttype", SqlDbType.Int)
                                        };
            parameter[0].Value = model.objectid;
            parameter[1].Value = model.itemcode;
            parameter[2].Value = CommDataTool.ConvertBaseCountType(model.unit);
            parameter[3].Value = model.objecttype;
            DataTable becmcountdt = dal.GetList(" objectid=@objectid and objecttype=@objecttype and itemcodeid=@itemcodeid and unit=@unit", "objectid", parameter);

            if (becmcountdt.Rows.Count.Equals(0))
            {
                return false;
            }
            objectid = int.Parse(becmcountdt.Rows[0][0].ToString());
            return true;
        }