예제 #1
0
 protected void RGrid_SubSysCode_ItemCommand(object sender, GridCommandEventArgs e)
 {
     if (e.CommandName == "Del")
     {
         string subSysCodeId = Convert.ToString(e.CommandArgument);
         bool isDelete = false;
         Model.Log logModel = new Model.Log();
         logModel.OperationItem = "删除子类";
         logModel.Operator = user.UserInfo.UserID;
         logModel.OperationTime = DateTime.Now;
         try
         {
             Model.SysCodeDetail scdModel = new Model.SysCodeDetail();
             logModel.OperationDetail = "子类编号:" + scdModel.SYSCodeDetialID + " - 子类内容:" + scdModel.SYSCodeDetialContext;
             isDelete = scd.Delete(subSysCodeId);
             if (isDelete)
             {
                 logModel.Memo = "成功";
             }
             else
             {
                 logModel.Memo = "失败!";
             }
         }
         catch (Exception ex)
         {
             logModel.Memo = "异常:" + ex.Message;
         }
         finally
         {
             log.Add(logModel);
             if (isDelete)
             {
                 int delNo = -1;
                 List<Model.SysCodeDetail> sysCodeDetailList = (List<Model.SysCodeDetail>)ViewState["SubSysCodeList"];
                 for(int i =0;i<sysCodeDetailList.Count;i++)
                 {
                     string tstr = sysCodeDetailList[i].SYSCodeDetialID;
                     if (tstr.Equals(subSysCodeId))
                     {
                         delNo = i;
                         break;
                     }
                 }
                 if (delNo != -1)
                 {
                     sysCodeDetailList.RemoveAt(delNo);
                 }
                 RGrid_SubSysCode.DataSource = sysCodeDetailList;
                 RGrid_SubSysCode.DataBind();
                 RadScriptManager.RegisterStartupScript(Page, GetType(), "c1", "OpenAlert('恭喜!删除成功!');", true);
             }
             else
             {
                 RadScriptManager.RegisterStartupScript(Page, GetType(), "c2", "OpenAlert('抱歉!删除失败!<br />请检查该小类是否存在未移除的关联!');", true);
             }
         }
     }
 }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.SysCodeDetail DataRowToModel(DataRow row)
 {
     Model.SysCodeDetail model=new Model.SysCodeDetail();
     if (row != null)
     {
         if(row["SYSCodeID"]!=null)
         {
             model.SYSCodeID=row["SYSCodeID"].ToString();
         }
         if(row["SYSCodeDetialID"]!=null)
         {
             model.SYSCodeDetialID=row["SYSCodeDetialID"].ToString();
         }
         if(row["SYSCodeDetialContext"]!=null)
         {
             model.SYSCodeDetialContext=row["SYSCodeDetialContext"].ToString();
         }
         if(row["LastModifyTime"]!=null && row["LastModifyTime"].ToString()!="")
         {
             model.LastModifyTime=DateTime.Parse(row["LastModifyTime"].ToString());
         }
         if(row["IsValid"]!=null && row["IsValid"].ToString()!="")
         {
             if((row["IsValid"].ToString()=="1")||(row["IsValid"].ToString().ToLower()=="true"))
             {
                 model.IsValid=true;
             }
             else
             {
                 model.IsValid=false;
             }
         }
         if(row["Memo"]!=null)
         {
             model.Memo=row["Memo"].ToString();
         }
     }
     return model;
 }
예제 #3
0
        protected void Bt_Add_Click(object sender, EventArgs e)
        {
            string sysCodeDetailID = TB_SubCodeName.Text.Trim();
            string sysCodeDetailContext = TB_SubCodeContent.Text.Trim();
            bool isValid = RCB_Enable.SelectedValue.Trim() == "1" ? true : false;
            string memo = TB_SubCodeMemo.Text.Trim();
            string matchPass_SubCodeName = @"^[a-z0-9A-Z_-]{1,50}$";

            if (sysCodeDetailID == "" || !(Regex.IsMatch(sysCodeDetailID, matchPass_SubCodeName)))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉!添加失败!代码编号必须为1-50个字符(可以包含英文、数字和下划线)!');", true);
                return;
            }
            if (sysCodeDetailContext == "")
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('抱歉!添加失败!代码内容必须为1-50个字符!');", true);
                return;
            }
            BLL.SysCodeDetail scd = new BLL.SysCodeDetail();
            if (scd.Exists(sysCodeDetailID))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('抱歉!添加失败!代码编号已存在!');", true);
                return;
            }
            Model.SysCodeDetail scdModel = new Model.SysCodeDetail();
            scdModel.SYSCodeID = sysCodeId;
            scdModel.SYSCodeDetialID = sysCodeDetailID;
            scdModel.SYSCodeDetialContext = sysCodeDetailContext;
            scdModel.Memo = memo;
            scdModel.LastModifyTime = DateTime.Now;
            scdModel.IsValid = isValid;
            bool isSubAdd = false;
            Model.Log logModel = new Model.Log();
            try
            {
                logModel.OperationItem = "添加子类";
                logModel.Operator = user.UserInfo.UserID;
                logModel.OperationTime = DateTime.Now;
                logModel.OperationDetail = "大类编号:" + sysCodeId + " - 子类编号:" + sysCodeDetailID + " - 子类内容:" + sysCodeDetailContext;

                isSubAdd = scd.Add(scdModel);
                if (isSubAdd)
                {
                    logModel.Memo = "成功";
                }
                else
                {
                    logModel.Memo = "失败!";
                }
            }
            catch (Exception ex)
            {
                logModel.Memo = "异常:" + ex.Message;
            }
            finally
            {
                log.Add(logModel);
                if (isSubAdd)
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('恭喜!添加成功!');", true);
                }
                else
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('抱歉!添加失败!');", true);
                }
            }
        }
예제 #4
0
        private bool ReadValue()
        {
            string SubCodeName = subSysCodeId;
            BLL.SysCodeDetail scd = new BLL.SysCodeDetail();
            Model.SysCodeDetail scdModel = new Model.SysCodeDetail();
            scdModel = scd.GetModel(SubCodeName);
            if (scdModel == null)
                return false;
            Lb_SubCodeName.Text = scdModel.SYSCodeDetialID;
            TB_SubCodeContent.Text = scdModel.SYSCodeDetialContext;
            RCB_Enable.SelectedValue = scdModel.IsValid ? "1" : "0";
            TB_SubCodeMemo.Text = scdModel.Memo;
            Model.SysCode scModel =  sc.GetModel(scdModel.SYSCodeID);
            if (scModel != null)
            {
                HL_SysCodeName.Text = scModel.SYSCodeContext;
                HL_SysCodeName.NavigateUrl = "SubSysCodeList.aspx?SysCodeId=" + scModel.SYSCodeID.Trim();
            }
            HL_SubSysCodeName.Text = scdModel.SYSCodeDetialContext;
            HL_SubSysCodeName.NavigateUrl = "SubSysCodeDetail.aspx?subSysCodeId=" + scdModel.SYSCodeDetialID.Trim();

            //if (syscodeType.codeId == "SysUser")
               //     Response.Redirect("SysUserDetail.aspx?LoginID=" + SubCodeName);
            return true;
        }
 private void Bind_DDL_SysCodeList()
 {
     Model.SysCodeDetail scdModel = new Model.SysCodeDetail();
     scdModel = scd.GetModel(subSysCodeId);
     DataSet ds = new DataSet();
     ds = sc.GetAllList();
     if (ds == null)
         return;
     RCB_SysCodeList.Items.Clear();
     string sysCodeID = scdModel.SYSCodeID;
     DataTable sysCodeList = ds.Tables[0];
     for (int i = 0; i < sysCodeList.Rows.Count; i++)
     {
         if (sysCodeList.Rows[i][0].ToString().Equals(sysCodeID))
             continue;       //当前小类所属大类不在列表范围之中
         RCB_SysCodeList.Items.Add(new RadComboBoxItem(sysCodeList.Rows[i][1].ToString(), sysCodeList.Rows[i][0].ToString()));
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     _user = SessionUser.GetSession();
     if (!IsPostBack)
     {
         List<Model.SysCodeDetail> scdList = scd.GetModelList(0, "UserBehavior", -1, -1, false);
         SmartLaw.Model.SysCodeDetail scdM = new Model.SysCodeDetail();
         scdM.SYSCodeDetialID = "-1";
         scdM.Memo = "不限";
         scdList.Insert(0, scdM);
         RCB_Behaviour.DataTextField = "Memo";
         RCB_Behaviour.DataValueField = "SYSCodeDetialID";
         RCB_Behaviour.DataSource = scdList;
         RCB_Behaviour.DataBind();
         RGrid_List.Visible = false;
     }
 }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            user = SessionUser.GetSession();
            //user.ValidateAuthority("Auth_News_Retrieve");
            if (!user.hasAuthority("Auth_News_Add"))
            {
                href1.Visible = false;
            }
            if (!user.hasAuthority("Auth_News_Examine"))
            {
                A1.Visible = false;
            }
            if (!IsPostBack)
            {
                RGrid_NewsList.Visible = false;
                //初始化分类选择下拉树
                List<Model.Category> cgList = cg.DataTableToList(cg.GetList(5, "1", -1, 0, false).Tables[0]);
                cgList.RemoveAll(CT => !CT.Memo.Contains("R"));
                DataTable table = new DataTable();
                table.Columns.Add("AutoID");
                table.Columns.Add("ParentCategoryID");
                table.Columns.Add("CategoryName");
                foreach (Model.Category cgm in cgList)
                {
                    if (cgm.ParentCategoryID == -1)
                    {
                        table.Rows.Add(new String[] { cgm.AutoID.ToString(), null, cgm.CategoryName });
                    }
                    else
                    {
                        table.Rows.Add(new String[] { cgm.AutoID.ToString(), cgm.ParentCategoryID.ToString(), cgm.CategoryName });
                    }
                }
                RadDropDownTree2.DataFieldID = "AutoID";
                RadDropDownTree2.DataFieldParentID = "ParentCategoryID";
                RadDropDownTree2.DataValueField = "AutoID";
                RadDropDownTree2.DataTextField = "CategoryName";
                RadDropDownTree2.DataSource = table;
                RadDropDownTree2.DataBind();
                RadTreeView categoryTreeView = RadDropDownTree2.Controls[0] as RadTreeView;
                //categoryTreeView.Nodes[0].Expanded = true;
                categoryTreeView.ShowLineImages = false;

                List<Model.SysCodeDetail> dataSoucerList = scd.GetModelList(0, "DataSource", -1, -1, false);
                dataSoucerList.RemoveAll(rt => rt.IsValid == false);
                Model.SysCodeDetail dsModel = new Model.SysCodeDetail();
                dsModel.SYSCodeDetialID = "0";
                dsModel.SYSCodeDetialContext = "不限";
                dataSoucerList.Insert(0, dsModel);
                RCB_DataSource.DataValueField = "SYSCodeDetialID";
                RCB_DataSource.DataTextField = "SYSCodeDetialContext";
                RCB_DataSource.DataSource = dataSoucerList;
                RCB_DataSource.DataBind();

                List<Model.SysUser> suList = su.GetModelList(-1, "", -1, 4, true);
                Model.SysUser sm = new Model.SysUser();
                sm.UserID = "0";
                sm.UserName = "******";
                suList.Insert(0, sm);
                suList.ForEach(st => st.UserName = st.UserName + " [" + st.UserID + "]");
                RCB_Publisher.DataValueField = "UserID";
                RCB_Publisher.DataTextField = "USerName";
                RCB_Publisher.DataSource = suList;
                RCB_Publisher.DataBind();
                RCB_Publisher.SelectedValue = user.UserInfo.UserID;
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.SysCodeDetail GetModel(string SYSCodeDetialID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select SYSCodeID,SYSCodeDetialID,SYSCodeDetialContext,LastModifyTime,IsValid,Memo from T_SYSCODEDETIAL");
            strSql.Append(" where SYSCodeDetialID=@SYSCodeDetialID limit 1");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@SYSCodeDetialID", MySqlDbType.VarChar,50)			};
            parameters[0].Value = SYSCodeDetialID;

            Model.SysCodeDetail model=new Model.SysCodeDetail();
            DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }