Ejemplo n.º 1
0
 public Mod ModIDataReader(IDataReader dr)
 {
     Data.Mod obj = new Data.Mod();
     obj.Id          = (dr["Id"] is DBNull) ? string.Empty : dr["Id"].ToString();
     obj.Mod_Parent  = (dr["Mod_Parent"] is DBNull) ? string.Empty : dr["Mod_Parent"].ToString();
     obj.Mod_Name    = (dr["Mod_Name"] is DBNull) ? string.Empty : dr["Mod_Name"].ToString();
     obj.Mod_Code    = (dr["Mod_Code"] is DBNull) ? string.Empty : dr["Mod_Code"].ToString();
     obj.Modtype_ID  = (dr["Modtype_ID"] is DBNull) ? string.Empty : dr["Modtype_ID"].ToString();
     obj.Mod_Url     = (dr["Mod_Url"] is DBNull) ? string.Empty : dr["Mod_Url"].ToString();
     obj.Mod_Img     = (dr["Mod_Img"] is DBNull) ? string.Empty : dr["Mod_Img"].ToString();
     obj.Mod_Title   = (dr["Mod_Title"] is DBNull) ? string.Empty : dr["Mod_Title"].ToString();
     obj.Mod_Key     = (dr["Mod_Key"] is DBNull) ? string.Empty : dr["Mod_Key"].ToString();
     obj.Mod_Meta    = (dr["Mod_Meta"] is DBNull) ? string.Empty : dr["Mod_Meta"].ToString();
     obj.Mod_Content = (dr["Mod_Content"] is DBNull) ? string.Empty : dr["Mod_Content"].ToString();
     obj.Mod_Status  = (dr["Mod_Status"] is DBNull) ? string.Empty : dr["Mod_Status"].ToString();
     obj.Mod_Hot     = (dr["Mod_Hot"] is DBNull) ? string.Empty : dr["Mod_Hot"].ToString();
     obj.Mod_Pos     = (dr["Mod_Pos"] is DBNull) ? string.Empty : dr["Mod_Pos"].ToString();
     obj.Mod_Level   = (dr["Mod_Level"] is DBNull) ? string.Empty : dr["Mod_Level"].ToString();
     obj.Lang        = (dr["Lang"] is DBNull) ? string.Empty : dr["Lang"].ToString();
     obj.Mod_style   = (dr["Mod_style"] is DBNull) ? string.Empty : dr["Mod_style"].ToString();
     obj.Mod_Tag     = (dr["Mod_Tag"] is DBNull) ? string.Empty : dr["Mod_Tag"].ToString();
     obj.Mod_Intro   = (dr["Mod_Intro"] is DBNull) ? string.Empty : dr["Mod_Intro"].ToString();
     obj.Mod_Same    = (dr["Mod_Same"] is DBNull) ? string.Empty : dr["Mod_Same"].ToString();
     return(obj);
 }
Ejemplo n.º 2
0
        public List <Mod> Mod_GetById(string Id)
        {
            List <Data.Mod> list = new List <Mod>();

            using (SqlCommand dbCmd = new SqlCommand("sp_Mod_GetById", GetConnection()))
            {
                Data.Mod obj = new Data.Mod();
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@Id", Id));
                SqlDataReader dr = dbCmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        list.Add(obj.ModIDataReader(dr));
                    }
                }
                dr.Close();
                obj = null;
            }
            return(list);
        }
Ejemplo n.º 3
0
        public List <Mod> Mod_GetByType(string Top, string Where, string Order)
        {
            List <Data.Mod> list = new List <Mod>();

            using (SqlCommand dbCmd = new SqlCommand("sp_Mod_GetByType", GetConnection()))
            {
                Data.Mod obj = new Data.Mod();
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@Top", Top));
                dbCmd.Parameters.Add(new SqlParameter("@Where", Where));
                dbCmd.Parameters.Add(new SqlParameter("@Order", Order));
                SqlDataReader dr = dbCmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        list.Add(obj.ModIDataReader(dr));
                    }
                    dr.Close();
                    obj = null;
                }
                return(list);
            }
        }
Ejemplo n.º 4
0
        protected void Update_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                Data.Mod obj = new Data.Mod();
                obj.Mod_Parent  = ddlParent.SelectedValue;
                obj.Mod_Name    = txtMod_Name.Text;
                obj.Mod_Code    = txtMod_Code.Text;
                obj.Modtype_ID  = ddltype.SelectedValue;
                obj.Mod_Img     = txtMod_Img.Text;
                obj.Mod_Title   = txtMod_Title.Text;
                obj.Mod_Key     = txtMod_Key.Text;
                obj.Mod_Meta    = txtMod_Meta.Text;
                obj.Mod_Content = fckContentDetail.Text;
                obj.Mod_Intro   = fckIntro.Text;
                obj.Mod_Status  = chkStatus.Checked ? "1" : "0";
                obj.Mod_Same    = chk_Same.Checked ? "1" : "0";
                obj.Mod_Hot     = chkHot.Checked ? "1" : "0";
                obj.Mod_Pos     = txtMod_Pos.Text;
                obj.Lang        = Lang;
                obj.Mod_style   = txtMod_style.Text;
                //chọn tùy chỉnh liên kết
                if (ddltype.SelectedValue == "0")
                {
                    obj.Mod_Url = txtMod_Url.Text;
                    obj.Mod_Tag = "";
                }
                else
                {
                    obj.Mod_Url = "/" + StringClass.NameToTag(txtMod_Name.Text) + ".html";
                }
                if (ddlParent.SelectedValue == "0")
                {
                    obj.Mod_Level = "1";
                }
                else
                {
                    obj.Mod_Level = "" + tanglevel(ddlParent.SelectedValue) + "";
                }
                //trung tag
                if (chk_Same.Checked == true)
                {
                    obj.Mod_Tag = txtMod_Tag.Text;
                    obj.Mod_Url = "/" + txtMod_Tag.Text + ".html";
                }
                else
                {
                    obj.Mod_Tag = StringClass.NameToTag(txtMod_Name.Text);
                }

                if (Request.QueryString["editId"] != null && txtId.Text.Length > 0)
                {
                    obj.Id = txtId.Text;
                    ModBUS.Mod_Update(obj);
                }
                if (Request.QueryString["subId"] != null && txtSubId.Text.Length > 0)
                {
                    obj.Mod_Parent = txtSubId.Text;
                    ModBUS.Mod_Insert(obj);
                }
                if (Request.QueryString["add"] != null && txtId.Text.Length == 0)
                {
                    ModBUS.Mod_Insert(obj);
                }
                Response.Redirect("/Admins/Mod.aspx");
                pnUpdate.Visible = false;
            }
        }