コード例 #1
0
ファイル: Bll_Bse_Dict.cs プロジェクト: youthjoy/cshelper
        public bool AddDict(Bse_Dict item)
        {
            bool flag = false;
            if (instance.Add(item) > 0)
            {
                flag = true;
            }

            return flag;
        }
コード例 #2
0
ファイル: Bll_Bse_Dict.cs プロジェクト: youthjoy/cshelper
        public bool DeleteDict(Bse_Dict item)
        {
            bool flag = false;
            item.Stat = 1;
            if (instance.Update(item) > 0)
            {
                flag = true;
            }

            return flag;
        }
コード例 #3
0
ファイル: Bll_Bse_Dict.cs プロジェクト: huaminglee/hfoa
        public string CreateDictNode(Bse_Dict Node,bool IsChildNode, ref int order)
        {
            //获取关键字
            string codeKey = Node.Dict_Key;

            //获取父编码
            string parentCode = Node.Dict_Code;

            if (codeKey == parentCode)//如果是最顶级,即其父编码为空
                parentCode = "";

            //throw new NotImplementedException();
            //var dict = GetModelByCode(parentCode,);
            order = 0;
            //var newCode = GenerateDictCode(dict.Dict_Key,IsChildNode, ref order);
            string Code = "";
            var newCode = Bll_Comm.GetTableKey("", codeKey, parentCode, Code);
            return newCode;
        }
コード例 #4
0
ファイル: Bll_Bse_Dict.cs プロジェクト: youthjoy/cshelper
        public bool AddOrUpdateDict(string key,List<Bse_Dict> list)
        {
            List<Bse_Dict> oldlist = GetDictByKey(key);

            foreach (Bse_Dict item in oldlist)
            {
                var temp = list.FirstOrDefault(o => o.Dict_Code == item.Dict_Code);
                if (temp != null)
                {
                    temp.Dict_ID = item.Dict_ID;

                    UpdateDict(temp);

                    list.Remove(temp);

                }
                else
                {
                    DeleteDict(item);
                }
            }

            foreach (var it in list)
            {
                Bse_Dict bs = new Bse_Dict();
                bs = it;
                int order = 0;

                bs.Dict_Key = key;

                bs.Dict_Code = GenerateDictCode(key);

                bs.Dict_Order = order;
                bs.Dict_PCode = key;

                AddDict(bs);
            }

            return true;
        }
コード例 #5
0
ファイル: ADOBse_Dict.cs プロジェクト: huaminglee/hfoa
 /// <summary>
 /// 获取指定的数据字典 Bse_Dict对象集合
 /// </summary>
 public List<Bse_Dict> GetListByWhere(string strCondition)
 {
     List<Bse_Dict> ret = new List<Bse_Dict>();
      string sql = "SELECT  Dict_ID,Dict_Key,Dict_Code,Dict_Name,Dict_PCode,Dict_PName,Dict_Desp,Dict_SCode,Dict_Bak,Dict_UDef1,Dict_UDef2,Dict_UDef3,Dict_UDef4,Dict_UDef5,Dict_Level,Dict_IsEditable,Stat,Dict_Order FROM Bse_Dict WHERE 1=1 AND ((Stat is null) or (Stat=0) ) ";
      if(!string.IsNullOrEmpty(strCondition))
      {
     strCondition.Replace('\'','"'); //防sql注入
     sql += strCondition ;
      }
       sql += " ORDER BY Dict_ID DESC ";
       SqlDataReader dr=null;
        try {
       dr=(SqlDataReader)idb.ReturnReader(sql);
      while(dr.Read())
      {
     Bse_Dict bse_Dict = new Bse_Dict();
     if (dr["Dict_ID"] != DBNull.Value) bse_Dict.Dict_ID = Convert.ToInt64(dr["Dict_ID"]);
     if (dr["Dict_Key"] != DBNull.Value) bse_Dict.Dict_Key = Convert.ToString(dr["Dict_Key"]);
     if (dr["Dict_Code"] != DBNull.Value) bse_Dict.Dict_Code = Convert.ToString(dr["Dict_Code"]);
     if (dr["Dict_Name"] != DBNull.Value) bse_Dict.Dict_Name = Convert.ToString(dr["Dict_Name"]);
     if (dr["Dict_PCode"] != DBNull.Value) bse_Dict.Dict_PCode = Convert.ToString(dr["Dict_PCode"]);
     if (dr["Dict_PName"] != DBNull.Value) bse_Dict.Dict_PName = Convert.ToString(dr["Dict_PName"]);
     if (dr["Dict_Desp"] != DBNull.Value) bse_Dict.Dict_Desp = Convert.ToString(dr["Dict_Desp"]);
     if (dr["Dict_SCode"] != DBNull.Value) bse_Dict.Dict_SCode = Convert.ToString(dr["Dict_SCode"]);
     if (dr["Dict_Bak"] != DBNull.Value) bse_Dict.Dict_Bak = Convert.ToString(dr["Dict_Bak"]);
     if (dr["Dict_UDef1"] != DBNull.Value) bse_Dict.Dict_UDef1 = Convert.ToString(dr["Dict_UDef1"]);
     if (dr["Dict_UDef2"] != DBNull.Value) bse_Dict.Dict_UDef2 = Convert.ToString(dr["Dict_UDef2"]);
     if (dr["Dict_UDef3"] != DBNull.Value) bse_Dict.Dict_UDef3 = Convert.ToString(dr["Dict_UDef3"]);
     if (dr["Dict_UDef4"] != DBNull.Value) bse_Dict.Dict_UDef4 = Convert.ToString(dr["Dict_UDef4"]);
     if (dr["Dict_UDef5"] != DBNull.Value) bse_Dict.Dict_UDef5 = Convert.ToString(dr["Dict_UDef5"]);
     if (dr["Dict_Level"] != DBNull.Value) bse_Dict.Dict_Level = Convert.ToInt32(dr["Dict_Level"]);
     if (dr["Dict_IsEditable"] != DBNull.Value) bse_Dict.Dict_IsEditable = Convert.ToInt32(dr["Dict_IsEditable"]);
     if (dr["Stat"] != DBNull.Value) bse_Dict.Stat = Convert.ToInt32(dr["Stat"]);
     if (dr["Dict_Order"] != DBNull.Value) bse_Dict.Dict_Order = Convert.ToInt32(dr["Dict_Order"]);
     ret.Add(bse_Dict);
      }
       }catch (System.Exception ex){ throw ex; }  finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
      return ret;
 }
コード例 #6
0
ファイル: ADOBse_Dict.cs プロジェクト: huaminglee/hfoa
        /// <summary>
        /// 获取指定的数据字典 Bse_Dict对象(即:一条记录
        /// </summary>
        public Bse_Dict GetByKey(Int64 dict_ID)
        {
            Bse_Dict bse_Dict = new Bse_Dict();
             string sql = "SELECT  Dict_ID,Dict_Key,Dict_Code,Dict_Name,Dict_PCode,Dict_PName,Dict_Desp,Dict_SCode,Dict_Bak,Dict_UDef1,Dict_UDef2,Dict_UDef3,Dict_UDef4,Dict_UDef5,Dict_Level,Dict_IsEditable,Stat,Dict_Order FROM Bse_Dict WHERE 1=1 AND ((Stat is null) or (Stat=0) )  AND Dict_ID=@Dict_ID ";
             idb.AddParameter("@Dict_ID", dict_ID);

              SqlDataReader dr=null;
               try {
              dr=(SqlDataReader)idb.ReturnReader(sql);
             while(dr.Read())
             {
            if (dr["Dict_ID"] != DBNull.Value) bse_Dict.Dict_ID = Convert.ToInt64(dr["Dict_ID"]);
            if (dr["Dict_Key"] != DBNull.Value) bse_Dict.Dict_Key = Convert.ToString(dr["Dict_Key"]);
            if (dr["Dict_Code"] != DBNull.Value) bse_Dict.Dict_Code = Convert.ToString(dr["Dict_Code"]);
            if (dr["Dict_Name"] != DBNull.Value) bse_Dict.Dict_Name = Convert.ToString(dr["Dict_Name"]);
            if (dr["Dict_PCode"] != DBNull.Value) bse_Dict.Dict_PCode = Convert.ToString(dr["Dict_PCode"]);
            if (dr["Dict_PName"] != DBNull.Value) bse_Dict.Dict_PName = Convert.ToString(dr["Dict_PName"]);
            if (dr["Dict_Desp"] != DBNull.Value) bse_Dict.Dict_Desp = Convert.ToString(dr["Dict_Desp"]);
            if (dr["Dict_SCode"] != DBNull.Value) bse_Dict.Dict_SCode = Convert.ToString(dr["Dict_SCode"]);
            if (dr["Dict_Bak"] != DBNull.Value) bse_Dict.Dict_Bak = Convert.ToString(dr["Dict_Bak"]);
            if (dr["Dict_UDef1"] != DBNull.Value) bse_Dict.Dict_UDef1 = Convert.ToString(dr["Dict_UDef1"]);
            if (dr["Dict_UDef2"] != DBNull.Value) bse_Dict.Dict_UDef2 = Convert.ToString(dr["Dict_UDef2"]);
            if (dr["Dict_UDef3"] != DBNull.Value) bse_Dict.Dict_UDef3 = Convert.ToString(dr["Dict_UDef3"]);
            if (dr["Dict_UDef4"] != DBNull.Value) bse_Dict.Dict_UDef4 = Convert.ToString(dr["Dict_UDef4"]);
            if (dr["Dict_UDef5"] != DBNull.Value) bse_Dict.Dict_UDef5 = Convert.ToString(dr["Dict_UDef5"]);
            if (dr["Dict_Level"] != DBNull.Value) bse_Dict.Dict_Level = Convert.ToInt32(dr["Dict_Level"]);
            if (dr["Dict_IsEditable"] != DBNull.Value) bse_Dict.Dict_IsEditable = Convert.ToInt32(dr["Dict_IsEditable"]);
            if (dr["Stat"] != DBNull.Value) bse_Dict.Stat = Convert.ToInt32(dr["Stat"]);
            if (dr["Dict_Order"] != DBNull.Value) bse_Dict.Dict_Order = Convert.ToInt32(dr["Dict_Order"]);
             }
              }catch (System.Exception ex){ throw ex; }  finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
             return bse_Dict;
        }
コード例 #7
0
ファイル: ADOBse_Dict.cs プロジェクト: huaminglee/hfoa
 /// <summary>
 /// 获取所有的数据字典 Bse_Dict对象(即:一条记录
 /// </summary>
 public List<Bse_Dict> GetAll()
 {
     List<Bse_Dict> ret = new List<Bse_Dict>();
      string sql = "SELECT  Dict_ID,Dict_Key,Dict_Code,Dict_Name,Dict_PCode,Dict_PName,Dict_Desp,Dict_SCode,Dict_Bak,Dict_UDef1,Dict_UDef2,Dict_UDef3,Dict_UDef4,Dict_UDef5,Dict_Level,Dict_IsEditable,Stat,Dict_Order FROM Bse_Dict where 1=1 AND ((Stat is null) or (Stat=0) ) order by Dict_ID desc ";
       SqlDataReader dr=null;
        try {
       dr=(SqlDataReader)idb.ReturnReader(sql);
      while(dr.Read())
      {
     Bse_Dict bse_Dict = new Bse_Dict();
     if (dr["Dict_ID"] != DBNull.Value) bse_Dict.Dict_ID = Convert.ToInt64(dr["Dict_ID"]);
     if (dr["Dict_Key"] != DBNull.Value) bse_Dict.Dict_Key = Convert.ToString(dr["Dict_Key"]);
     if (dr["Dict_Code"] != DBNull.Value) bse_Dict.Dict_Code = Convert.ToString(dr["Dict_Code"]);
     if (dr["Dict_Name"] != DBNull.Value) bse_Dict.Dict_Name = Convert.ToString(dr["Dict_Name"]);
     if (dr["Dict_PCode"] != DBNull.Value) bse_Dict.Dict_PCode = Convert.ToString(dr["Dict_PCode"]);
     if (dr["Dict_PName"] != DBNull.Value) bse_Dict.Dict_PName = Convert.ToString(dr["Dict_PName"]);
     if (dr["Dict_Desp"] != DBNull.Value) bse_Dict.Dict_Desp = Convert.ToString(dr["Dict_Desp"]);
     if (dr["Dict_SCode"] != DBNull.Value) bse_Dict.Dict_SCode = Convert.ToString(dr["Dict_SCode"]);
     if (dr["Dict_Bak"] != DBNull.Value) bse_Dict.Dict_Bak = Convert.ToString(dr["Dict_Bak"]);
     if (dr["Dict_UDef1"] != DBNull.Value) bse_Dict.Dict_UDef1 = Convert.ToString(dr["Dict_UDef1"]);
     if (dr["Dict_UDef2"] != DBNull.Value) bse_Dict.Dict_UDef2 = Convert.ToString(dr["Dict_UDef2"]);
     if (dr["Dict_UDef3"] != DBNull.Value) bse_Dict.Dict_UDef3 = Convert.ToString(dr["Dict_UDef3"]);
     if (dr["Dict_UDef4"] != DBNull.Value) bse_Dict.Dict_UDef4 = Convert.ToString(dr["Dict_UDef4"]);
     if (dr["Dict_UDef5"] != DBNull.Value) bse_Dict.Dict_UDef5 = Convert.ToString(dr["Dict_UDef5"]);
     if (dr["Dict_Level"] != DBNull.Value) bse_Dict.Dict_Level = Convert.ToInt32(dr["Dict_Level"]);
     if (dr["Dict_IsEditable"] != DBNull.Value) bse_Dict.Dict_IsEditable = Convert.ToInt32(dr["Dict_IsEditable"]);
     if (dr["Stat"] != DBNull.Value) bse_Dict.Stat = Convert.ToInt32(dr["Stat"]);
     if (dr["Dict_Order"] != DBNull.Value) bse_Dict.Dict_Order = Convert.ToInt32(dr["Dict_Order"]);
     ret.Add(bse_Dict);
      }
       }catch (System.Exception ex){ throw ex; }  finally {  if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
      return ret;
 }
コード例 #8
0
ファイル: ADOBse_Dict.cs プロジェクト: huaminglee/hfoa
        /// <summary>
        /// 添加数据字典 Bse_Dict对象(即:一条记录)
        /// </summary>
        public int Add(Bse_Dict bse_Dict)
        {
            string sql = "INSERT INTO Bse_Dict (Dict_Key,Dict_Code,Dict_Name,Dict_PCode,Dict_PName,Dict_Desp,Dict_SCode,Dict_Bak,Dict_UDef1,Dict_UDef2,Dict_UDef3,Dict_UDef4,Dict_UDef5,Dict_Level,Dict_IsEditable,Stat,Dict_Order) VALUES (@Dict_Key,@Dict_Code,@Dict_Name,@Dict_PCode,@Dict_PName,@Dict_Desp,@Dict_SCode,@Dict_Bak,@Dict_UDef1,@Dict_UDef2,@Dict_UDef3,@Dict_UDef4,@Dict_UDef5,@Dict_Level,@Dict_IsEditable,@Stat,@Dict_Order)";
             if (string.IsNullOrEmpty(bse_Dict.Dict_Key))
             {
            idb.AddParameter("@Dict_Key", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Key", bse_Dict.Dict_Key);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_Code))
             {
            idb.AddParameter("@Dict_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Code", bse_Dict.Dict_Code);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_Name))
             {
            idb.AddParameter("@Dict_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Name", bse_Dict.Dict_Name);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_PCode))
             {
            idb.AddParameter("@Dict_PCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_PCode", bse_Dict.Dict_PCode);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_PName))
             {
            idb.AddParameter("@Dict_PName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_PName", bse_Dict.Dict_PName);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_Desp))
             {
            idb.AddParameter("@Dict_Desp", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Desp", bse_Dict.Dict_Desp);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_SCode))
             {
            idb.AddParameter("@Dict_SCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_SCode", bse_Dict.Dict_SCode);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_Bak))
             {
            idb.AddParameter("@Dict_Bak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Bak", bse_Dict.Dict_Bak);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef1))
             {
            idb.AddParameter("@Dict_UDef1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef1", bse_Dict.Dict_UDef1);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef2))
             {
            idb.AddParameter("@Dict_UDef2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef2", bse_Dict.Dict_UDef2);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef3))
             {
            idb.AddParameter("@Dict_UDef3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef3", bse_Dict.Dict_UDef3);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef4))
             {
            idb.AddParameter("@Dict_UDef4", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef4", bse_Dict.Dict_UDef4);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef5))
             {
            idb.AddParameter("@Dict_UDef5", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef5", bse_Dict.Dict_UDef5);
             }
             if (bse_Dict.Dict_Level == 0)
             {
            idb.AddParameter("@Dict_Level", 0);
             }
             else
             {
            idb.AddParameter("@Dict_Level", bse_Dict.Dict_Level);
             }
             if (bse_Dict.Dict_IsEditable == 0)
             {
            idb.AddParameter("@Dict_IsEditable", 0);
             }
             else
             {
            idb.AddParameter("@Dict_IsEditable", bse_Dict.Dict_IsEditable);
             }
             if (bse_Dict.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Dict.Stat);
             }
             if (bse_Dict.Dict_Order == 0)
             {
            idb.AddParameter("@Dict_Order", 0);
             }
             else
             {
            idb.AddParameter("@Dict_Order", bse_Dict.Dict_Order);
             }

             return idb.ExeCmd(sql);
        }
コード例 #9
0
ファイル: ADOBse_Dict.cs プロジェクト: youthjoy/cshelper
        /// <summary>
        /// 更新数据字典 Bse_Dict对象(即:一条记录
        /// </summary>
        public int Update(Bse_Dict bse_Dict)
        {
            StringBuilder sbParameter=new StringBuilder();
              StringBuilder sb=new StringBuilder();
              sb.Append(@"UPDATE       Bse_Dict       SET ");
            if(bse_Dict.Dict_Key_IsChanged){sbParameter.Append("Dict_Key=@Dict_Key, ");}
              if(bse_Dict.Dict_Code_IsChanged){sbParameter.Append("Dict_Code=@Dict_Code, ");}
              if(bse_Dict.Dict_Name_IsChanged){sbParameter.Append("Dict_Name=@Dict_Name, ");}
              if(bse_Dict.Dict_PCode_IsChanged){sbParameter.Append("Dict_PCode=@Dict_PCode, ");}
              if(bse_Dict.Dict_PName_IsChanged){sbParameter.Append("Dict_PName=@Dict_PName, ");}
              if(bse_Dict.Dict_Desp_IsChanged){sbParameter.Append("Dict_Desp=@Dict_Desp, ");}
              if(bse_Dict.Dict_SCode_IsChanged){sbParameter.Append("Dict_SCode=@Dict_SCode, ");}
              if(bse_Dict.Dict_Bak_IsChanged){sbParameter.Append("Dict_Bak=@Dict_Bak, ");}
              if(bse_Dict.Dict_UDef1_IsChanged){sbParameter.Append("Dict_UDef1=@Dict_UDef1, ");}
              if(bse_Dict.Dict_UDef2_IsChanged){sbParameter.Append("Dict_UDef2=@Dict_UDef2, ");}
              if(bse_Dict.Dict_UDef3_IsChanged){sbParameter.Append("Dict_UDef3=@Dict_UDef3, ");}
              if(bse_Dict.Dict_UDef4_IsChanged){sbParameter.Append("Dict_UDef4=@Dict_UDef4, ");}
              if(bse_Dict.Dict_UDef5_IsChanged){sbParameter.Append("Dict_UDef5=@Dict_UDef5, ");}
              if(bse_Dict.Dict_Level_IsChanged){sbParameter.Append("Dict_Level=@Dict_Level, ");}
              if(bse_Dict.Dict_IsEditable_IsChanged){sbParameter.Append("Dict_IsEditable=@Dict_IsEditable, ");}
              if(bse_Dict.Stat_IsChanged){sbParameter.Append("Stat=@Stat, ");}
              if(bse_Dict.Dict_Order_IsChanged){sbParameter.Append("Dict_Order=@Dict_Order ");}
          sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
              sb.Append(      " WHERE 1=1 AND ((Stat is null) or (Stat=0))   and Dict_ID=@Dict_ID; " );
              string sql=sb.ToString();
             if(bse_Dict.Dict_Key_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_Key))
             {
            idb.AddParameter("@Dict_Key", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Key", bse_Dict.Dict_Key);
             }
              }
             if(bse_Dict.Dict_Code_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_Code))
             {
            idb.AddParameter("@Dict_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Code", bse_Dict.Dict_Code);
             }
              }
             if(bse_Dict.Dict_Name_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_Name))
             {
            idb.AddParameter("@Dict_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Name", bse_Dict.Dict_Name);
             }
              }
             if(bse_Dict.Dict_PCode_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_PCode))
             {
            idb.AddParameter("@Dict_PCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_PCode", bse_Dict.Dict_PCode);
             }
              }
             if(bse_Dict.Dict_PName_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_PName))
             {
            idb.AddParameter("@Dict_PName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_PName", bse_Dict.Dict_PName);
             }
              }
             if(bse_Dict.Dict_Desp_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_Desp))
             {
            idb.AddParameter("@Dict_Desp", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Desp", bse_Dict.Dict_Desp);
             }
              }
             if(bse_Dict.Dict_SCode_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_SCode))
             {
            idb.AddParameter("@Dict_SCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_SCode", bse_Dict.Dict_SCode);
             }
              }
             if(bse_Dict.Dict_Bak_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_Bak))
             {
            idb.AddParameter("@Dict_Bak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Bak", bse_Dict.Dict_Bak);
             }
              }
             if(bse_Dict.Dict_UDef1_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef1))
             {
            idb.AddParameter("@Dict_UDef1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef1", bse_Dict.Dict_UDef1);
             }
              }
             if(bse_Dict.Dict_UDef2_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef2))
             {
            idb.AddParameter("@Dict_UDef2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef2", bse_Dict.Dict_UDef2);
             }
              }
             if(bse_Dict.Dict_UDef3_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef3))
             {
            idb.AddParameter("@Dict_UDef3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef3", bse_Dict.Dict_UDef3);
             }
              }
             if(bse_Dict.Dict_UDef4_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef4))
             {
            idb.AddParameter("@Dict_UDef4", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef4", bse_Dict.Dict_UDef4);
             }
              }
             if(bse_Dict.Dict_UDef5_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef5))
             {
            idb.AddParameter("@Dict_UDef5", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef5", bse_Dict.Dict_UDef5);
             }
              }
             if(bse_Dict.Dict_Level_IsChanged)
             {
             if (bse_Dict.Dict_Level == 0)
             {
            idb.AddParameter("@Dict_Level", 0);
             }
             else
             {
            idb.AddParameter("@Dict_Level", bse_Dict.Dict_Level);
             }
              }
             if(bse_Dict.Dict_IsEditable_IsChanged)
             {
             if (bse_Dict.Dict_IsEditable == 0)
             {
            idb.AddParameter("@Dict_IsEditable", 0);
             }
             else
             {
            idb.AddParameter("@Dict_IsEditable", bse_Dict.Dict_IsEditable);
             }
              }
             if(bse_Dict.Stat_IsChanged)
             {
             if (bse_Dict.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Dict.Stat);
             }
              }
             if(bse_Dict.Dict_Order_IsChanged)
             {
             if (bse_Dict.Dict_Order == 0)
             {
            idb.AddParameter("@Dict_Order", 0);
             }
             else
             {
            idb.AddParameter("@Dict_Order", bse_Dict.Dict_Order);
             }
              }

             idb.AddParameter("@Dict_ID", bse_Dict.Dict_ID);

            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = string.Empty;
            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                  param.Add(item.Key, item.Value);
            }

            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }
            finally
            {
                SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex);
            }            return Re;
コード例 #10
0
ファイル: ADOBse_Dict.cs プロジェクト: youthjoy/cshelper
        /// <summary>
        /// 添加数据字典 Bse_Dict对象(即:一条记录)
        /// </summary>
        public int Add(Bse_Dict bse_Dict)
        {
            string sql = "INSERT INTO Bse_Dict (Dict_Key,Dict_Code,Dict_Name,Dict_PCode,Dict_PName,Dict_Desp,Dict_SCode,Dict_Bak,Dict_UDef1,Dict_UDef2,Dict_UDef3,Dict_UDef4,Dict_UDef5,Dict_Level,Dict_IsEditable,Stat,Dict_Order) VALUES (@Dict_Key,@Dict_Code,@Dict_Name,@Dict_PCode,@Dict_PName,@Dict_Desp,@Dict_SCode,@Dict_Bak,@Dict_UDef1,@Dict_UDef2,@Dict_UDef3,@Dict_UDef4,@Dict_UDef5,@Dict_Level,@Dict_IsEditable,@Stat,@Dict_Order)";
             if (string.IsNullOrEmpty(bse_Dict.Dict_Key))
             {
            idb.AddParameter("@Dict_Key", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Key", bse_Dict.Dict_Key);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_Code))
             {
            idb.AddParameter("@Dict_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Code", bse_Dict.Dict_Code);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_Name))
             {
            idb.AddParameter("@Dict_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Name", bse_Dict.Dict_Name);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_PCode))
             {
            idb.AddParameter("@Dict_PCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_PCode", bse_Dict.Dict_PCode);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_PName))
             {
            idb.AddParameter("@Dict_PName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_PName", bse_Dict.Dict_PName);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_Desp))
             {
            idb.AddParameter("@Dict_Desp", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Desp", bse_Dict.Dict_Desp);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_SCode))
             {
            idb.AddParameter("@Dict_SCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_SCode", bse_Dict.Dict_SCode);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_Bak))
             {
            idb.AddParameter("@Dict_Bak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Bak", bse_Dict.Dict_Bak);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef1))
             {
            idb.AddParameter("@Dict_UDef1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef1", bse_Dict.Dict_UDef1);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef2))
             {
            idb.AddParameter("@Dict_UDef2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef2", bse_Dict.Dict_UDef2);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef3))
             {
            idb.AddParameter("@Dict_UDef3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef3", bse_Dict.Dict_UDef3);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef4))
             {
            idb.AddParameter("@Dict_UDef4", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef4", bse_Dict.Dict_UDef4);
             }
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef5))
             {
            idb.AddParameter("@Dict_UDef5", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef5", bse_Dict.Dict_UDef5);
             }
             if (bse_Dict.Dict_Level == 0)
             {
            idb.AddParameter("@Dict_Level", 0);
             }
             else
             {
            idb.AddParameter("@Dict_Level", bse_Dict.Dict_Level);
             }
             if (bse_Dict.Dict_IsEditable == 0)
             {
            idb.AddParameter("@Dict_IsEditable", 0);
             }
             else
             {
            idb.AddParameter("@Dict_IsEditable", bse_Dict.Dict_IsEditable);
             }
             if (bse_Dict.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Dict.Stat);
             }
             if (bse_Dict.Dict_Order == 0)
             {
            idb.AddParameter("@Dict_Order", 0);
             }
             else
             {
            idb.AddParameter("@Dict_Order", bse_Dict.Dict_Order);
             }

            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = string.Empty;
            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                  param.Add(item.Key, item.Value);
            }

            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }
            finally
            {
                SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex);
             }            return Re;
        }
コード例 #11
0
ファイル: DictController.cs プロジェクト: huaminglee/hfoa
        /// <summary>
        /// 添加和更新操作
        /// </summary>
        /// <param name="dict"></param>
        /// <returns></returns>
        public ActionResult DictOperation(Bse_Dict dict)
        {
            var flag = false;
            //如果Dict_ID 为0,则表示为添加
            if (dict.Dict_ID == 0)
            {
                //Bse_Dict PNode = dictInstance.GetModel(" AND Dict_Code='" + dict.Dict_PCode + "' AND Dict_Key='" + dict.Dict_Key + "'");
                var order = 0;
                //dict.Dict_Code = dictInstance.CreateDictNode(PNode, false, ref order);
                flag = dictInstance.Insert(dict);
                TempDictList = new List<Bse_Dict>();
                //添加日志
                this.OpLog(dict.Dict_Key, "添加:编码:" + dict.Dict_Name + "数据", flag.ToString());
            }
            else
            {
                flag = dictInstance.Update(dict);
                //添加日志
                this.OpLog(dict.Dict_Key, "修改:编码:" + dict.Dict_Name + "数据", flag.ToString());
            }

            Cache.CacheHelper.Remove(MakeDictCacheKey(dict.Dict_Key));

            if (flag)
            {
                return Json(new { result = "success", target = dict });
            }
            else
            {
                return Json(new { result = "fail" });
            }

            //return View();
        }
コード例 #12
0
ファイル: Bll_Bse_Dict.cs プロジェクト: huaminglee/hfoa
        private void GenerateChild(Bse_Dict dict, List<Bse_Dict> allData)
        {
            dict.ChildDictList = allData.Where(o => o.Dict_PCode.ToUpper() == dict.Dict_Code.ToUpper());

            if (dict.ChildDictList.Count() == 0)
            {
                return;
            }

            foreach (var d in dict.ChildDictList)
            {
                GenerateChild(d, allData);
            }
        }
コード例 #13
0
ファイル: DictController.cs プロジェクト: huaminglee/hfoa
        /// <summary>
        /// 生成节点
        /// </summary>
        /// <param name="parentCode"></param>
        /// <returns></returns>
        public ActionResult CreateNode(string parentCode, string itype)
        {
            int order = 0;
            if (parentCode.Contains("temp"))
            {
                parentCode = parentCode.Split('_')[1];
            }
            var dictNode = dictInstance.GetModelByCode(parentCode, itype);

            string newCode = string.Empty;

            bool IsChildNode = false;
            //如果是根节点则可以添加
            if (dictNode.Dict_Order == 0)
            {
                IsChildNode = false;
                newCode = dictInstance.CreateDictNode(dictNode, IsChildNode, ref order);
            }//不是根节点则判断是否允许层级
            else
            {
                bool isLevel = dictInstance.IsAllowLevel(dictNode.Dict_Key);
                if (isLevel)
                {
                    IsChildNode = true;
                    newCode = dictInstance.CreateDictNode(dictNode, IsChildNode, ref order);
                }

            }

            if (!string.IsNullOrEmpty(newCode))
            {
                var model = new Bse_Dict()
                {
                    Dict_Code = newCode,
                    Dict_Key = dictNode.Dict_Key,
                    Dict_Order = order,
                    Dict_PCode = parentCode.ToUpper()
                };

                TempDictList.Add(model);
                return Json(new { Dict_Code = newCode, Dict_Key = dictNode.Dict_Key, Dict_Order = order, Dict_PCode = parentCode.ToUpper(), result = "success" });
            }
            else
            {
                return Json(new { result = "fail" });
            }
        }
コード例 #14
0
ファイル: DictController.cs プロジェクト: huaminglee/hfoa
        //获取节点信息
        public ActionResult GetNode(string nodeCode, string nodeKey)
        {
            Bse_Dict dict = new Bse_Dict();
            if (nodeCode.Contains("temp_"))
            {
                //var tmp = TempDictList.Where(o => o.Dict_Code == nodeCode.Split('_')[1]);
                //if (tmp.Count() > 0)
                //{
                //    dict = tmp.First();
                //}
                //else
                //{

                //}
                var newNodeCode = nodeCode.Split('_')[1];
                dict = dictInstance.GetModelByCode(newNodeCode, nodeKey);
            }
            else
            {
                dict = dictInstance.GetModelByCode(nodeCode, nodeKey);
            }

            var result = new JsonResult() { Data = new { result = "success", data = dict } };

            return result;
        }
コード例 #15
0
ファイル: ADOBse_Dict.cs プロジェクト: huaminglee/hfoa
        /// <summary>
        /// 更新数据字典 Bse_Dict对象(即:一条记录
        /// </summary>
        public int Update(Bse_Dict bse_Dict)
        {
            StringBuilder sbParameter=new StringBuilder();
              StringBuilder sb=new StringBuilder();
              sb.Append(@"UPDATE       Bse_Dict       SET ");
            if(bse_Dict.Dict_Key_IsChanged){sbParameter.Append("Dict_Key=@Dict_Key, ");}
              if(bse_Dict.Dict_Code_IsChanged){sbParameter.Append("Dict_Code=@Dict_Code, ");}
              if(bse_Dict.Dict_Name_IsChanged){sbParameter.Append("Dict_Name=@Dict_Name, ");}
              if(bse_Dict.Dict_PCode_IsChanged){sbParameter.Append("Dict_PCode=@Dict_PCode, ");}
              if(bse_Dict.Dict_PName_IsChanged){sbParameter.Append("Dict_PName=@Dict_PName, ");}
              if(bse_Dict.Dict_Desp_IsChanged){sbParameter.Append("Dict_Desp=@Dict_Desp, ");}
              if(bse_Dict.Dict_SCode_IsChanged){sbParameter.Append("Dict_SCode=@Dict_SCode, ");}
              if(bse_Dict.Dict_Bak_IsChanged){sbParameter.Append("Dict_Bak=@Dict_Bak, ");}
              if(bse_Dict.Dict_UDef1_IsChanged){sbParameter.Append("Dict_UDef1=@Dict_UDef1, ");}
              if(bse_Dict.Dict_UDef2_IsChanged){sbParameter.Append("Dict_UDef2=@Dict_UDef2, ");}
              if(bse_Dict.Dict_UDef3_IsChanged){sbParameter.Append("Dict_UDef3=@Dict_UDef3, ");}
              if(bse_Dict.Dict_UDef4_IsChanged){sbParameter.Append("Dict_UDef4=@Dict_UDef4, ");}
              if(bse_Dict.Dict_UDef5_IsChanged){sbParameter.Append("Dict_UDef5=@Dict_UDef5, ");}
              if(bse_Dict.Dict_Level_IsChanged){sbParameter.Append("Dict_Level=@Dict_Level, ");}
              if(bse_Dict.Dict_IsEditable_IsChanged){sbParameter.Append("Dict_IsEditable=@Dict_IsEditable, ");}
              if(bse_Dict.Stat_IsChanged){sbParameter.Append("Stat=@Stat, ");}
              if(bse_Dict.Dict_Order_IsChanged){sbParameter.Append("Dict_Order=@Dict_Order ");}
          sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
              sb.Append(      " WHERE 1=1 AND ((Stat is null) or (Stat=0))   and Dict_ID=@Dict_ID; " );
              string sql=sb.ToString();
             if(bse_Dict.Dict_Key_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_Key))
             {
            idb.AddParameter("@Dict_Key", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Key", bse_Dict.Dict_Key);
             }
              }
             if(bse_Dict.Dict_Code_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_Code))
             {
            idb.AddParameter("@Dict_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Code", bse_Dict.Dict_Code);
             }
              }
             if(bse_Dict.Dict_Name_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_Name))
             {
            idb.AddParameter("@Dict_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Name", bse_Dict.Dict_Name);
             }
              }
             if(bse_Dict.Dict_PCode_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_PCode))
             {
            idb.AddParameter("@Dict_PCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_PCode", bse_Dict.Dict_PCode);
             }
              }
             if(bse_Dict.Dict_PName_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_PName))
             {
            idb.AddParameter("@Dict_PName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_PName", bse_Dict.Dict_PName);
             }
              }
             if(bse_Dict.Dict_Desp_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_Desp))
             {
            idb.AddParameter("@Dict_Desp", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Desp", bse_Dict.Dict_Desp);
             }
              }
             if(bse_Dict.Dict_SCode_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_SCode))
             {
            idb.AddParameter("@Dict_SCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_SCode", bse_Dict.Dict_SCode);
             }
              }
             if(bse_Dict.Dict_Bak_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_Bak))
             {
            idb.AddParameter("@Dict_Bak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_Bak", bse_Dict.Dict_Bak);
             }
              }
             if(bse_Dict.Dict_UDef1_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef1))
             {
            idb.AddParameter("@Dict_UDef1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef1", bse_Dict.Dict_UDef1);
             }
              }
             if(bse_Dict.Dict_UDef2_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef2))
             {
            idb.AddParameter("@Dict_UDef2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef2", bse_Dict.Dict_UDef2);
             }
              }
             if(bse_Dict.Dict_UDef3_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef3))
             {
            idb.AddParameter("@Dict_UDef3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef3", bse_Dict.Dict_UDef3);
             }
              }
             if(bse_Dict.Dict_UDef4_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef4))
             {
            idb.AddParameter("@Dict_UDef4", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef4", bse_Dict.Dict_UDef4);
             }
              }
             if(bse_Dict.Dict_UDef5_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Dict.Dict_UDef5))
             {
            idb.AddParameter("@Dict_UDef5", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dict_UDef5", bse_Dict.Dict_UDef5);
             }
              }
             if(bse_Dict.Dict_Level_IsChanged)
             {
             if (bse_Dict.Dict_Level == 0)
             {
            idb.AddParameter("@Dict_Level", 0);
             }
             else
             {
            idb.AddParameter("@Dict_Level", bse_Dict.Dict_Level);
             }
              }
             if(bse_Dict.Dict_IsEditable_IsChanged)
             {
             if (bse_Dict.Dict_IsEditable == 0)
             {
            idb.AddParameter("@Dict_IsEditable", 0);
             }
             else
             {
            idb.AddParameter("@Dict_IsEditable", bse_Dict.Dict_IsEditable);
             }
              }
             if(bse_Dict.Stat_IsChanged)
             {
             if (bse_Dict.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Dict.Stat);
             }
              }
             if(bse_Dict.Dict_Order_IsChanged)
             {
             if (bse_Dict.Dict_Order == 0)
             {
            idb.AddParameter("@Dict_Order", 0);
             }
             else
             {
            idb.AddParameter("@Dict_Order", bse_Dict.Dict_Order);
             }
              }

             idb.AddParameter("@Dict_ID", bse_Dict.Dict_ID);

             return idb.ExeCmd(sql);
コード例 #16
0
ファイル: DocController.cs プロジェクト: youthjoy/qxhelper
 public void GeneratePath(Bse_Dict current, List<Bse_Dict> allData, StringBuilder sb)
 {
     var temp = allData.FirstOrDefault(o => o.Dict_Code == current.Dict_PCode);
     if (temp != null)
     {
         GeneratePath(temp, allData, sb);
         sb.AppendFormat("\\{0}", temp.Dict_Name);
     }
     else
     {
         return;
     }
 }
コード例 #17
0
ファイル: Bll_Comm.cs プロジェクト: huaminglee/hfoa
 private void FindDictChild(Bse_Dict model, List<Bse_Dict> all, ref List<Bse_Dict> ResultList)
 {
     var child = all.Where(o => o.Dict_PCode == model.Dict_Code);
     if (child.Count() == 0)
     {
         return;
     }
     foreach (var item in child)
     {
         ResultList.Add(item);
         FindDictChild(item, all, ref ResultList);
     }
 }
コード例 #18
0
ファイル: ComDict.cs プロジェクト: youthjoy/cshelper
        private void InitData()
        {
            if (!dcInstance.IsExsistDictKey(DataCode))
            {
                Bse_Dict dict = new Bse_Dict();
                dict.Dict_Code = DataCode;
                dict.Dict_Key = DataCode;
                dict.Dict_Name = DataName;
                dcInstance.AddDict(dict);
            }

            GridInit();
        }