public Model_Sys_Function GetSys_FunctionModel(string FUNCTIONID)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select  top 1 FUNCTIONID,FUNCTIONName from Sys_Function ");
            builder.Append(" where FUNCTIONID=@FUNCTIONID ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@FUNCTIONID", SqlDbType.VarChar, 20) };
            cmdParms[0].Value = FUNCTIONID;
            Model_Sys_Function function = new Model_Sys_Function();
            DataSet            set      = DbHelperSQL.Query(builder.ToString(), cmdParms);

            if (set.Tables[0].Rows.Count <= 0)
            {
                return(null);
            }
            if ((set.Tables[0].Rows[0]["FUNCTIONID"] != null) && (set.Tables[0].Rows[0]["FUNCTIONID"].ToString() != ""))
            {
                function.FUNCTIONID = set.Tables[0].Rows[0]["FUNCTIONID"].ToString();
            }
            if ((set.Tables[0].Rows[0]["FUNCTIONName"] != null) && (set.Tables[0].Rows[0]["FUNCTIONName"].ToString() != ""))
            {
                function.FUNCTIONName = set.Tables[0].Rows[0]["FUNCTIONName"].ToString();
            }
            return(function);
        }
Exemple #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         Model_Sys_Function model = new Model_Sys_Function();
         BLL_Sys_Function   bll   = new BLL_Sys_Function();
         model.FUNCTIONID   = txtFunctionId.Text.Trim();
         model.FUNCTIONName = txtFunctionName.Text.Trim();
         if (hidCtrl.Value == "1")
         {
             bool result = bll.AddSys_Function(model);
             if (result)
             {
                 StringBuilder strLog = new StringBuilder();
                 strLog.AppendFormat("【添加功能】【ID】: {0}【功能名】:{1}", model.FUNCTIONID, model.FUNCTIONName);
                 new BLL_clsAuth().AddLogFromBS(Module_Id, strLog.ToString());
             }
         }
         else if (hidCtrl.Value == "2")
         {
             bool result = bll.UpdateSys_FunctionByID(model);
             if (result)
             {
                 StringBuilder strLog = new StringBuilder();
                 strLog.AppendFormat("【修改功能】【ID】: {0}【功能名】:{1}", model.FUNCTIONID, model.FUNCTIONName);
                 new BLL_clsAuth().AddLogFromBS(Module_Id, strLog.ToString());
             }
         }
     }
     catch (Exception ex)
     {
         new BLL_clsAuth().AddLogErrorFromBS(Module_Id, string.Format("类:{0},方法:{1},错误信息:{2}, 详细:{3}", ex.TargetSite.DeclaringType.ToString(), ex.TargetSite.Name.ToString(), ex.Message, ex.StackTrace));
         throw ex;
     }
 }
        public bool UpdateSys_FunctionByID(Model_Sys_Function model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update Sys_Function set ");
            builder.Append("FUNCTIONName=@FUNCTIONName");
            builder.Append(" where FUNCTIONID=@FUNCTIONID ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@FUNCTIONName", SqlDbType.VarChar, 20), new SqlParameter("@FUNCTIONID", SqlDbType.VarChar, 20) };
            cmdParms[0].Value = model.FUNCTIONName;
            cmdParms[1].Value = model.FUNCTIONID;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
        public bool AddSys_Function(Model_Sys_Function model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into Sys_Function(");
            builder.Append("FUNCTIONID,FUNCTIONName)");
            builder.Append(" values (");
            builder.Append("@FUNCTIONID,@FUNCTIONName)");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@FUNCTIONID", SqlDbType.VarChar, 20), new SqlParameter("@FUNCTIONName", SqlDbType.VarChar, 20) };
            cmdParms[0].Value = model.FUNCTIONID;
            cmdParms[1].Value = model.FUNCTIONName;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Exemple #5
0
        public Model_Sys_Function DataRowToModel(DataRow row)
        {
            Model_Sys_Function function = new Model_Sys_Function();

            if (row != null)
            {
                if (row["FUNCTIONID"] != null)
                {
                    function.FUNCTIONID = row["FUNCTIONID"].ToString();
                }
                if (row["FUNCTIONName"] != null)
                {
                    function.FUNCTIONName = row["FUNCTIONName"].ToString();
                }
            }
            return(function);
        }
Exemple #6
0
        public List <Model_Sys_Function> DataTableToList(DataTable dt)
        {
            List <Model_Sys_Function> list = new List <Model_Sys_Function>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_Sys_Function item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
        public List <Model_Sys_Function> DataTableToSys_FunctionModelList(DataTable dt)
        {
            List <Model_Sys_Function> list = new List <Model_Sys_Function>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_Sys_Function item = new Model_Sys_Function();
                    if ((dt.Rows[i]["FUNCTIONID"] != null) && (dt.Rows[i]["FUNCTIONID"].ToString() != ""))
                    {
                        item.FUNCTIONID = dt.Rows[i]["FUNCTIONID"].ToString();
                    }
                    if ((dt.Rows[i]["FUNCTIONName"] != null) && (dt.Rows[i]["FUNCTIONName"].ToString() != ""))
                    {
                        item.FUNCTIONName = dt.Rows[i]["FUNCTIONName"].ToString();
                    }
                    list.Add(item);
                }
            }
            return(list);
        }
 public bool UpdateSys_FunctionByID(Model_Sys_Function model)
 {
     return(this.dal.UpdateSys_FunctionByID(model));
 }
 public bool AddSys_Function(Model_Sys_Function model)
 {
     return(this.dal.AddSys_Function(model));
 }