예제 #1
0
 public int Update(Cms_Class model)
 {
     return((int)SqlHelper.ExecuteScalar(SqlConnection, CommonHelper.Config.GetFullyQualifiedName("Cms_Class_Update")
                                         , model.Id, CommonHelper.Null.GetNull(model.IdGuid), CommonHelper.Null.GetNull(model.Grade), CommonHelper.Null.GetNull(model.SubjectId), CommonHelper.Null.GetNull(model.Name)
                                         , CommonHelper.Null.GetNull(model.Image), CommonHelper.Null.GetNull(model.Star)
                                         , CommonHelper.Null.GetNull(model.Price), CommonHelper.Null.GetNull(model.TeacherId), CommonHelper.Null.GetNull(model.Sale)
                                         , CommonHelper.Null.GetNull(model.Summary), CommonHelper.Null.GetNull(model.Content), CommonHelper.Null.GetNull(model.VideoDemo),
                                         CommonHelper.Null.GetNull(model.LinkFile), model.Orders, model.UsedState,
                                         model.CreatedBy, model.CreatedDate,
                                         CommonHelper.Null.GetNull(model.ModifiedBy), CommonHelper.Null.GetNull(model.ModifiedDate)));
 }
예제 #2
0
        public int Insert(Cms_Class model)
        {
            var deciResult = SqlHelper.ExecuteScalar(SqlConnection, CommonHelper.Config.GetFullyQualifiedName("Cms_Class_Insert")
                                                     , CommonHelper.Null.GetNull(model.IdGuid), CommonHelper.Null.GetNull(model.Grade), CommonHelper.Null.GetNull(model.SubjectId), CommonHelper.Null.GetNull(model.Name)
                                                     , CommonHelper.Null.GetNull(model.Image), CommonHelper.Null.GetNull(model.Star)
                                                     , CommonHelper.Null.GetNull(model.Price), CommonHelper.Null.GetNull(model.TeacherId), CommonHelper.Null.GetNull(model.Sale)
                                                     , CommonHelper.Null.GetNull(model.Summary), CommonHelper.Null.GetNull(model.Content), CommonHelper.Null.GetNull(model.VideoDemo),
                                                     CommonHelper.Null.GetNull(model.LinkFile),
                                                     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 GetById(int?id)
        {
            var objTemporary = new Cms_Class();

            try
            {
                int editId = id.HasValue ? id.Value : 0;
                if (editId > 0)
                {
                    objTemporary = new SysAdminAction <Cms_Class>().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 }));
            }
        }
예제 #4
0
        public ActionResult Edit(Cms_Class sysModel)
        {
            try
            {
                #region Redirect Request

                int succcess = 0;
                if (sysModel.Id > 0)
                {
                    var objTemporary = new SysAdminAction <Cms_Class>().GetById(sysModel.Id);
                    if (AuthorizeUser.IsAction(Ultity.Constant.Edit) || AuthorizeUser.IsAction(Ultity.Constant.ViewEditAll))
                    {
                        sysModel.IdGuid       = objTemporary.IdGuid;
                        sysModel.CreatedBy    = objTemporary.CreatedBy;
                        sysModel.ModifiedDate = DateTime.Now;
                        sysModel.ModifiedBy   = WebSecurity.CurrentUserId;
                        sysModel.CreatedDate  = objTemporary.CreatedDate;
                        sysModel.TeacherId    = objTemporary.TeacherId;
                        sysModel.UsedState    = objTemporary.UsedState;
                        succcess = _sysAction.Update(sysModel);
                    }
                    else
                    {
                        succcess = 1;
                    }
                }
                else
                {
                    if (AuthorizeUser.IsAction(Ultity.Constant.Add) || AuthorizeUser.IsAction(Ultity.Constant.ViewEditAll))
                    {
                        sysModel.IdGuid       = Guid.NewGuid().ToString();
                        sysModel.CreatedBy    = WebSecurity.CurrentUserId;
                        sysModel.ModifiedBy   = null;
                        sysModel.CreatedDate  = DateTime.Now;
                        sysModel.ModifiedDate = null;
                        sysModel.UsedState    = Ultity.Constant.NotActive;
                        sysModel.TeacherId    = WebSecurity.CurrentUserId;
                        sysModel.Star         = 0;
                        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 }));
        }