示例#1
0
        public void BindShow()
        {
            string id = Request.QueryString["id"];

            if (!string.IsNullOrEmpty(id))  //修改时加载
            {
                Sys_SoftwareBLL bll = new Sys_SoftwareBLL();
                //Sys_NoticeFileBLL bllAttach = new Sys_NoticeFileBLL();

                Sys_Software model = bll.Find(p => p.SoftwareID == id);
                if (model == null)
                {
                    MessageBox.ShowAndRedirect(this, "该数据不存在!", "SoftwareIndex.aspx");
                }
                else
                {
                    Software_Title.Text   = model.Software_Name;
                    Software_Context.Text = model.Software_Introduction;
                    Software_No.Text      = model.Software_No.ToString();
                    Session.Remove("ww");
                    this.File.FileOperationType = "Modify";
                    this.File.FileSizeLimit     = "3000";
                    this.File.FilesNname        = "File";
                    this.File.FileSessionID     = "ww";
                    this.File.FileMulti         = "false";
                    this.File.FileType          = "系统必备工具";
                    this.File.FileTypeDesc      = "支持格式:.exe;.msi;.rar;.7z;.zip;";
                    this.File.FileTypeExts      = "*.exe;*.msi;*.rar;*.7z;*.zip;";
                    this.File.FileOperationID   = model.SoftwareID;
                }
            }
            else
            {
                Session.Remove("ww");
                this.File.FileOperationType = "Add";
                this.File.FilesNname        = "File";
                this.File.FileSessionID     = "ww";
                this.File.FileMulti         = "false";
                this.File.FileSizeLimit     = "3000";
                this.File.FileType          = "系统必备工具";
                this.File.FileTypeDesc      = "支持格式:.exe;.msi;.rar;.7z;.zip;";
                this.File.FileTypeExts      = "*.exe;*.msi;*.rar;*.7z;*.zip;";
                this.File.FileOperationID   = Guid.NewGuid().ToString();
                //btn_downFile.Visible = false;//新增时不能下载附件
            }
        }
示例#2
0
        /// <summary>
        /// 预存
        /// </summary>
        public void Save()
        {
            string id  = Request.QueryString["id"];
            string msg = string.Empty;

            if (!string.IsNullOrEmpty(id))
            {
                Sys_SoftwareBLL bll   = new Sys_SoftwareBLL();
                Sys_Software    model = bll.Find(p => p.SoftwareID == id);
                model.Software_Name         = Software_Title.Text;
                model.Software_Introduction = Software_Context.Text;
                var    no     = Software_No.Text;
                double result = 0;
                if (double.TryParse(no, out result))
                {
                    model.Software_No = double.Parse(no);
                }
                else
                {
                    model.Software_No = 1;
                }
                bool bol = bll.Update(model, out msg);
                if (bol)
                {
                    new Sys_ModelFileBLL().AddList(Session["ww"] as List <Sys_ModelFile>, out msg);
                    MessageBox.ShowAndRedirect(this, "保存成功!", "SoftwareIndex.aspx");
                }
                else
                {
                    MessageBox.Show(this, msg);
                    Session.Remove("ww");
                }
            }
            else
            {
                Sys_SoftwareBLL bll   = new Sys_SoftwareBLL();
                Sys_Software    model = new Sys_Software();
                model.SoftwareID            = this.File.FileOperationID;
                model.Software_Name         = Software_Title.Text;
                model.Software_Introduction = Software_Context.Text;
                var    no     = Software_No.Text;
                double result = 0;
                if (double.TryParse(no, out result))
                {
                    model.Software_No = double.Parse(no);
                }
                else
                {
                    model.Software_No = 1;
                }
                model.Software_UploadUserID = CurrUserInfo().UserID;
                model.Software_UploadTime   = DateTime.Now;
                model.Software_IsExists     = 0;
                if (bll.Add(model, out msg))
                {
                    new Sys_ModelFileBLL().AddList(Session["ww"] as List <Sys_ModelFile>, out msg);
                    MessageBox.ShowAndRedirect(this, "保存成功!", "SoftwareIndex.aspx");
                }
                else
                {
                    MessageBox.Show(this, msg);
                    Session.Remove("ww");
                }
            }
        }