Пример #1
0
 public int Update(Ex_ExamConfig model)
 {
     return((int)SqlHelper.ExecuteScalar(SqlConnection, CommonHelper.Config.GetFullyQualifiedName("Ex_ExamConfig_Update")
                                         , model.Id, CommonHelper.Null.GetNull(model.ExamCode), CommonHelper.Null.GetNull(model.Section), CommonHelper.Null.GetNull(model.LevelDifficult)
                                         , CommonHelper.Null.GetNull(model.TotalNumber), model.Orders, model.UsedState,
                                         model.CreatedBy, model.CreatedDate,
                                         CommonHelper.Null.GetNull(model.ModifiedDate), CommonHelper.Null.GetNull(model.ModifiedBy)));
 }
Пример #2
0
        public int Insert(Ex_ExamConfig model)
        {
            var deciResult = SqlHelper.ExecuteScalar(SqlConnection, CommonHelper.Config.GetFullyQualifiedName("Ex_ExamConfig_Insert")
                                                     , CommonHelper.Null.GetNull(model.ExamCode), CommonHelper.Null.GetNull(model.Section), CommonHelper.Null.GetNull(model.LevelDifficult)
                                                     , CommonHelper.Null.GetNull(model.TotalNumber), model.Orders, model.UsedState,
                                                     model.CreatedBy, model.CreatedDate,
                                                     CommonHelper.Null.GetNull(model.ModifiedDate), CommonHelper.Null.GetNull(model.ModifiedBy));

            return(CommonHelper.Convert.ConvertToInt32(deciResult));
        }
Пример #3
0
        public ActionResult Edit(Ex_ExamConfig sysModel)
        {
            try
            {
                #region Redirect Request

                int succcess = 0;
                if (sysModel.Id > 0)
                {
                    var objTemporary = new SysAdminAction <Ex_ExamConfig>().GetById(sysModel.Id);
                    if (AuthorizeUser.IsAction(Ultity.Constant.Edit) || AuthorizeUser.IsAction(Ultity.Constant.ViewEditAll))
                    {
                        sysModel.CreatedBy    = objTemporary.CreatedBy;
                        sysModel.ModifiedDate = DateTime.Now;
                        sysModel.ModifiedBy   = WebSecurity.CurrentUserId;
                        sysModel.CreatedDate  = objTemporary.CreatedDate;
                        //sysModel.Name = objTemporary.Name;
                        succcess = _sysAction.Update(sysModel);
                    }
                    else
                    {
                        succcess = 1;
                    }
                }
                else
                {
                    if (AuthorizeUser.IsAction(Ultity.Constant.Add) || AuthorizeUser.IsAction(Ultity.Constant.ViewEditAll))
                    {
                        sysModel.CreatedBy    = WebSecurity.CurrentUserId;
                        sysModel.ModifiedBy   = null;
                        sysModel.CreatedDate  = DateTime.Now;
                        sysModel.ModifiedDate = null;
                        succcess = _sysAction.Insert(sysModel);
                    }
                    else
                    {
                        succcess = 1;
                    }
                }

                if (succcess > 0)
                {
                    return(Json(new { status = "success", Message = Ultity.Constant.Ajax_Success }));
                }
                return(Json(new { status = "fail", Message = Ultity.Constant.Ajax_Fail }));

                #endregion Redirect Request
            }
            catch (Exception exception)
            {
                Ultity.TFunction.WriteToLog(exception);
            }

            return(Json(new { status = "fail", Message = Ultity.Constant.Ajax_Fail }));
        }
Пример #4
0
        public ActionResult GetById(int?id)
        {
            var objTemporary = new Ex_ExamConfig();

            try
            {
                int editId = id.HasValue ? id.Value : 0;
                if (editId > 0)
                {
                    objTemporary = new SysAdminAction <Ex_ExamConfig>().GetById(editId);
                }
                return(Json(new { status = "success", Message = Ultity.Constant.Ajax_Success, Data = objTemporary }));
            }
            catch (Exception exception)
            {
                Ultity.TFunction.WriteToLog(exception);
                return(Json(new { status = "fail", Message = Ultity.Constant.Ajax_Fail }));
            }
        }