コード例 #1
0
ファイル: Picture.cs プロジェクト: kevlens/kfsmanager
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Picture DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Picture model=new Maticsoft.Model.Picture();
     if (row != null)
     {
         if(row["ID"]!=null && row["ID"].ToString()!="")
         {
             model.ID=int.Parse(row["ID"].ToString());
         }
         if(row["PicUrl"]!=null)
         {
             model.PicUrl=row["PicUrl"].ToString();
         }
         if(row["PicType"]!=null)
         {
             model.PicType=row["PicType"].ToString();
         }
         if(row["Belong"]!=null)
         {
             model.Belong=row["Belong"].ToString();
         }
     }
     return model;
 }
コード例 #2
0
ファイル: VideoDetails.cs プロジェクト: kevlens/kfsmanager
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtVideoUrlF.Text.Length > 0)
            {
                if (common.videomode == "update")
                {
                    try
                    {
                        Maticsoft.Model.Video model = bll.GetModel(int.Parse(common.videoid));
                        Maticsoft.Model.Picture picturemodel = picturebll.GetModelList("PicType='视频' and Belong='" + model.VideoName + "'")[0];
                        model.AddTime = DateTime.Now;
                        model.AddUser = common.loginuser;
                        model.VideoName = txtVideoName.Text;
                        model.VideoUrl = txtVideoUrlF.Text;
                        picturemodel.PicUrl = txtVideoImg.Text;
                        bll.Update(model);
                        picturebll.Update(picturemodel);
                        MessageBox.Show("保存成功");

                    }
                    catch { MessageBox.Show("保存失败"); }

                }
                else
                {
                    try
                    {
                        Maticsoft.Model.Video model = new Maticsoft.Model.Video();
                        Maticsoft.Model.Picture picturemodel = new Maticsoft.Model.Picture();
                        model.AddTime = DateTime.Now;
                        model.AddUser = common.loginuser;
                        model.VideoName = txtVideoName.Text;
                        model.VideoUrl = txtVideoUrlF.Text;
                        picturemodel.PicUrl = txtVideoUrl.Text;
                        picturemodel.PicType = "视频";
                        picturemodel.Belong = txtVideoName.Text;
                        bll.Add(model);
                        picturebll.Add(picturemodel);
                        MessageBox.Show("保存成功");

                    }
                    catch { MessageBox.Show("保存失败"); }
                }
            }
            else
            {
                MessageBox.Show("请输入内容");
            }
        }
コード例 #3
0
ファイル: Picture.cs プロジェクト: kevlens/kfsmanager
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Picture GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ID,PicUrl,PicType,Belong from Picture ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)
            };
            parameters[0].Value = ID;

            Maticsoft.Model.Picture model=new Maticsoft.Model.Picture();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }