Exemple #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtTitle.Text.Trim().Length == 0)
            {
                strErr += "组名不能为空!\\n";
            }
            if (this.txtAtlas.Text.Trim().Length == 0)
            {
                strErr += "Atlas不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtTime.Text))
            {
                strErr += "Time格式错误!\\n";
            }
            if (this.txtInfo.Text.Trim().Length == 0)
            {
                strErr += "Info不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtNo.Text))
            {
                strErr += "No格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtMark.Text))
            {
                strErr += "Mark格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtClick.Text))
            {
                strErr += "Click格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   Title = this.txtTitle.Text;
            string   Atlas = this.txtAtlas.Text;
            DateTime Time  = DateTime.Parse(this.txtTime.Text);
            string   Info  = this.txtInfo.Text;
            int      No    = int.Parse(this.txtNo.Text);
            int      Mark  = int.Parse(this.txtMark.Text);
            int      Click = int.Parse(this.txtClick.Text);

            Maticsoft.Model.WorksGroup model = new Maticsoft.Model.WorksGroup();
            model.Title = Title;
            model.Atlas = Atlas;
            model.Time  = Time;
            model.Info  = Info;
            model.No    = No;
            model.Mark  = Mark;
            model.Click = Click;

            Maticsoft.BLL.WorksGroup bll = new Maticsoft.BLL.WorksGroup();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Maticsoft.BLL.WorksGroup bll = new Maticsoft.BLL.WorksGroup();
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             int ID = (Convert.ToInt32(Request.Params["id"]));
             bll.Delete(ID);
         }
     }
 }
Exemple #3
0
 private void ShowInfo(int ID)
 {
     Maticsoft.BLL.WorksGroup   bll   = new Maticsoft.BLL.WorksGroup();
     Maticsoft.Model.WorksGroup model = bll.GetModel(ID);
     this.lblID.Text    = model.ID.ToString();
     this.txtTitle.Text = model.Title;
     this.txtAtlas.Text = model.Atlas;
     this.txtTime.Text  = model.Time.ToString();
     this.txtInfo.Text  = model.Info;
     this.lblNo.Text    = model.No.ToString();
     this.txtMark.Text  = model.Mark.ToString();
     this.txtClick.Text = model.Click.ToString();
 }
Exemple #4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //保存文件
            string path = "";
            string filepath = "", filename = "";

            if (FileUpload1.HasFile)
            {
                if (Maticsoft.Common.FileUp.IsImg(FileUpload1.FileName))
                {
                    filepath = Maticsoft.Common.FileUp.GetUploadPath("/Upload/Works");
                    filename = Maticsoft.Common.FileUp.GetRandomName();
                    path     = Maticsoft.Common.FileUp.uploadfile(FileUpload1.PostedFile, filepath, filename);
                    //生成缩略图
                }
                else
                {
                    label1.Text = "不支持该文件";
                    return;
                }
            }


            //保存数据到数据库
            Maticsoft.BLL.WorksGroup   bll = new Maticsoft.BLL.WorksGroup();
            Maticsoft.Model.WorksGroup model = new Maticsoft.Model.WorksGroup();
            model.ID    = int.Parse(label2.Text);
            model.Title = txtTitle.Text;
            model.Time  = DateTime.Parse(txtTime.Text);
            model.Info  = txtsum.Text;
            model.Mark  = int.Parse(txtMark.Text);
            model.No    = int.Parse(txtNo.Text);
            model.Click = int.Parse(txtClick.Text);
            if (path != "")
            {
                model.Atlas = path;//图片路径
            }
            else
            {
                model.Atlas = Image1.ImageUrl;
            }
            if (bll.Update(model))
            {
                label1.Text = "操作成功";
            }
            else
            {
                label1.Text = "操作失败";
            }
        }
Exemple #5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //保存文件
            string path = "";
            string filepath = "", filename = "";

            if (FileUpload1.HasFile || Maticsoft.Common.FileUp.IsImg(FileUpload1.FileName))
            {
                filepath = Maticsoft.Common.FileUp.GetUploadPath("/Upload/Works");
                filename = Maticsoft.Common.FileUp.GetRandomName();
                path     = Maticsoft.Common.FileUp.uploadfile(FileUpload1.PostedFile, filepath, filename);
                // 生成缩略图
                string bigPath = Server.MapPath("~/") + filepath + "big_" + filename + System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
                Maticsoft.Common.CutImage.CutImg(Server.MapPath("~/") + path, bigPath, 896, 650, "h");
                string miniPath = Server.MapPath("~/") + filepath + "mini_" + filename + System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
                Maticsoft.Common.CutImage.CutImg(Server.MapPath("~/") + path, miniPath, 100, 75, "h");
                string wPath = Server.MapPath("~/") + filepath + "w_" + filename + System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
                Maticsoft.Common.CutImage.CutImg(Server.MapPath("~/") + path, wPath, 100, 86, "CUT");
            }
            else
            {
                label1.Text = "没有文件,或不支持文件";
                return;
            }
            //保存数据到数据库
            Maticsoft.BLL.WorksGroup   bll = new Maticsoft.BLL.WorksGroup();
            Maticsoft.Model.WorksGroup model = new Maticsoft.Model.WorksGroup();
            model.Title = txtTitle.Text;
            model.Info  = txtsum.Text;
            model.Mark  = int.Parse(txtMark.Text);
            model.No    = bll.GetMaxId();
            model.Atlas = path;//图片路径


            if (bll.Add(model) == 0)
            {
                label1.Text = "插入失败";
            }
            label1.Text = "操作成功";
        }
Exemple #6
0
        protected void bind()
        {
            //艺人艺事
            Maticsoft.BLL.ArtsMatterGroup artsmattergroup = new Maticsoft.BLL.ArtsMatterGroup();
            Repeater1.DataSource = dtbindbig(artsmattergroup.GetList(10, "", "No desc").Tables[0]);
            Repeater1.DataBind();

            //作品
            Maticsoft.BLL.WorksGroup works = new Maticsoft.BLL.WorksGroup();
            //由原图路径转化成缩略图路径W
            Works.DataSource = dtbind(works.GetList(10, "", "No desc").Tables[0]);
            Works.DataBind();

            //新闻动态
            Maticsoft.BLL.NewsGroup newsbll = new Maticsoft.BLL.NewsGroup();
            RepeaterNews.DataSource = dtbind(newsbll.GetList(10, "", "No desc").Tables[0]);
            RepeaterNews.DataBind();
            //同行评价
            Maticsoft.BLL.EvaluateGroup Evabll = new Maticsoft.BLL.EvaluateGroup();
            RepeaterEva.DataSource = dtbind(Evabll.GetList(10, "", "No desc").Tables[0]);
            RepeaterEva.DataBind();
        }
Exemple #7
0
        private void Bind()
        {
            int Id = 0;

            if (Request.QueryString["Id"] != null)
            {
                Id = int.Parse(Request.QueryString["Id"]);
            }
            else
            {
                return;
            }
            Maticsoft.BLL.WorksGroup   bll   = new Maticsoft.BLL.WorksGroup();
            Maticsoft.Model.WorksGroup model = bll.GetModel(Id);
            txtNo.Text      = model.No.ToString();
            txtClick.Text   = model.Click.ToString();
            txtMark.Text    = model.Mark.ToString();
            txtTitle.Text   = model.Title;
            txtTime.Text    = model.Time.ToString();
            txtsum.Text     = model.Info;
            Image1.ImageUrl = model.Atlas;
            label2.Text     = model.ID.ToString();
        }
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     Maticsoft.BLL.WorksGroup bll = new Maticsoft.BLL.WorksGroup();
     bll.Delete(int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString()));
     Bind();
 }
 private void  Bind()
 {
     Maticsoft.BLL.WorksGroup workGroupbll = new Maticsoft.BLL.WorksGroup();
     GridView1.DataSource = workGroupbll.GetAllList().Tables[0].DefaultView;
     GridView1.DataBind();
 }