Ejemplo n.º 1
0
        public void UpdateSYS_WidgetType(SYS_WidgetType sys_WidgetType)
        {
            using (SqlConnection connection = GetConnection())
            {
                SqlCommand command = new SqlCommand("_SYS_WidgetTypeUpdate", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@Type", 1);
                command.Parameters.AddWithValue("@ID", sys_WidgetType.Id);
                command.Parameters.AddWithValue("@WidgetControl", sys_WidgetType.WidgetControl);
                command.Parameters.AddWithValue("@WidgetDir", sys_WidgetType.WidgetDir);
                command.Parameters.AddWithValue("@WidgetInfo", sys_WidgetType.WidgetInfo);
                command.Parameters.AddWithValue("@WidgetTypeName", sys_WidgetType.WidgetTypeName);
                command.Parameters.AddWithValue("@WidgetStatus", sys_WidgetType.WidgetStatus);
                command.Parameters.AddWithValue("@Orders", sys_WidgetType.Orders);

                connection.Open();
                if (command.ExecuteNonQuery() <= 0)
                {
                    throw new DataAccessException("khong cap nhat duoc sys_WidgetType");
                }
                else
                {
                    command.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        public int CreateSYS_WidgetTypeGet(SYS_WidgetType sys_WidgetType)
        {
            int i = 0;

            using (SqlConnection connection = GetConnection())
            {
                SqlCommand command = new SqlCommand("_SYS_WidgetTypeInsert", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@Type", 0);
                command.Parameters.AddWithValue("@Id", 0);
                command.Parameters.AddWithValue("@WidgetControl", sys_WidgetType.WidgetControl);
                command.Parameters.AddWithValue("@WidgetDir", sys_WidgetType.WidgetDir);
                command.Parameters.AddWithValue("@WidgetInfo", sys_WidgetType.WidgetInfo);
                command.Parameters.AddWithValue("@WidgetTypeName", sys_WidgetType.WidgetTypeName);
                command.Parameters.AddWithValue("@WidgetStatus", sys_WidgetType.WidgetStatus);
                command.Parameters.AddWithValue("@Orders", sys_WidgetType.Orders);

                SqlParameter parameter = new SqlParameter("@ReturnId", SqlDbType.Int);
                parameter.Direction = ParameterDirection.ReturnValue;
                command.Parameters.Add(parameter);
                connection.Open();
                if (command.ExecuteNonQuery() <= 0)
                {
                    throw new DataAccessException("Khong them duoc");
                }
                else
                {
                    i = (int)parameter.Value;
                    command.Dispose();
                }
            }
            return(i);
        }
Ejemplo n.º 3
0
        public SYS_WidgetType GetSYS_WidgetTypeById(int Id)
        {
            SYS_WidgetType sys_WidgetType = null;

            using (SqlConnection connection = GetConnection())
            {
                SqlCommand command = new SqlCommand("_SYS_WidgetTypeGetById", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@Id", Id);
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    if (reader.Read())
                    {
                        sys_WidgetType = SYS_WidgetTypeReader(reader);
                    }
                    else
                    {
                        throw new DataAccessException("Khong tim thay gia tri sys_WidgetType");
                    }
                    command.Dispose();
                }
            }
            return(sys_WidgetType);
        }
    private void NavigationTitle(int type)
    {
        SYS_WidgetTypeBSO _widgetTypeBSO = new SYS_WidgetTypeBSO();
        SYS_WidgetType    _widgetType    = _widgetTypeBSO.GetSYS_WidgetTypeById(Convert.ToInt32(Request["type"].ToString()));

        if (_widgetType != null)
        {
            litModules.Text = "Cấu hình " + _widgetType.WidgetTypeName;
        }
    }
    private void NavigationTitle(int type)
    {
        //imgIcon.ImageUrl = "~/images/Admin_Theme/Icons/icon-32-config.png";

        SYS_WidgetTypeBSO _widgetTypeBSO = new SYS_WidgetTypeBSO();
        SYS_WidgetType    _widgetType    = _widgetTypeBSO.GetSYS_WidgetTypeById(Convert.ToInt32(Request["type"].ToString()));

        if (_widgetType != null)
        {
            litModules.Text = "Cấu hình " + _widgetType.WidgetTypeName;
        }
    }
Ejemplo n.º 6
0
        private SYS_WidgetType SYS_WidgetTypeReader(SqlDataReader reader)
        {
            SYS_WidgetType sys_WidgetType = new SYS_WidgetType();

            sys_WidgetType.Id             = (int)reader["Id"];
            sys_WidgetType.WidgetControl  = (string)reader["WidgetControl"];
            sys_WidgetType.WidgetDir      = (string)reader["WidgetDir"];
            sys_WidgetType.WidgetInfo     = (string)reader["WidgetInfo"];
            sys_WidgetType.WidgetTypeName = (string)reader["WidgetTypeName"];
            sys_WidgetType.WidgetStatus   = (bool)reader["WidgetStatus"];
            sys_WidgetType.Orders         = (int)reader["Orders"];

            return(sys_WidgetType);
        }
Ejemplo n.º 7
0
    protected void btn_add_Click_more(object sender, EventArgs e)
    {
        SYS_WidgetTypeBSO _widgetTypeBSO = new SYS_WidgetTypeBSO();
        SYS_WidgetType    _widgetType    = ReceiveHtml();

        try
        {
            int id = _widgetTypeBSO.CreateSYS_WidgetTypeGet(_widgetType);
            error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>";
            AspNetCache.Reset();
            ViewWidgetType();
        }
        catch (Exception ex)
        {
            error.Text = ex.Message.ToString();
        }
    }
Ejemplo n.º 8
0
    protected void Edit()
    {
        SYS_WidgetTypeBSO _widgetTypeBSO = new SYS_WidgetTypeBSO();
        SYS_WidgetType    _widgetType    = ReceiveHtml();

        try
        {
            _widgetTypeBSO.UpdateSYS_WidgetType(_widgetType);
            error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật thành công !</div>";
            initControl(_widgetType.Id);
            ViewWidgetType();
        }
        catch (Exception ex)
        {
            error.Text = ex.Message.ToString();
        }
    }
Ejemplo n.º 9
0
    protected void Add()
    {
        SYS_WidgetTypeBSO _widgetTypeBSO = new SYS_WidgetTypeBSO();
        SYS_WidgetType    _widgetType    = ReceiveHtml();

        try
        {
            int id = _widgetTypeBSO.CreateSYS_WidgetTypeGet(_widgetType);
            error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>";
            initControl(id);
            ViewWidgetType();
        }
        catch (Exception ex)
        {
            error.Text = ex.Message.ToString();
        }
    }
Ejemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie_lang = Request.Cookies["LangInfo_CMS"];

        if (cookie_lang == null || cookie_lang["Lang"] == null || cookie_lang["Lang"] == string.Empty)
        {
            cookie_lang         = new HttpCookie("LangInfo_CMS");
            cookie_lang["Lang"] = "vi-VN";
            cookie_lang.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(cookie_lang);
        }
        Language.language = cookie_lang["Lang"].ToString();
        Session["Lang"]   = cookie_lang["Lang"].ToString();

        Config config = new Config();

        if (AspNetCache.CheckCache("Config_" + Language.language) == false)
        {
            ConfigBSO configBSO = new ConfigBSO();

            config = configBSO.GetAllConfig(Language.language);
            AspNetCache.SetCacheWithTime("Config_" + Language.language, config, 150);
        }
        else
        {
            config = (Config)AspNetCache.GetCache("Config_" + Language.language);
        }
        Page.Title = config.Titleweb;

        if (!string.IsNullOrEmpty(Request["type"]))
        {
            SYS_WidgetTypeBSO _widgetTypeBSO = new SYS_WidgetTypeBSO();
            SYS_WidgetType    _widgetType    = _widgetTypeBSO.GetSYS_WidgetTypeById(Convert.ToInt32(Request["type"].ToString()));

            if (_widgetType != null)
            {
                if (_widgetType.WidgetControl != "")
                {
                    PlaceHolder1.Controls.Add(LoadControl(ResolveUrl("~") + _widgetType.WidgetDir + "/" + _widgetType.WidgetControl));
                }
            }
        }
    }
Ejemplo n.º 11
0
    protected void initControl(int ID)
    {
        if (ID > 0)
        {
            txtID.Value      = Convert.ToString(ID);
            btn_add.Visible  = false;
            btn_edit.Visible = true;

            btn_add1.Visible  = false;
            btn_add2.Visible  = false;
            btn_edit1.Visible = true;

            try
            {
                SYS_WidgetTypeBSO _widgetTypeBSO = new SYS_WidgetTypeBSO();
                SYS_WidgetType    _widgetType    = _widgetTypeBSO.GetSYS_WidgetTypeById(ID);

                txtWidgetTypeName.Text = _widgetType.WidgetTypeName;
                GetFile();
                dropControl.SelectedValue = _widgetType.WidgetControl;
                hddDir.Value      = _widgetType.WidgetDir;
                txtInfo.Text      = _widgetType.WidgetInfo;
                chkStatus.Checked = _widgetType.WidgetStatus;
                hddOrders.Value   = _widgetType.Orders.ToString();
            }
            catch (Exception ex)
            {
                error.Text = ex.Message.ToString();
            }
        }
        else
        {
            GetFile();
            txtID.Value      = "";
            btn_add.Visible  = true;
            btn_edit.Visible = false;

            btn_add1.Visible  = true;
            btn_add2.Visible  = true;
            btn_edit1.Visible = false;
        }
    }
Ejemplo n.º 12
0
    public SYS_WidgetType ReceiveHtml()
    {
        SYS_WidgetType _widgetType = new SYS_WidgetType();

        _widgetType.Id             = (txtID.Value != "") ? Convert.ToInt32(txtID.Value) : 0;
        _widgetType.WidgetTypeName = (txtWidgetTypeName.Text != "") ? txtWidgetTypeName.Text.Trim() : "";

        _widgetType.WidgetDir = (hddDir.Value != "") ? hddDir.Value : strParentFolder;

        if (dropControl.SelectedIndex > 0)
        {
            _widgetType.WidgetControl = dropControl.SelectedValue;
        }
        //_widgetType.WidgetControl = (dropControl.SelectedValue != "") ? dropControl.SelectedValue.Replace(".ascx", "") : "";
        _widgetType.WidgetInfo   = txtInfo.Text;
        _widgetType.WidgetStatus = chkStatus.Checked;
        _widgetType.Orders       = (hddOrders.Value != "") ? Convert.ToInt32(hddOrders.Value) : 0;

        return(_widgetType);
    }
Ejemplo n.º 13
0
        public void UpdateSYS_WidgetType(SYS_WidgetType sys_WidgetType)
        {
            SYS_WidgetTypeDAO sys_WidgetTypeDAO = new SYS_WidgetTypeDAO();

            sys_WidgetTypeDAO.UpdateSYS_WidgetType(sys_WidgetType);
        }
Ejemplo n.º 14
0
        public int CreateSYS_WidgetTypeGet(SYS_WidgetType sys_WidgetType)
        {
            SYS_WidgetTypeDAO sys_WidgetTypeDAO = new SYS_WidgetTypeDAO();

            return(sys_WidgetTypeDAO.CreateSYS_WidgetTypeGet(sys_WidgetType));
        }