public DataSet GetCheckDataInfo(int iden, int PageSize, int PageIndex, bool order, string orderField, bool like, string whereField, string whereString, string authKey)
        {
            if (islogin(authKey))
            {
                string tablename = "View_CheckDataInfo";
                BLL.Data_Centre.Link bll = new BLL.Data_Centre.Link();
                int    recordCount, pageCount;
                string sql = " AND iden=" + iden + " ";
                if (!string.IsNullOrEmpty(whereString))
                {
                    sql += whereString;
                }
                whereString = null;
                DataSet ds = bll.Data_CentreGetList(PageSize, PageIndex, order, orderField, like, whereField, whereString, out recordCount, out pageCount, sql, tablename).DataSet;

                if (ds != null && ds.Tables.Count > 0)
                {
                    ds.Tables[0].Columns.Add("strStockTypes");
                    ds.Tables[0].Columns.Add("strPriceTypes");
                    foreach (DataRow item in ds.Tables[0].Rows)
                    {
                        item["Erp_DrugName"]       = item["Erp_DrugName"].ToString().Trim();
                        item["Erp_Manufacturer"]   = item["Erp_Manufacturer"].ToString().Trim();
                        item["Erp_ApprovalNumber"] = item["Erp_ApprovalNumber"].ToString().Trim();

                        //库存含义
                        int iType = 0;
                        if (int.TryParse(item["StockTypes"].ToString(), out iType))
                        {
                            item["strStockTypes"] = GetUnit(iType);
                        }
                        //价格含义
                        iType = 0;
                        if (int.TryParse(item["PriceTypes"].ToString(), out iType))
                        {
                            item["strPriceTypes"] = GetUnit(iType);
                        }
                    }
                }

                DataTable dt = new DataTable();
                dt.Columns.Add("recordCount");
                dt.Columns.Add("pageCount");
                var dr = dt.NewRow();
                dr["recordCount"] = recordCount;
                dr["pageCount"]   = pageCount;
                dt.Rows.Add(dr);
                ds.Tables.Add(dt);

                return(ds);
            }
            else
            {
                return(null);
            }
        }
        public DataSet GetMaptoolList(int PageSize, int PageIndex, bool order, string orderField, bool like, string whereField, string whereString, int BinType, string authKey, int iden)
        {
            if (islogin(authKey))
            {
                string tablename = "View_Product1";
                BLL.Data_Centre.Link bll = new BLL.Data_Centre.Link();
                int    recordCount, pageCount;
                string sql = " and iden=" + iden + " ";
                switch (BinType)
                {
                //未映射
                case 1:
                {
                    //orderField = "Stock";
                    //order = !order;
                    sql += "and id not in (SELECT t_id FROM dbo.Link WHERE iden=" + iden + ")";
                    break;
                }

                //全部
                case 0:
                {
                    //sql += "and iden =" + iden;
                    break;
                }

                //已映射
                case 2:
                {
                    sql += "and id in (SELECT t_id FROM dbo.Link WHERE iden=" + iden + ")";
                    break;
                }
                }
                if (!string.IsNullOrEmpty(whereString))
                {
                    sql += whereString;
                }
                whereString = null;
                var ds     = bll.Data_CentreGetList(PageSize, PageIndex, order, orderField, like, whereField, whereString, out recordCount, out pageCount, sql, tablename).DataSet;
                ds.Tables[0].Columns.Add("StockToolTipText", typeof(string));
                ds.Tables[0].Columns.Add("remark", typeof(string));
                if (ds.Tables[0].Rows.Count > 0)
                {
                    sql = string.Format("SELECT * FROM View_Stock1 WHERE iden={0} and id IN ({1})", iden, string.Join(",", ds.Tables[0].AsEnumerable().Select(x => "'" + x.Field <object>("id") + "'")));
                    var dtTemp = bll.ExecuteTable(sql);
                    sql = string.Format("SELECT id,tab FROM dbo.tags_2 WHERE iden={0} and id IN ({1})", iden, string.Join(",", ds.Tables[0].AsEnumerable().Select(x => "'" + x.Field <object>("id") + "'")));
                    DataTable dtT2 = bll.ExecuteTable(sql);
                    foreach (DataRow item in ds.Tables[0].Rows)
                    {
                        item["DrugsBase_DrugName"]       = item["DrugsBase_DrugName"].ToString().Trim();
                        item["DrugsBase_Manufacturer"]   = item["DrugsBase_Manufacturer"].ToString().Trim();
                        item["DrugsBase_ApprovalNumber"] = item["DrugsBase_ApprovalNumber"].ToString().Trim();

                        var temp = dtT2.Select("id='" + item["id"] + "'").ToArray();
                        if (temp.Count() > 0)
                        {
                            item["remark"] = temp[0]["tab"];
                            continue;
                        }
                        var drTemp = dtTemp.Select("id='" + item["id"] + "'").OrderBy(x => x.Field <string>("pihao")).ToArray();
                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        for (int i = 0; i < drTemp.Count(); i++)
                        {
                            sb.AppendFormat("批号:{0} 效期:{1} 库存:{2}\r\n", drTemp[i]["pihao"].ToString().Trim(), drTemp[i]["sxrq"].ToString().Trim().Replace(" 0:00:00", ""), drTemp[i]["Stock"].ToString().Trim());
                            if (Library.Lang.DataValidator.IsDateTime(drTemp[i]["sxrq"].ToString()))
                            {
                                if (DateTime.Parse(drTemp[i]["sxrq"].ToString()) < DateTime.Now.AddYears(1))
                                {
                                    item["remark"] = "近效期";
                                }
                            }
                            else
                            {
                                item["remark"] = "效期异常";
                            }
                        }
                        item["StockToolTipText"] = sb.ToString();
                    }
                }
                DataTable dt = new DataTable();
                dt.Columns.Add("recordCount");
                dt.Columns.Add("pageCount");
                var dr = dt.NewRow();
                dr["recordCount"] = recordCount;
                dr["pageCount"]   = pageCount;
                dt.Rows.Add(dr);
                ds.Tables.Add(dt);
                return(ds);
            }
            else
            {
                return(null);
            }
        }