Exemple #1
0
        protected override void On_ActionAdd(object sender, EventArgs e)
        {
            if (Utilities.IsNull(txtSupportSubject.Text))
            {
                txtMessage.InnerHtml = "请输入咨询的标题!";
                return;
            }

            SysSupport support = SysSupport.FetchByID(Id);
            if (support == null)
            {
                support = new SysSupport( );
                support.SupportIsRead = false;
                support.SupportItem = 1;
                support.SupportProductID = 0;
                support.SupportFid = CurrentUser.Id;
                support.SupportPhoto = string.Empty;
                support.SupportRating = 1;
                support.SupportRatingReason = string.Empty;
                support.SupportStatus = 1;
                support.SupportTid = 0;
                support.SupportType = 1;
                support.SupportDate = DateTime.Now;
                support.SupportDateFinish = DateTime.MinValue.AddYears(0x76c);
                support.SupportDateReply = DateTime.MinValue.AddYears(0x76c);
                support.SupportAttach = string.Empty;
            }
            TransactionScope ts = new TransactionScope( );
            SharedDbConnectionScope ss = new SharedDbConnectionScope( );
            try
            {
                if (!Utilities.IsNull(txtSupportPhoto.Value) && !string.IsNullOrEmpty(txtSupportPhoto.PostedFile.FileName))
                {
                    string message;
                    var result = Eleooo.Common.FileUpload.SaveUploadFile(txtSupportPhoto.PostedFile, FileType.Image | FileType.Zip | FileType.Zip, SaveType.Support, out message, true);
                    if (result == null)
                    {
                        txtMessage.InnerHtml = message;
                        return;
                    }
                    support.SupportPhoto = result.PhyPath;
                }
                support.SupportSubject = txtSupportSubject.Text;
                support.SupportContent = HttpUtility.HtmlEncode(txtSupportContent.Text);
                support.Save( );
                _id = support.SupportId;
                new SysSupportMessage
                {
                    SupportMsgSid = _id,
                    SupportMsgDate = DateTime.Now,
                    SupportMsgFid = support.SupportFid,
                    SupportMsgTid = 0,
                    SupportMsgIsAsk = false,
                    SupportMsgIsRead = false,
                    SupportMsgPhoto = support.SupportPhoto,
                    SupportMsgMemo = string.IsNullOrEmpty(support.SupportContent) ? support.SupportSubject : support.SupportContent
                }.Save( );
                ts.Complete( );
                txtMessage.InnerHtml = "保存成功!";
            }
            catch (Exception ex)
            {
                Logging.Log("Company.SupportEdit->On_ActionAdd", ex, true);
                txtMessage.InnerHtml = ex.Message;
            }
            finally
            {
                ss.Dispose( );
                ts.Dispose( );
            }
            On_ActionQuery(sender, e);
        }
Exemple #2
0
        public void Insert(int SupportFid,int SupportTid,int SupportItem,int SupportType,int SupportProductID,string SupportSubject,string SupportContent,string SupportAttach,string SupportPhoto,bool SupportIsRead,int? SupportRating,string SupportRatingReason,int SupportStatus,DateTime SupportDate,DateTime? SupportDateReply,DateTime? SupportDateFinish,int? CreatedBy,DateTime? CreatedOn,int? ModifiedBy,DateTime? ModifiedOn)
        {
            SysSupport item = new SysSupport();

            item.SupportFid = SupportFid;

            item.SupportTid = SupportTid;

            item.SupportItem = SupportItem;

            item.SupportType = SupportType;

            item.SupportProductID = SupportProductID;

            item.SupportSubject = SupportSubject;

            item.SupportContent = SupportContent;

            item.SupportAttach = SupportAttach;

            item.SupportPhoto = SupportPhoto;

            item.SupportIsRead = SupportIsRead;

            item.SupportRating = SupportRating;

            item.SupportRatingReason = SupportRatingReason;

            item.SupportStatus = SupportStatus;

            item.SupportDate = SupportDate;

            item.SupportDateReply = SupportDateReply;

            item.SupportDateFinish = SupportDateFinish;

            item.CreatedBy = CreatedBy;

            item.CreatedOn = CreatedOn;

            item.ModifiedBy = ModifiedBy;

            item.ModifiedOn = ModifiedOn;

            item.Save(UserName);
        }