Exemplo n.º 1
0
 public List<Maticsoft.Model.CMS.VideoClass> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.CMS.VideoClass> list = new List<Maticsoft.Model.CMS.VideoClass>();
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.CMS.VideoClass item = new Maticsoft.Model.CMS.VideoClass();
             if ((dt.Rows[i]["VideoClassID"] != null) && (dt.Rows[i]["VideoClassID"].ToString() != ""))
             {
                 item.VideoClassID = int.Parse(dt.Rows[i]["VideoClassID"].ToString());
             }
             if ((dt.Rows[i]["VideoClassName"] != null) && (dt.Rows[i]["VideoClassName"].ToString() != ""))
             {
                 item.VideoClassName = dt.Rows[i]["VideoClassName"].ToString();
             }
             if ((dt.Rows[i]["ParentID"] != null) && (dt.Rows[i]["ParentID"].ToString() != ""))
             {
                 item.ParentID = new int?(int.Parse(dt.Rows[i]["ParentID"].ToString()));
             }
             if ((dt.Rows[i]["Sequence"] != null) && (dt.Rows[i]["Sequence"].ToString() != ""))
             {
                 item.Sequence = int.Parse(dt.Rows[i]["Sequence"].ToString());
             }
             if ((dt.Rows[i]["Path"] != null) && (dt.Rows[i]["Path"].ToString() != ""))
             {
                 item.Path = dt.Rows[i]["Path"].ToString();
             }
             if ((dt.Rows[i]["Depth"] != null) && (dt.Rows[i]["Depth"].ToString() != ""))
             {
                 item.Depth = int.Parse(dt.Rows[i]["Depth"].ToString());
             }
             list.Add(item);
         }
     }
     return list;
 }
Exemplo n.º 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string str = this.txtVideoClassName.Text.Trim();
     string msg = "";
     if (this.txtVideoClassName.Text.Trim().Length == 0)
     {
         msg = msg + CMSVideo.ErrorClassNameNull + @"\n";
     }
     if (msg != "")
     {
         MessageBox.Show(this, msg);
     }
     else
     {
         Maticsoft.Model.CMS.VideoClass model = new Maticsoft.Model.CMS.VideoClass {
             VideoClassName = str,
             ParentID = new int?(Globals.SafeInt(this.VideoClassDropList1.SelectedValue, 0))
         };
         if (this.bll.AddEx(model) > 0)
         {
             if (this.chkAddContinue.Checked)
             {
                 this.txtVideoClassName.Text = "";
                 MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK);
             }
             else
             {
                 MessageBox.ResponseScript(this, "parent.location.href='List.aspx'");
             }
         }
         else
         {
             MessageBox.ShowFailTip(this, Site.TooltipSaveError);
         }
     }
 }
Exemplo n.º 3
0
 public Maticsoft.Model.CMS.VideoClass GetModelByParentID(int ParentID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select  top 1 VideoClassID,VideoClassName,ParentID,Sequence,Path,Depth from CMS_VideoClass ");
     builder.Append(" where VideoClassID=@ParentID");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ParentID", SqlDbType.Int, 4) };
     cmdParms[0].Value = ParentID;
     Maticsoft.Model.CMS.VideoClass class2 = new Maticsoft.Model.CMS.VideoClass();
     DataSet ds = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (DataSetTools.DataSetIsNull(ds))
     {
         return null;
     }
     if (ds.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if ((ds.Tables[0].Rows[0]["VideoClassID"] != null) && (ds.Tables[0].Rows[0]["VideoClassID"].ToString() != ""))
     {
         class2.VideoClassID = int.Parse(ds.Tables[0].Rows[0]["VideoClassID"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["VideoClassName"] != null) && (ds.Tables[0].Rows[0]["VideoClassName"].ToString() != ""))
     {
         class2.VideoClassName = ds.Tables[0].Rows[0]["VideoClassName"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["ParentID"] != null) && (ds.Tables[0].Rows[0]["ParentID"].ToString() != ""))
     {
         class2.ParentID = new int?(int.Parse(ds.Tables[0].Rows[0]["ParentID"].ToString()));
     }
     if ((ds.Tables[0].Rows[0]["Sequence"] != null) && (ds.Tables[0].Rows[0]["Sequence"].ToString() != ""))
     {
         class2.Sequence = int.Parse(ds.Tables[0].Rows[0]["Sequence"].ToString());
     }
     if ((ds.Tables[0].Rows[0]["Path"] != null) && (ds.Tables[0].Rows[0]["Path"].ToString() != ""))
     {
         class2.Path = ds.Tables[0].Rows[0]["Path"].ToString();
     }
     if ((ds.Tables[0].Rows[0]["Depth"] != null) && (ds.Tables[0].Rows[0]["Depth"].ToString() != ""))
     {
         class2.Depth = int.Parse(ds.Tables[0].Rows[0]["Depth"].ToString());
     }
     return class2;
 }