private void CreateModel(global::Drision.Framework.Entity.T_Article entityModel)
 {
     entityModel.SetPropertyConvertValue("Article_Name", tbArticle_Name.GetValue());
     entityModel.SetPropertyConvertValue("State", txtStateK6.GetValue());
     entityModel.SetPropertyConvertValue("ColumnsId", ddlColumnsIdRX.GetValue());
     entityModel.SetPropertyConvertValue("Img", txtImgEJ.GetValue());
 }
Exemple #2
0
/// <summary>
/// 保存并发布
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
        protected void btnSaveAndPub_Click(object sender, EventArgs e)
        {
            try
            {
                string __RedirectURL = string.Empty;
                ButtonOperationContext __ButtonOperationContext        = new ButtonOperationContext();
                global::Drision.Framework.Entity.T_Article entityModel = null;
                entityModel = new global::Drision.Framework.Entity.T_Article();
                CreateModel(entityModel);
                PluginEventArgs __PluginEventArg = new PluginEventArgs()
                {
                    entityModel = entityModel, RedirectURL = __RedirectURL, CurrentUserID = this.LoginUserID
                };
                {
                    #region  钮前插件
                    if (!__ButtonOperationContext.IsEnd)
                    {
                        try
                        {
                            PagePluginFactory.InvokeBeforePlugins(sender, __PluginEventArg);
                            __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL;
                            if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL))
                            {
                                __ButtonOperationContext.IsEnd = true;
                            }
                        }
                        catch (MessageException ex)
                        {
                            __ButtonOperationContext.IsEnd        = true;
                            __ButtonOperationContext.AlertMessage = ex.Message;
                        }
                    }
                    #endregion

                    #region 框架自己操作
                    if (!__ButtonOperationContext.IsEnd)
                    {
                        this.GenericHelper.Save(entityModel);
                        __Id = entityModel.Article_Id;
                    }
                    #endregion
                    #region  钮后插件
                    if (!__ButtonOperationContext.IsEnd)
                    {
                        try
                        {
                            PagePluginFactory.InvokeAfterPlugins(sender, __PluginEventArg);
                            __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL;
                            if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL))
                            {
                                __ButtonOperationContext.IsEnd = true;
                            }
                        }
                        catch (MessageException ex)
                        {
                            __ButtonOperationContext.IsEnd        = true;
                            __ButtonOperationContext.AlertMessage = ex.Message;
                        }
                    }
                    #endregion
                    //结束事务
                    #region 最后处理
                    if (__ButtonOperationContext.IsEnd)
                    {
                        if (!string.IsNullOrEmpty(__ButtonOperationContext.AlertMessage))
                        {
                            this.AjaxAlert(__ButtonOperationContext.AlertMessage, "EnableButton();");
                            return;
                        }
                        if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL))
                        {
                            Response.Redirect(__ButtonOperationContext.RedirectURL);
                            return;
                        }
                    }
                    #endregion
                }


                __RedirectURL = DequeueLastUrl("id", __Id); //2013-11-13 V3.0


                //如果没有id就加上id
                __RedirectURL = AppendQueryStringToUrl(__RedirectURL, "id", __Id);//2013-11-13 V3.0

                Response.Redirect(__RedirectURL, false);
            }
            catch (Exception ex)
            {
                DrisionLog.Add(ex);
                this.AjaxAlert(ex, "EnableButton();");
            }
        }