Example #1
0
        private string DeleteSoftware(string id)
        {
            Sys_Software software = sfbll.Find(s => s.SoftwareID == id);

            // 并不真实删除表中数据,仅仅更新字段,并保留删除信息
            software.Software_IsExists     = 1;
            software.Software_DeleteTime   = DateTime.Now;
            software.Software_DeleteUserID = CurrUserInfo().UserID;
            string msg = string.Empty;
            bool   bol = sfbll.Update(software, out msg);
            // 得到ModelFile表中对象。
            var             file = bll.Find(m => m.File_OperationID == id);
            FileDeleHandler fdh  = new FileDeleHandler();
            // 删除Download中的文件
            string Result = fdh.PublicDele(file.FileID, "ww", file.File_Type);

            bll.Delete(file);
            return(Result);
        }
Example #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");
                }
            }
        }