Beispiel #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strErr = "";

        if (this.txtFunctionName.Text.Trim().Length == 0)
        {
            strErr += "功能名称不能为空!\\n";
        }
        if (this.txtFunctionDescription.Text.Trim().Length == 0)
        {
            strErr += "显示不能为空!\\n";
        }
        if (this.txtAssembly.Text.Trim().Length == 0)
        {
            strErr += "路径不能为空!\\n";
        }

        if (strErr != "")
        {
            return;
        }
        string FunctionName        = this.txtFunctionName.Text;
        string FunctionDescription = this.txtFunctionDescription.Text;
        string Type     = "web";
        string Assembly = this.txtAssembly.Text;

        zs.Model.Sys_Function model = new zs.Model.Sys_Function();
        model.FunctionName        = FunctionName;
        model.FunctionDescription = FunctionDescription;
        model.Type     = Type;
        model.Assembly = Assembly;

        bll.Add(model);
        BindData("1=1");
    }
Beispiel #2
0
    protected void gridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string id = gridView.DataKeys[e.RowIndex].Values[0].ToString();
        //string Sxh=GridView1.Rows[e.RowIndex].Cells[0].Text.Trim();
        string name  = ((TextBox)gridView.Rows[e.RowIndex].Cells[1].Controls[0]).Text.Trim();
        string desc  = ((TextBox)gridView.Rows[e.RowIndex].Cells[2].Controls[0]).Text.Trim();
        string assem = ((TextBox)gridView.Rows[e.RowIndex].Cells[3].Controls[0]).Text.Trim();

        zs.Model.Sys_Function model = bll.GetModel(int.Parse(id));
        model.FunctionName        = name;
        model.FunctionDescription = desc;
        model.Assembly            = assem;
        bll.Update(model);
        gridView.EditIndex = -1;
        BindData("1=1");
    }
Beispiel #3
0
    public string GetUserFunction()
    {
        string        uid = Request.Cookies["userId"].Value.ToString();
        StringBuilder sb  = new StringBuilder();
        int           rid = bllur.GetModelList("UserID=" + uid)[0].RoleID.Value;
        List <zs.Model.Sys_RoleFunction> modelrf = bllrf.GetModelList("RoleID=" + rid.ToString());

        foreach (zs.Model.Sys_RoleFunction ri in modelrf)
        {
            int fid = ri.FunctionID.Value;
            zs.Model.Sys_Function fun = bllf.GetModel(fid);
            sb.Append("<li>");
            sb.Append("<a href='" + fun.Assembly + "'><i class=\"icon-double-angle-right\"></i><span class=\"menu-text\">");
            sb.Append(fun.FunctionDescription);
            sb.Append("</span></a>");
            sb.Append("</li>\n\r");
        }
        return(sb.ToString());
    }
Beispiel #4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <zs.Model.Sys_Function> DataTableToList(DataTable dt)
        {
            List <zs.Model.Sys_Function> modelList = new List <zs.Model.Sys_Function>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                zs.Model.Sys_Function model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new zs.Model.Sys_Function();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["FunctionName"] != null && dt.Rows[n]["FunctionName"].ToString() != "")
                    {
                        model.FunctionName = dt.Rows[n]["FunctionName"].ToString();
                    }
                    if (dt.Rows[n]["FunctionDescription"] != null && dt.Rows[n]["FunctionDescription"].ToString() != "")
                    {
                        model.FunctionDescription = dt.Rows[n]["FunctionDescription"].ToString();
                    }
                    if (dt.Rows[n]["Type"] != null && dt.Rows[n]["Type"].ToString() != "")
                    {
                        model.Type = dt.Rows[n]["Type"].ToString();
                    }
                    if (dt.Rows[n]["Assembly"] != null && dt.Rows[n]["Assembly"].ToString() != "")
                    {
                        model.Assembly = dt.Rows[n]["Assembly"].ToString();
                    }
                    if (dt.Rows[n]["ValidateDate"] != null && dt.Rows[n]["ValidateDate"].ToString() != "")
                    {
                        model.ValidateDate = DateTime.Parse(dt.Rows[n]["ValidateDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(zs.Model.Sys_Function model)
 {
     return(dal.Update(model));
 }
Beispiel #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(zs.Model.Sys_Function model)
 {
     return(dal.Add(model));
 }