Ejemplo n.º 1
0
 public int Update(Ex_Category model)
 {
     return((int)SqlHelper.ExecuteScalar(SqlConnection, CommonHelper.Config.GetFullyQualifiedName("Ex_Category_Update")
                                         , model.Id, CommonHelper.Null.GetNull(model.Code), CommonHelper.Null.GetNull(model.Name), CommonHelper.Null.GetNull(model.Total)
                                         , model.Orders, model.UsedState,
                                         model.CreatedBy, model.CreatedDate,
                                         CommonHelper.Null.GetNull(model.ModifiedDate), CommonHelper.Null.GetNull(model.ModifiedBy)));
 }
Ejemplo n.º 2
0
        public int Insert(Ex_Category model)
        {
            var deciResult = SqlHelper.ExecuteScalar(SqlConnection, CommonHelper.Config.GetFullyQualifiedName("Ex_Category_Insert")
                                                     , CommonHelper.Null.GetNull(model.Code), CommonHelper.Null.GetNull(model.Name), CommonHelper.Null.GetNull(model.Total)
                                                     , model.Orders, model.UsedState,
                                                     model.CreatedBy, model.CreatedDate,
                                                     CommonHelper.Null.GetNull(model.ModifiedDate), CommonHelper.Null.GetNull(model.ModifiedBy));

            return(CommonHelper.Convert.ConvertToInt32(deciResult));
        }
Ejemplo n.º 3
0
        public ActionResult Edit(Ex_Category sysModel)
        {
            try
            {
                #region Redirect Request

                int succcess = 0;
                if (sysModel.Id > 0)
                {
                    var objTemporary = new SysAdminAction <Ex_Category>().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 }));
        }
Ejemplo n.º 4
0
        public ActionResult GetById(int?id)
        {
            var objTemporary = new Ex_Category();

            try
            {
                int editId = id.HasValue ? id.Value : 0;
                if (editId > 0)
                {
                    objTemporary = new SysAdminAction <Ex_Category>().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 }));
            }
        }