Example #1
0
        public bool GetUserPower(string value, string authKey)
        {
            string name = GetName(authKey);

            BLL.Data_Centre.Link bll = new BLL.Data_Centre.Link();
            bll.ChangeDBShop();
            string    sql = string.Format(@"DECLARE @role VARCHAR(200)
                                        SELECT  @role = role
                                        FROM    yxs_administrators
                                        WHERE   name = '{0}'
                                        SELECT  operatecode
                                        FROM    dbo.yxs_roles_permissions
                                        WHERE   id IN ( SELECT  *
                                                        FROM    dbo.f_split(@role, ',') )", name);
            DataTable dt  = bll.ExecuteTable(sql);

            foreach (DataRow dr in dt.Rows)
            {
                string v = dr["operatecode"].ToString();
                if (value.Equals(v))
                {
                    return(true);
                }
            }
            return(false);
        }
Example #2
0
 public DataSet GetCompleteLink(string t_id, int iden, string authKey)
 {
     if (islogin(authKey))
     {
         string sql = string.Format("SELECT * FROM [Link] where t_id='{0}' and iden={1}", t_id, iden);
         BLL.Data_Centre.Link bll = new BLL.Data_Centre.Link();
         var dr = bll.ExecuteTable(sql).Rows[0];
         bll.ChangeDBShop();
         sql = string.Format("SELECT * FROM dbo._ViewDrugsBaseAndGoods WHERE Product_ID={0} ", dr["id"]);
         return(bll.ExecuteDataSet(sql));
     }
     return(null);
 }
Example #3
0
        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);
            }
        }