Ejemplo n.º 1
0
        public bool Modify(menulevel2Data datmenulevel2)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update menulevel2 set level1id=@level1id,menutype=@menutype,menuname=@menuname,menuurl=@menuurl,nums=@nums where Id = @Id";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@level1id", datmenulevel2.level1id);
                objDB.Command.Parameters.AddWithValue("@menutype", datmenulevel2.menutype);
                objDB.Command.Parameters.AddWithValue("@menuname", datmenulevel2.menuname);
                objDB.Command.Parameters.AddWithValue("@menuurl", datmenulevel2.menuurl);
                objDB.Command.Parameters.AddWithValue("@nums", datmenulevel2.nums);
                objDB.Command.Parameters.AddWithValue("@Id", datmenulevel2.Id);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            { iRel = -1; }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false); return(bRel);
        }
Ejemplo n.º 2
0
        public menulevel2Data[] Select(string Id)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB         = new DataAccess.CommonDB();
            menulevel2Data[]    datmenulevel2 = new menulevel2Data[1];
            string sql = "select * from menulevel2 where Id= " + Id + " ";

            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        datmenulevel2 = new menulevel2Data[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            datmenulevel2[i]          = new menulevel2Data();
                            datmenulevel2[i].level1id = ds.Tables[0].Rows[i]["level1id"].ToString();
                            datmenulevel2[i].menutype = ds.Tables[0].Rows[i]["menutype"].ToString();
                            datmenulevel2[i].menuname = ds.Tables[0].Rows[i]["menuname"].ToString();
                            datmenulevel2[i].menuurl  = ds.Tables[0].Rows[i]["menuurl"].ToString();
                            datmenulevel2[i].nums     = ds.Tables[0].Rows[i]["nums"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datmenulevel2);
        }