示例#1
0
        /// <summary>
        /// 修改事件--保存到数据库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// 创 建 人:HNAS Framework 4.0 项目组
        /// 创建日期:2012/3/15 17:21:32
        /// 修 改 人:
        /// 修改日期:
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            if (ViewState["_subjectBM"] != null)
            {
                _subjectBM = ViewState["_subjectBM"] as SubjectBM; // 获取对象主键信息
            }
            /*获取对象的新值*/
            GetBMNewInfor(_subjectBM);

            /**** 自定义控件值得获取可在这里输入,或者在函数GetBMNewInfor里添加,例如:
             *
             * student.Email = this.ddlContry.Text;
             * student.IfDelete = this.radio.check;
             *
             * ****/

            //存入数据库
            CallResult <bool> cr = new CommonBL().Update(_subjectBM);

            AlertMsn.PopMsn(cr.Message);
            if (!cr.HasError || cr.Result)
            {
                //修改成功重新绑定数据
                this.AspNetPager1.CurrentPageIndex = 1;
                BindData(this.AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize);
            }
        }
示例#2
0
        public async Task <SubjectBM> GetSubjectBySubjectId(int SubjectID)
        {
            bool      isValid     = true;
            SubjectBM SubjectInfo = null;
            var       oSubject    = await _DBSubjectRepository.GetSubjectBySubjectId(SubjectID);

            if (oSubject != null)
            {
                SubjectInfo = _mapper.Map <SubjectBM>(oSubject);
            }
            return(SubjectInfo);
        }
示例#3
0
        /// <summary>
        /// 获得新添/修改后对象信息
        /// </summary>
        /// <param name="subjectBM"></param>
        /// <returns></returns>
        /// 创 建 人:HNAS Framework 4.0 项目组
        /// 创建日期:2012/3/15 17:21:32
        /// 修 改 人:
        /// 修改日期:
        protected SubjectBM GetBMNewInfor(SubjectBM subjectBM)
        {
            this.GetObjValueByTextBox(subjectBM, "txbNew");

            /**** 自定义控件值得获取可在这里输入,例如:
             *
             * student.Email = this.ddlContry.Text;
             * student.IfDelete = this.radio.check;
             *
             * ****/

            return(subjectBM);
        }
示例#4
0
        /// <summary>
        /// 删除事件--从数据库中删除
        /// </summary>
        /// <param name="subjectBM"></param>
        /// 创 建 人:HNAS Framework 4.0 项目组
        /// 创建日期:2012/3/15 17:21:32
        /// 修 改 人:
        /// 修改日期:
        protected void DelBM(SubjectBM subjectBM)
        {
            // 从数据库中删除
            CallResult <bool> cr = new CommonBL().Delete(subjectBM);//直接使用BL基类方法

            AlertMsn.PopMsn(cr.Message);
            if (!cr.HasError || cr.Result)
            {
                //删除成功重新绑定数据
                this.AspNetPager1.CurrentPageIndex = 1;
                BindData(this.AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize);
            }
        }
示例#5
0
        /// <summary>
        /// gvData_RowCommand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// 创 建 人:HNAS Framework 4.0 项目组
        /// 创建日期:2012/3/15 17:21:32
        /// 修 改 人:
        /// 修改日期:
        protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = ((GridViewRow)((LinkButton)(e.CommandSource)).Parent.Parent).RowIndex; //获得所选行

            if (e.CommandName == "Del")                                                           //删除
            {
                GetPrimaryKeyValue(_subjectBM, gvData, rowIndex);                                 //获取主键

                /**** 自定义控件值得获取可在这里输入,例如:
                 *
                 * student.ID = gvData.DataKeys[rowIndex].Values["cniid"] as int?,
                 * student.ClassID = gvData.DataKeys[rowIndex].Values["cniclassid"] as int?
                 *
                 * ****/

                this.DelBM(_subjectBM);
            }
            else if (e.CommandName == "EditShow")                           //编辑
            {
                GetPrimaryKeyValue(_subjectBM, gvData, rowIndex, "txbNew"); //获取主键并设置主键等不可更改信息为enabled

                /**** 自定义控件值得获取可在这里输入,例如:
                 *
                 * student.ID = gvData.DataKeys[rowIndex].Values["cniid"] as int?,
                 * student.ClassID = gvData.DataKeys[rowIndex].Values["cniclassid"] as int?
                 *
                 * ****/

                //获取BM详细数据
                _subjectBM = new CommonBL().GetOne(_subjectBM).Result;
                if (_subjectBM == null)
                {
                    return;
                }
                ViewState["_subjectBM"] = _subjectBM;   // 保存对象主键信息

                base.SetTxbValue(_subjectBM, "txbNew"); //绑定对象值到txbbox,

                /**** set praimary key set Enabled false and set the other conctrols value,例如:
                 * 自定义控件的赋值等等 ddl.selectIndex=1;
                 * txbNewId.Enabled = false;
                 *
                 * ****/

                //显示div
                base.RegisterScript("$('#MaskDiv').show();$('#AddEdit').show();$('#btnAdd').hide();$('#btnEdit').show()");
            }
        }
示例#6
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        /// <param name="iPageIndex">当前页数</param>
        /// <param name="iPageSize">每页显示行数</param>
        /// 创 建 人:HNAS Framework 4.0 项目组
        /// 创建日期:2012/3/15 17:21:32
        /// 修 改 人:
        /// 修改日期:
        protected void BindData(int iPageIndex, int iPageSize)
        {
            _subjectBM = new SubjectBM();

            //获取textbox查询条件的值
            base.GetObjValueByTextBox(_subjectBM, "txb");

            /**** 自定义控件值得获取可在这里输入,例如:
             *
             * student.Email = this.ddlContry.Text;
             * student.IfDelete = this.radio.check;
             *
             * ****/

            int?iTotal = 0;
            /*调用BF查询函数进行查询*/
            CallResult <DataTable> result = new CommonBL().GetDataTableByLike(_subjectBM, out iTotal, iPageSize, iPageIndex);

            //CallResult<DataTable> result = new CommonBL().GetDataTableByLike(_subjectBM);//不分页
            if (result.HasError)
            {
                AspNetPager1.RecordCount = 0;
                AlertMsn.PopMsn(result.Message);
            }

            if (result.Result != null)
            {
                AspNetPager1.RecordCount = iTotal.Value;//result.Result.Rows.Count;(不分页)
                //动态设置用户自定义文本内容
                this.BindPagerCustomInfoHTML(AspNetPager1);
                //页面绑定
                gvData.PageIndex = AspNetPager1.CurrentPageIndex - 1;
                //鼠标悬停高亮显示
                gvData.RowCreated += new GridViewRowEventHandler(this.GridViewRowsChangeColor);
            }

            gvData.DataSource = result.Result;
            gvData.DataBind();
        }
示例#7
0
        public async Task <IActionResult> UpdateSubject(int SubjectID)
        {
            CreateBreadCrumb(new[] { new { Name = "Home", ActionUrl = "#" },
                                     new { Name = "Subject", ActionUrl = "/Subject/UpdateSubject" } });

            BaseViewModel VModel     = null;
            SubjectBM     oSubjectBM = await _SubjectService.GetSubjectBySubjectId(SubjectID);

            if (oSubjectBM != null)
            {
                var TempVModel = new SubjectMasterVM
                {
                    Id   = oSubjectBM.Id,
                    Name = oSubjectBM.Name,
                };
                //var TempVModel = new StudentProfileVM();
                VModel = await GetViewModel(TempVModel);
            }
            //*****get user avtar************

            /*
             * string UsrImgPath = string.Format("{0}\\{1}.{2}", Path.Combine(GetBaseService().GetAppRootPath(), "AppFileRepo\\UserAvatar"), CurrentUserInfo.UserID, "jpg");
             * if (System.IO.File.Exists(UsrImgPath))
             * {
             *  UsrImgPath = string.Format("~/AppFileRepo/UserAvatar/{0}.{1}", CurrentUserInfo.UserID, "jpg");
             * }
             * else
             * {
             *  if (CurrentUserInfo.UserGender.Equals("M"))
             *      UsrImgPath = "~/img/avatar5.png";
             *  else
             *      UsrImgPath = "~/img/avatar3.png";
             * }
             */
            //*******************************
            return(View("~/Views/Master/UpdateSubject.cshtml", VModel));
        }
示例#8
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        /// <param name="iPageIndex">当前页数</param>
        /// <param name="iPageSize">每页显示行数</param>
        /// 创 建 人:HNAS Framework 4.0 项目组
        /// 创建日期:2012/3/15 17:21:32
        /// 修 改 人:
        /// 修改日期:
        protected void BindData(int iPageIndex, int iPageSize)
        {
            
            _subjectBM = new SubjectBM();
            
            //获取textbox查询条件的值    
            base.GetObjValueByTextBox(_subjectBM, "txb");
            /**** 自定义控件值得获取可在这里输入,例如:
             * 
             * student.Email = this.ddlContry.Text;
             * student.IfDelete = this.radio.check;
             * 
             * ****/

            int? iTotal = 0;
            /*调用BF查询函数进行查询*/
            CallResult<DataTable> result = new CommonBL().GetDataTableByLike(_subjectBM, out iTotal, iPageSize, iPageIndex);
            //CallResult<DataTable> result = new CommonBL().GetDataTableByLike(_subjectBM);//不分页
            if (result.HasError)
            {
                AspNetPager1.RecordCount = 0;
                AlertMsn.PopMsn( result.Message);
            }

            if (result.Result != null)
            {
                AspNetPager1.RecordCount = iTotal.Value;//result.Result.Rows.Count;(不分页)
                //动态设置用户自定义文本内容
                this.BindPagerCustomInfoHTML(AspNetPager1);
                //页面绑定           
                gvData.PageIndex = AspNetPager1.CurrentPageIndex - 1;
                //鼠标悬停高亮显示
                gvData.RowCreated += new GridViewRowEventHandler(this.GridViewRowsChangeColor);
            }

            gvData.DataSource = result.Result;
            gvData.DataBind();
        }
示例#9
0
        /// <summary>
        /// gvData_RowCommand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// 创 建 人:HNAS Framework 4.0 项目组
        /// 创建日期:2012/3/15 17:21:32
        /// 修 改 人:
        /// 修改日期:
        protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
        {

            int rowIndex = ((GridViewRow)((LinkButton)(e.CommandSource)).Parent.Parent).RowIndex;//获得所选行
            if (e.CommandName == "Del")//删除
            {
                GetPrimaryKeyValue(_subjectBM, gvData, rowIndex);//获取主键
                 /**** 自定义控件值得获取可在这里输入,例如:
                 * 
                 * student.ID = gvData.DataKeys[rowIndex].Values["cniid"] as int?,
                 * student.ClassID = gvData.DataKeys[rowIndex].Values["cniclassid"] as int?
                 * 
                 * ****/

                this.DelBM(_subjectBM);

            }
            else if (e.CommandName == "EditShow")//编辑
            {
                GetPrimaryKeyValue(_subjectBM, gvData, rowIndex, "txbNew");//获取主键并设置主键等不可更改信息为enabled
                  /**** 自定义控件值得获取可在这里输入,例如:
                 * 
                 * student.ID = gvData.DataKeys[rowIndex].Values["cniid"] as int?,
                 * student.ClassID = gvData.DataKeys[rowIndex].Values["cniclassid"] as int?
                 * 
                 * ****/

                //获取BM详细数据
                _subjectBM = new CommonBL().GetOne(_subjectBM).Result;
                if (_subjectBM == null)
                {
                    return;
                }
                ViewState["_subjectBM"] = _subjectBM;// 保存对象主键信息

                base.SetTxbValue(_subjectBM, "txbNew");//绑定对象值到txbbox,
                
                /**** set praimary key set Enabled false and set the other conctrols value,例如:
                 * 自定义控件的赋值等等 ddl.selectIndex=1;
                 * txbNewId.Enabled = false;    
                 * 
                 * ****/

                //显示div
                base.RegisterScript("$('#MaskDiv').show();$('#AddEdit').show();$('#btnAdd').hide();$('#btnEdit').show()");

            }
        } 
示例#10
0
        /// <summary>
        /// 获得新添/修改后对象信息
        /// </summary>        
        /// <param name="subjectBM"></param>
        /// <returns></returns>
        /// 创 建 人:HNAS Framework 4.0 项目组
        /// 创建日期:2012/3/15 17:21:32
        /// 修 改 人:
        /// 修改日期:
        protected SubjectBM GetBMNewInfor(SubjectBM subjectBM)
        {
            this.GetObjValueByTextBox(subjectBM, "txbNew");
            /**** 自定义控件值得获取可在这里输入,例如:
             * 
             * student.Email = this.ddlContry.Text;
             * student.IfDelete = this.radio.check;
             * 
             * ****/

            return subjectBM;
        } 
示例#11
0
        /// <summary>
        /// 修改事件--保存到数据库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// 创 建 人:HNAS Framework 4.0 项目组
        /// 创建日期:2012/3/15 17:21:32
        /// 修 改 人:
        /// 修改日期:
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            if (ViewState["_subjectBM"]!=null)
            {
                _subjectBM = ViewState["_subjectBM"] as SubjectBM ;// 获取对象主键信息
            }
            /*获取对象的新值*/
            GetBMNewInfor(_subjectBM);
            /**** 自定义控件值得获取可在这里输入,或者在函数GetBMNewInfor里添加,例如:
             * 
             * student.Email = this.ddlContry.Text;
             * student.IfDelete = this.radio.check;
             * 
             * ****/

            //存入数据库
            CallResult<bool> cr = new CommonBL().Update(_subjectBM);
            AlertMsn.PopMsn(cr.Message);
            if (!cr.HasError || cr.Result)
            {
                //修改成功重新绑定数据
                this.AspNetPager1.CurrentPageIndex = 1;
                BindData(this.AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize);
            }         
        }
示例#12
0
        /// <summary>
        /// 删除事件--从数据库中删除
        /// </summary>
        /// <param name="subjectBM"></param>
        /// 创 建 人:HNAS Framework 4.0 项目组
        /// 创建日期:2012/3/15 17:21:32
        /// 修 改 人:
        /// 修改日期:
        protected void DelBM(SubjectBM subjectBM)
        {
            // 从数据库中删除
            CallResult<bool> cr = new CommonBL().Delete(subjectBM);//直接使用BL基类方法

            AlertMsn.PopMsn(cr.Message);
            if (!cr.HasError || cr.Result)
            {
                //删除成功重新绑定数据
                this.AspNetPager1.CurrentPageIndex = 1;
                BindData(this.AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize);
            }
           
        }