Exemplo n.º 1
0
 public SaveParameterCriteria(Parameter parent)
 {
     this.parent = parent;
 }
Exemplo n.º 2
0
        public ActionResult Edit()
        {
            List<TmpParameter> list = null;

            //Modify by JLD on 2012-11-15 清除权限
            PermissionsProviderFactory.ProvidePermissions.ClearUserIdentity(App.Framework.Security.User.Current.UserIdentity);

            IDbTransaction tran = BusinessPortal.BeginTransaction();

            try
            {
                if (Session["TEMP_PARAMETER"] != null)
                {
                    list = (List<TmpParameter>)Session["TEMP_PARAMETER"];
                    BusinessResult result = new BusinessResult();
                    foreach (TmpParameter tmp in list)
                    {
                        Parameter p = new Parameter();
                        p.ParaID = Convert.ToInt64(tmp.Id);
                        p.Code = tmp.Code;
                        p.Value = tmp.Value;
                        p.LastUpdateDate = tmp.LastUpdateDate;
                        p.SysCode = SecurityPortal.ApplicationName;
                        p.ShopCode = App.Framework.Security.User.Current.ShopCode;
                        p.LastUpdatedBy = App.Framework.Security.User.Current.UserId;
                        p.ActionType = "EDIT";

                        result = BusinessPortal.Save(p,tran);
                    }

                    tran.Commit();
                    Session["TEMP_PARAMETER"] = null;

                    switch (result.ResultType)
                    {
                        case 0:
                            result.ResultMessage = CSC.Resources.BusinessResultMessage.INF_SAVE_SUCCEED;
                            break;
                        case -1003:
                            result.ResultMessage = CSC.Resources.BusinessResultMessage.MSG_1003;
                            break;
                        default:
                            result.ResultMessage = CSC.Resources.BusinessResultMessage.INF_SAVE_FAILED;
                            break;
                    }
                    if (result.ResultType == 0)
                    {
                        this.ShowMessage(result.ResultMessage, isSucessed: true);
                        return View("Index", new ParameterListModel());
                    }
                    else
                    {
                        this.ShowMessage(result.ResultMessage, isSucessed: false);
                        return View("Index", new ParameterListModel());
                    }
                }
            }
            catch(Exception e)
            {
                tran.Rollback();

                throw e;
            }
            finally
            {

            }

            //return View("Index", new ParameterListModel());
            return RedirectToAction("Index");
        }