示例#1
0
        /// <summary>
        /// 新增修改
        /// </summary>
        private void Save()
        {
            bool res = false;                              //是否成功

            tid = Utils.GetInt(Utils.GetFormValue("tid")); //主键ID
            if (tid > 0)
            {
                exModel = workbll.GetModel(tid); //修改获取实体
            }
            else //新增初使化数据
            {
                exModel.CompanyId  = CurrentUserCompanyID;
                exModel.IsDelete   = false;
                exModel.Replys     = 0;
                exModel.OperatorId = SiteUserInfo.ID;
                exModel.Clicks     = 0;
                exModel.IsDelete   = false;
                exModel.CreateTime = DateTime.Now;//创建时间

                //现在需求所有人查看
                exModel.AcceptList = new List <EyouSoft.Model.PersonalCenterStructure.WorkExchangeAccept>();
                EyouSoft.Model.PersonalCenterStructure.WorkExchangeAccept exAct = new EyouSoft.Model.PersonalCenterStructure.WorkExchangeAccept();
                exAct.AcceptId   = 0;
                exAct.AcceptType = EyouSoft.Model.EnumType.PersonalCenterStructure.AcceptType.所有;
                exModel.AcceptList.Add(exAct);
            }
            exModel.Title       = Utils.GetFormValue("title");                              //标题
            exModel.Description = Utils.EditInputText(Request.Form["description"]);         //内容
            exModel.IsAnonymous = Utils.GetFormValue("isAnonymous") == "on" ? true : false; //是否匿名
            if (exModel.IsAnonymous)
            {
                exModel.OperatorName = "匿名";
            }
            else
            {
                exModel.OperatorName = SiteUserInfo.ContactInfo.ContactName;
            }

            if (tid > 0)
            {
                res = workbll.Update(exModel); //更新
            }
            else
            {
                res = workbll.Add(exModel);//新增
            }
            if (res)
            {
                string conti = Utils.GetFormValue("continue");
                if (conti == "continue")
                {
                    MessageBox.ShowAndRedirect(this, "操作成功!", "ExchangeAdd.aspx");
                }
                else
                {
                    MessageBox.ShowAndRedirect(this, "操作成功!", "Exchange.aspx");
                }
            }
            else
            {
                MessageBox.ShowAndReturnBack(this, "操作失败!", 1);
            }
        }
示例#2
0
 /// <summary>
 /// 初使化修改数据
 /// </summary>
 private void Bind()
 {
     tid     = Utils.GetInt(Utils.GetQueryStringValue("tid"), 0);
     exModel = workbll.GetModel(tid);
 }