コード例 #1
0
        /// <summary>
        /// 加载模块
        /// </summary>
        private void LoadModule()
        {
            ModuleEO mdEO = new ModuleEO();

            mdEO = mdManage.GetModuleByPK(Request.QueryString["ModuleID"]);
            if (!string.IsNullOrEmpty(mdEO.MdName))
            {
                this.lblMdPartentName.Text    = mdEO.MdParentid;
                this.txtMdName.Text           = mdEO.MdName;
                this.hfMdName.Value           = mdEO.MdName;
                this.txtAddress.Text          = mdEO.MdAddress;
                this.ddlPf.SelectedValue      = mdEO.PfId;
                this.txtNotes.Text            = mdEO.MdNotes;
                this.txtSort.Text             = mdEO.MdFiledOrder.ToString();
                this.rblMdExist.SelectedValue = mdEO.MdExistsTreeView;
                this.rblState.SelectedValue   = mdEO.MdUseFlag;


                this.txtMdName_en.Text = mdEO.MdText1; //英文

                if (mdEO.MdParentid == "0")            //加载父模块信息
                {
                    this.ddlPf.Enabled = true;
                    iUpdateState       = 0;
                }
                else //加载子模块信息
                {
                    this.ddlPf.Enabled = false;
                    iUpdateState       = 1;
                }
            }
        }
コード例 #2
0
ファイル: Module.cs プロジェクト: tryingjyg/cms_manage
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name = "item">要更新的实体对象</param>
        /// <param name="tm">事务管理对象</param>
        /// <return>受影响的行数</return>
        public virtual int UpdateModule(ModuleEO item, TransactionManager tm = null)
        {
            const string sql = @"UPDATE module SET Md_name=@Md_name, Md_parentid=@Md_parentid, Md_address=@Md_address, Pf_id=@Pf_id, 
Md_useFlag=@Md_useFlag, Md_notes=@Md_notes, Md_deleteFlag=@Md_deleteFlag, Md_addTime=@Md_addTime, Md_existsTreeView=@Md_existsTreeView, 
Md_filedOrder=@Md_filedOrder, Md_imgUrl=@Md_imgUrl, Md_text1=@Md_text1, Md_text2=@Md_text2 WHERE Md_id=@Md_id";

            return(Database.CreateSqlDao(sql)
                   .AddInParameter("@Md_id", item.MdId, DbType.String, 50)
                   .AddInParameter("@Md_name", item.MdName, DbType.String, 100)
                   .AddInParameter("@Md_parentid", item.MdParentid, DbType.String, 50)
                   .AddInParameter("@Md_address", item.MdAddress != null ? (object)item.MdAddress : DBNull.Value, DbType.String, 200)
                   .AddInParameter("@Pf_id", item.PfId, DbType.String, 50)
                   .AddInParameter("@Md_useFlag", item.MdUseFlag, DbType.AnsiStringFixedLength, 1)
                   .AddInParameter("@Md_notes", item.MdNotes != null ? (object)item.MdNotes : DBNull.Value, DbType.String, 500)
                   .AddInParameter("@Md_deleteFlag", item.MdDeleteFlag, DbType.AnsiStringFixedLength, 1)
                   .AddInParameter("@Md_addTime", item.MdAddTime, DbType.DateTime, 8)
                   .AddInParameter("@Md_existsTreeView", item.MdExistsTreeView, DbType.AnsiStringFixedLength, 1)
                   .AddInParameter("@Md_filedOrder", item.MdFiledOrder != null ? (object)item.MdFiledOrder : DBNull.Value, DbType.Int32, 4)
                   .AddInParameter("@Md_imgUrl", item.MdImgUrl != null ? (object)item.MdImgUrl : DBNull.Value, DbType.String, 200)
                   .AddInParameter("@Md_text1", item.MdText1 != null ? (object)item.MdText1 : DBNull.Value, DbType.String, 200)
                   .AddInParameter("@Md_text2", item.MdText2 != null ? (object)item.MdText2 : DBNull.Value, DbType.String, 200)
                   .ExecNonQuery(tm));
        }
コード例 #3
0
        /// <summary>
        /// 添加、修改数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (this.CheckForms() == false)
            {
                CloseDivImplementation();
                return;
            }
            if (this.CheckIsNum(this.txtSort.Text.Trim()) == false)
            {
                this.divAlert.Visible = true;
                this.lblAlert.Text    = Resources.Resource.Please_enter_a_sort_number;//"请输入排序数字";
                CloseDivImplementation();
                return;
            }

            ModuleEO            mdEO  = new ModuleEO();            //模块信息
            ModulepermissionsEO mdpEO = new ModulepermissionsEO(); //模块功能关系

            if (Request.QueryString["State"] == "U")
            {
                mdEO = mdManage.GetModuleByPK(Request.QueryString["ModuleID"]);
            }

            mdEO.MdName           = this.txtMdName.Text;
            mdEO.MdAddress        = this.txtAddress.Text;
            mdEO.PfId             = this.ddlPf.SelectedValue;
            mdEO.MdUseFlag        = this.rblState.SelectedValue;
            mdEO.MdNotes          = this.txtNotes.Text;
            mdEO.MdFiledOrder     = Convert.ToInt32(this.txtSort.Text.Trim()); //备用字段:模块排序
            mdEO.MdExistsTreeView = this.rblMdExist.SelectedValue;
            mdEO.MdImgUrl         = @"../Images/farmework/ico11.gif";
            mdEO.MdText1          = this.txtMdName_en.Text;//英文



            //创建父模块
            if (Request.QueryString["State"] == "AF")
            {
                //判断模块名称是否存在
                if (this.CheckModuleName() == false)
                {
                    //Jswork.Alert("父模块名称 " + this.txtMdName.Text.Trim() + " 已存在", this.Page);

                    this.divAlert.Visible = true;
                    this.lblAlert.Text    = this.ddlPf.SelectedItem.Text + Resources.Resource.Name_of_the_parent_module + this.txtMdName.Text.Trim() + Resources.Resource.Already_exist;
                    CloseDivImplementation();
                    return;
                }

                //模块信息数据
                mdEO.MdId         = GetBigGuid();
                mdEO.MdParentid   = "0";
                mdEO.MdDeleteFlag = "0";
                mdEO.MdAddTime    = DateTime.Now;

                //模块功能关系数据
                for (int i = 0; i < this.cblPermissionsTatal.Items.Count; i++)
                {
                    if (this.cblPermissionsTatal.Items[i].Selected)
                    {
                        mdpEO.MdId      = mdEO.MdId;
                        mdpEO.PmId      = this.cblPermissionsTatal.Items[i].Value;
                        mdpEO.MpUser    = GetUserID();
                        mdpEO.MpAddTime = DateTime.Now.ToShortTimeString();

                        mdpManage.AddModulePermissions(mdpEO);
                    }
                }

                if (mdManage.AddModule(mdEO) > 0)
                {
                    //插入操作日志
                    InsertLog(Resources.Resource.Create_parent_module, string.Format("modulename:{0},id:{1}", mdEO.MdName, mdEO.PfId), 16, GetPlatformIdByValue(1));
                    CloseDivImplementation();
                    Jswork.Alert(Resources.Resource.Parent_module_creates_success, "ModuleList.aspx");
                }
                else
                {
                    //Jswork.Alert("父模块创建失败", this.Page);
                    this.divAlert.Visible = true;
                    this.lblAlert.Text    = Resources.Resource.Parent_module_creates_success;
                }
            }

            //创建子模块
            if (Request.QueryString["State"] == "AC")
            {
                //判断模块名称是否存在
                if (this.CheckChildModuleName() == false)
                {
                    //Jswork.Alert("子模块名称 " + this.txtMdName.Text.Trim() + " 已存在", this.Page);

                    this.divAlert.Visible = true;
                    this.lblAlert.Text    = this.lblMdPartentName.Text + Resources.Resource.Neutron_module_name + this.txtMdName.Text.Trim() + Resources.Resource.Already_exist;
                    CloseDivImplementation();
                    return;
                }

                mdEO.MdId         = GetBigGuid();
                mdEO.MdParentid   = hfMdId.Value;
                mdEO.MdDeleteFlag = "0";
                mdEO.MdAddress    = this.txtAddress.Text.Trim();
                mdEO.MdAddTime    = DateTime.Now;

                //模块功能关系数据
                for (int i = 0; i < this.cblPermissionsTatal.Items.Count; i++)
                {
                    if (this.cblPermissionsTatal.Items[i].Selected)
                    {
                        mdpEO.MdId      = mdEO.MdId;
                        mdpEO.PmId      = this.cblPermissionsTatal.Items[i].Value;
                        mdpEO.MpUser    = GetUserID();
                        mdpEO.MpAddTime = DateTime.Now.ToString("yyyy-MM-dd");

                        mdpManage.AddModulePermissions(mdpEO);
                    }
                }

                if (mdManage.AddModule(mdEO) > 0)
                {
                    //插入操作日志
                    InsertLog(Resources.Resource.Create_sub_module, string.Format("modulename:{0},id:{1}", mdEO.MdName, mdEO.PfId), 16, GetPlatformIdByValue(1));
                    CloseDivImplementation();
                    Jswork.Alert(Resources.Resource.Sub_module_to_create_success, "ModuleList.aspx");
                }
                else
                {
                    //Jswork.Alert("子模块创建失败", this.Page);
                    this.divAlert.Visible = true;
                    this.lblAlert.Text    = Resources.Resource.Module_creation_failed;//"子模块创建失败";
                }
            }

            //修改模块
            if (Request.QueryString["State"] == "U")
            {
                //修改时判断模块名称是否存在
                if (this.hfMdName.Value != this.txtMdName.Text.Trim())
                {
                    if (iUpdateState == 0)
                    {
                        //判断模块名称是否存在
                        if (this.CheckModuleName() == false)
                        {
                            //Jswork.Alert("父模块名称 " + this.txtMdName.Text.Trim() + " 已存在", this.Page);

                            this.divAlert.Visible = true;
                            this.lblAlert.Text    = this.ddlPf.SelectedItem.Text + Resources.Resource.Name_of_the_parent_module + this.txtMdName.Text.Trim() + Resources.Resource.Already_exist;
                            CloseDivImplementation();
                            return;
                        }
                    }
                    else
                    {
                        //判断模块名称是否存在
                        if (this.CheckChildModuleName() == false)
                        {
                            //Jswork.Alert("子模块名称 " + this.txtMdName.Text.Trim() + " 已存在", this.Page);

                            this.divAlert.Visible = true;
                            this.lblAlert.Text    = this.lblMdPartentName.Text + Resources.Resource.Neutron_module_name + this.txtMdName.Text.Trim() + Resources.Resource.Already_exist;
                            CloseDivImplementation();
                            return;
                        }
                    }
                }

                //更改父模块平台ID时,所有子模块的平台ID一起更新
                if (iUpdateState == 0)
                {
                    mdManage.PutPfIdByPtId(this.hfMdId.Value, this.ddlPf.SelectedValue);
                }

                //模块功能关系数据
                mdpManage.RemoveByPK(Request.QueryString["ModuleID"]); //插入关系表数据前先删除数据
                for (int i = 0; i < this.cblPermissionsTatal.Items.Count; i++)
                {
                    if (this.cblPermissionsTatal.Items[i].Selected)
                    {
                        mdpEO.MdId      = mdEO.MdId;
                        mdpEO.PmId      = this.cblPermissionsTatal.Items[i].Value;
                        mdpEO.MpUser    = GetUserID();
                        mdpEO.MpAddTime = DateTime.Now.ToString("yyyy-MM-dd");

                        mdpManage.AddModulePermissions(mdpEO);
                    }
                }

                if (mdManage.EditModule(mdEO) > 0)
                {
                    //插入操作日志
                    InsertLog(Resources.Resource.Modify_module, string.Format("modulename:{0},id:{1}", mdEO.MdName, mdEO.PfId), 17, GetPlatformIdByValue(1));
                    CloseDivImplementation();
                    Jswork.Alert(Resources.Resource.Module_modification_success, "ModuleList.aspx");
                }
                else
                {
                    Jswork.Alert(Resources.Resource.Module_modification_failed, this.Page);
                }
            }
            CloseDivImplementation();
        }
コード例 #4
0
        protected int iUpdateState = 0; //更新状态0更新父模块 1更新子模块

        protected void Page_Load(object sender, EventArgs e)
        {
            GetAuthorityUrl(this.Page, "Module/ModuleList.aspx", 1);

            //this.btnOK.Attributes.Add("onclick", "javascript:if(confirm('是否继续录入?')){}else{return false;}");

            if (!IsPostBack)
            {
                this.LoadPlatform();
                this.LoadPermissionsTatal(this.ddlPf.SelectedValue);

                if (Request.QueryString["State"] != null)
                {
                    //新建父模块
                    if (Request.QueryString["State"] == "AF") //AddFather
                    {
                        this.trMdParent.Visible    = false;
                        this.trMdParent_en.Visible = false;
                        this.lblMdTitle.Text       = Resources.Resource.parent_module_name;// "父模块名称:";
                        this.lblMdTitle_en.Text    = "parent module name:";

                        //"父模块名称:";
                    }

                    //新建子模块
                    if (Request.QueryString["State"] == "AC") //AddChild
                    {
                        this.trMdParent.Visible = true;
                        trMdParent_en.Visible   = true;

                        this.lblMdPartentName.Text    = Request.QueryString["ParentName"];
                        this.lblMdPartentName_en.Text = Request.QueryString["MdText1"];    //传递过来英文的名称
                        this.hfMdId.Value             = Request.QueryString["ParentID"];
                        this.lblMdTitle.Text          = Resources.Resource.submodule_name; // "子模块名称:";

                        this.lblMdTitle_en.Text = "submodule:";

                        //"子模块名称:";



                        ModuleEO mdEO = new ModuleEO();

                        mdEO = mdManage.GetModuleByPK(this.hfMdId.Value);
                        if (!string.IsNullOrEmpty(mdEO.MdName))
                        {
                            this.ddlPf.SelectedValue = mdEO.PfId;
                            this.ddlPf.Enabled       = false;
                            this.LoadPermissionsTatal(this.ddlPf.SelectedValue);
                        }
                    }

                    //更新模块
                    if (Request.QueryString["State"] == "U")
                    {
                        this.trMdParent.Visible    = false;
                        this.trMdParent_en.Visible = false;
                        this.lblMdTitle.Text       = Resources.Resource.parentmodulename; //"模块名称";

                        this.lblMdTitle_en.Text = "module name:";
                        this.hfMdId.Value       = Request.QueryString["ModuleID"];
                        this.LoadModule();
                        this.LoadModulePermissions();
                    }
                }
            }
        }
コード例 #5
0
ファイル: ModuleManage.cs プロジェクト: tryingjyg/cms_manage
 /// <summary>
 /// 修改模块信息
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public int EditModule(ModuleEO item)
 {
     return(mdMO.UpdateModule(item));
 }
コード例 #6
0
ファイル: ModuleManage.cs プロジェクト: tryingjyg/cms_manage
 /// <summary>
 /// 创建模块信息
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public int AddModule(ModuleEO item)
 {
     return(mdMO.Add(item));
 }