Ejemplo n.º 1
0
    protected void btn_copy_Click(object sender, EventArgs e)
    {
        DataTable datatable = WidgetID();
        SYS_WidgetPageLayoutBSO _widgetBSO = new SYS_WidgetPageLayoutBSO();
        SYS_WidgetPageLayout    _widget    = new SYS_WidgetPageLayout();

        try
        {
            if (datatable.Rows.Count > 0)
            {
                foreach (DataRow subrow in datatable.Rows)
                {
                    _widget = _widgetBSO.GetSYS_WidgetPageLayoutById(Convert.ToInt32(subrow["Id"].ToString()));
                    if (ddlPageLayout2.SelectedIndex > 0)
                    {
                        _widget.PageLayoutId = Convert.ToInt32(ddlPageLayout2.SelectedValue);
                        _widget.RegionId     = ddlRegion2.SelectedValue;
                        _widgetBSO.CreateSYS_WidgetPageLayoutGet(_widget);
                    }
                }
                error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật Thành công !</div>";

                ViewWidgetAll2(Convert.ToInt32(ddlPageLayout2.SelectedValue), ddlRegion2.SelectedValue);
            }
        }
        catch (Exception ex)
        {
            error.Text = ex.Message.ToString();
        }
    }
Ejemplo n.º 2
0
        public SYS_WidgetPageLayout GetSYS_WidgetPageLayoutById(int Id)
        {
            SYS_WidgetPageLayout sys_WidgetPageLayout = null;

            using (SqlConnection connection = GetConnection())
            {
                SqlCommand command = new SqlCommand("_SYS_WidgetPageLayoutGetById", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@Id", Id);
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    if (reader.Read())
                    {
                        sys_WidgetPageLayout = SYS_WidgetPageLayoutReader(reader);
                    }
                    else
                    {
                        throw new DataAccessException("Khong tim thay gia tri sys_WidgetPageLayout");
                    }
                    command.Dispose();
                }
            }
            return(sys_WidgetPageLayout);
        }
    public SYS_WidgetPageLayout ReceiveHtml()
    {
        SYS_WidgetPageLayout _widgetPageLayout = new SYS_WidgetPageLayout();

        //string path = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Upload/Widgets/Icons/";
        //commonBSO commonBSO = new commonBSO();
        //ConfigBSO configBSO = new ConfigBSO();
        //Config _config = configBSO.GetAllConfig(Language.language);

        //string icon_upload = commonBSO.UploadImage(uploadIcon, path, Convert.ToInt32(_config.New_thumb_w), Convert.ToInt32(_config.New_thumb_h));

        _widgetPageLayout.Id           = (txtID.Value != "") ? Convert.ToInt32(txtID.Value) : 0;
        _widgetPageLayout.PageLayoutId = (ddlPageLayout.SelectedValue != "") ? Convert.ToInt32(ddlPageLayout.SelectedValue) : 0;
        _widgetPageLayout.WidgetId     = (ddlWidget.SelectedValue != "") ? Convert.ToInt32(ddlWidget.SelectedValue) : 0;

        _widgetPageLayout.RegionId = (ddlRegion.SelectedValue != "") ? ddlRegion.SelectedValue : "";

        _widgetPageLayout.Title  = (txtWidgetTitle.Text != "") ? txtWidgetTitle.Text.Trim() : "";
        _widgetPageLayout.Orders = (hddOrders.Value != "") ? Convert.ToInt32(hddOrders.Value) : 0;
        _widgetPageLayout.Status = chkStatus.Checked;
        _widgetPageLayout.Icon   = (hddIcon.Value != "") ? hddIcon.Value : hddIcon.Value;

        _widgetPageLayout.Info    = (hddRadInfo.Value != "") ? hddRadInfo.Value.Trim() : "";
        _widgetPageLayout.HTML    = (hddRadHTML.Value != "") ? hddRadHTML.Value.Trim() : "";
        _widgetPageLayout.Value   = (lboGallary.SelectedIndex >= 0) ? lboGallary.SelectedValue : "0";   //sửa
        _widgetPageLayout.Value2  = (lboGallary2.SelectedIndex >= 0) ? lboGallary2.SelectedValue : "0"; //sửa
        _widgetPageLayout.Record  = (txtRecord.Text != "") ? Convert.ToInt32(txtRecord.Text) : 5;       //sửa
        _widgetPageLayout.Record2 = (txtRecord2.Text != "") ? Convert.ToInt32(txtRecord2.Text) : 5;     //sửa

        _widgetPageLayout.Language = Language.language;

        return(_widgetPageLayout);
    }
Ejemplo n.º 4
0
 public void UpdateSYS_WidgetPageLayout(SYS_WidgetPageLayout sys_WidgetPageLayout)
 {
     using (SqlConnection connection = GetConnection())
     {
         SqlCommand command = new SqlCommand("_SYS_WidgetPageLayoutUpdate", connection);
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.AddWithValue("@Type", 1);
         command.Parameters.AddWithValue("@ID", sys_WidgetPageLayout.Id);
         command.Parameters.AddWithValue("@PageLayoutId", sys_WidgetPageLayout.PageLayoutId);
         command.Parameters.AddWithValue("@RegionId", sys_WidgetPageLayout.RegionId);
         command.Parameters.AddWithValue("@WidgetId", sys_WidgetPageLayout.WidgetId);
         command.Parameters.AddWithValue("@HTML", sys_WidgetPageLayout.HTML);
         command.Parameters.AddWithValue("@Icon", sys_WidgetPageLayout.Icon);
         command.Parameters.AddWithValue("@Info", sys_WidgetPageLayout.Info);
         command.Parameters.AddWithValue("@Orders", sys_WidgetPageLayout.Orders);
         command.Parameters.AddWithValue("@Record", sys_WidgetPageLayout.Record);
         command.Parameters.AddWithValue("@Record2", sys_WidgetPageLayout.Record2);
         command.Parameters.AddWithValue("@Status", sys_WidgetPageLayout.Status);
         command.Parameters.AddWithValue("@Title", sys_WidgetPageLayout.Title);
         command.Parameters.AddWithValue("@Value", sys_WidgetPageLayout.Value);
         command.Parameters.AddWithValue("@Value2", sys_WidgetPageLayout.Value2);
         command.Parameters.AddWithValue("@Language", sys_WidgetPageLayout.Language);
         connection.Open();
         if (command.ExecuteNonQuery() <= 0)
         {
             throw new DataAccessException("khong cap nhat duoc sys_WidgetPageLayout");
         }
         else
         {
             command.Dispose();
         }
     }
 }
Ejemplo n.º 5
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_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO();
                SYS_WidgetPageLayout    _widgetPageLayout    = _widgetPageLayoutBSO.GetSYS_WidgetPageLayoutById(ID);

                Bind_ddlPageLayout();
                ddlPageLayout.SelectedValue = Convert.ToString(_widgetPageLayout.PageLayoutId);

                //Bind_ddlWidgetType();
                Bind_ddlWidget(0);
                ddlWidget.SelectedValue = Convert.ToString(_widgetPageLayout.WidgetId);

                GetRegion();
                ddlRegion.SelectedValue = _widgetPageLayout.RegionId;

                txtWidgetTitle.Text = _widgetPageLayout.Title;
                hddIcon.Value       = _widgetPageLayout.Icon;
                //if (_widgetPageLayout.Icon != "")
                //    ltl_icon.Text = "<img src='" + ResolveUrl("~/") + "Upload/Widgets/Icons/" + _widgetPageLayout.Icon + "' width='48px'>";
                chkStatus.Checked = _widgetPageLayout.Status;

                hddRadInfo.Value = _widgetPageLayout.Info;
                hddRadHTML.Value = _widgetPageLayout.HTML;

                BindListCate(_widgetPageLayout.Value);
                BindToCateNewsGroup();
                BindToCateNews(Convert.ToInt32(lboGroupCate.SelectedValue));

                txtRecord.Text = _widgetPageLayout.Record.ToString();//sửa

                hddRecord2.Value = _widgetPageLayout.Record2.ToString();
                //lboGallary.SelectedValue = _widgetPageLayout.Value;  //sửa

                hddValue2.Value = _widgetPageLayout.Value2;
                hddOrders.Value = _widgetPageLayout.Orders.ToString();
            }
            catch (Exception ex)
            {
                error.Text = ex.Message.ToString();
            }
        }
        else
        {
            Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = CloseWindow();");
        }
    }
Ejemplo n.º 6
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["id"]))
        {
            SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO();
            SYS_WidgetPageLayout    _widgetPageLayout    = _widgetPageLayoutBSO.GetSYS_WidgetPageLayoutById(Convert.ToInt32(Request["id"].ToString()));

            if (_widgetPageLayout != null)
            {
                SYS_WidgetBSO _widgetBSO = new SYS_WidgetBSO();
                SYS_Widget    _widget    = _widgetBSO.GetSYS_WidgetById(_widgetPageLayout.WidgetId);
                if (_widget != null)
                {
                    if (_widget.WidgetControl != "")
                    {
                        Control objControl1 = (Control)this.Page.LoadControl(ResolveUrl("~") + "Client/Modules/" + _widget.WidgetDir + "/" + _widget.WidgetControl + ".ascx");
                        objControl1.ID = _widgetPageLayout.Id.ToString();
                        PlaceHolder1.Controls.Add(objControl1);

                        //  PlaceHolder1.Controls.Add(LoadControl(ResolveUrl("~") + _widget.WidgetDir + "/" + _widget.WidgetControl));

                        ControlAddParameter(objControl1, _widgetPageLayout.Title, _widgetPageLayout.Icon, _widgetPageLayout.Value, Convert.ToInt32(_widgetPageLayout.Record), _widgetPageLayout.Info, _widgetPageLayout.Value2, Convert.ToInt32(_widgetPageLayout.Record2), _widgetPageLayout.HTML);
                    }
                }
            }
        }
    }
    protected void btn_add_Click_more(object sender, EventArgs e)
    {
        SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO();
        SYS_WidgetPageLayout    _widgetPageLayout    = ReceiveHtml();

        try
        {
            int id = _widgetPageLayoutBSO.CreateSYS_WidgetPageLayoutGet(_widgetPageLayout);
            error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>";
            AspNetCache.Reset();
        }
        catch (Exception ex)
        {
            error.Text = ex.Message.ToString();
        }
    }
    protected void Edit()
    {
        SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO();
        SYS_WidgetPageLayout    _widgetPageLayout    = ReceiveHtml();

        try
        {
            _widgetPageLayoutBSO.UpdateSYS_WidgetPageLayout(_widgetPageLayout);
            error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật thành công !</div>";
            initControl(_widgetPageLayout.Id);
        }
        catch (Exception ex)
        {
            error.Text = ex.Message.ToString();
        }
    }
    protected void btn_add_Click_more(object sender, EventArgs e)
    {
        SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO();
        SYS_WidgetPageLayout    _widgetPageLayout    = ReceiveHtml();

        try
        {
            int id = _widgetPageLayoutBSO.CreateSYS_WidgetPageLayoutGet(_widgetPageLayout);
            error.Text = "<div style='color:#ff0000;font:bold 12px Arial;padding:5px 0;'>Thêm mới thành công !</div>";
            AspNetCache.Reset();
        }
        catch (Exception ex)
        {
            error.Text = ex.Message.ToString();
        }
    }
    protected void Add()
    {
        SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO();
        SYS_WidgetPageLayout    _widgetPageLayout    = ReceiveHtml();

        try
        {
            int id = _widgetPageLayoutBSO.CreateSYS_WidgetPageLayoutGet(_widgetPageLayout);
            error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>";
            initControl(id);
        }
        catch (Exception ex)
        {
            error.Text = ex.Message.ToString();
        }
    }
    protected void Edit()
    {
        SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO();
        SYS_WidgetPageLayout    _widgetPageLayout    = ReceiveHtml();

        try
        {
            _widgetPageLayoutBSO.UpdateSYS_WidgetPageLayout(_widgetPageLayout);
            error.Text = "<div style='color:#ff0000;font:bold 12px Arial;padding:5px 0;'>Cập nhật thành công !</div>";
            initControl(_widgetPageLayout.Id);
        }
        catch (Exception ex)
        {
            error.Text = ex.Message.ToString();
        }
    }
    protected void Add()
    {
        SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO();
        SYS_WidgetPageLayout    _widgetPageLayout    = ReceiveHtml();

        try
        {
            int id = _widgetPageLayoutBSO.CreateSYS_WidgetPageLayoutGet(_widgetPageLayout);
            error.Text = "<div style='color:#ff0000;font:bold 12px Arial;padding:5px 0;'>Thêm mới thành công !</div>";
            initControl(id);
        }
        catch (Exception ex)
        {
            error.Text = ex.Message.ToString();
        }
    }
Ejemplo n.º 13
0
        public int CreateSYS_WidgetPageLayoutGet(SYS_WidgetPageLayout sys_WidgetPageLayout)
        {
            int i = 0;

            using (SqlConnection connection = GetConnection())
            {
                SqlCommand command = new SqlCommand("_SYS_WidgetPageLayoutInsert", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@Type", 0);
                command.Parameters.AddWithValue("@Id", 0);
                command.Parameters.AddWithValue("@PageLayoutId", sys_WidgetPageLayout.PageLayoutId);
                command.Parameters.AddWithValue("@RegionId", sys_WidgetPageLayout.RegionId);
                command.Parameters.AddWithValue("@WidgetId", sys_WidgetPageLayout.WidgetId);
                command.Parameters.AddWithValue("@HTML", sys_WidgetPageLayout.HTML);
                command.Parameters.AddWithValue("@Icon", sys_WidgetPageLayout.Icon);
                command.Parameters.AddWithValue("@Info", sys_WidgetPageLayout.Info);
                command.Parameters.AddWithValue("@Orders", sys_WidgetPageLayout.Orders);
                command.Parameters.AddWithValue("@Record", sys_WidgetPageLayout.Record);
                command.Parameters.AddWithValue("@Record2", sys_WidgetPageLayout.Record2);
                command.Parameters.AddWithValue("@Status", sys_WidgetPageLayout.Status);
                command.Parameters.AddWithValue("@Title", sys_WidgetPageLayout.Title);
                command.Parameters.AddWithValue("@Value", sys_WidgetPageLayout.Value);
                command.Parameters.AddWithValue("@Value2", sys_WidgetPageLayout.Value2);
                command.Parameters.AddWithValue("@Language", sys_WidgetPageLayout.Language);

                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.º 14
0
        private SYS_WidgetPageLayout SYS_WidgetPageLayoutReader(SqlDataReader reader)
        {
            SYS_WidgetPageLayout sys_WidgetPageLayout = new SYS_WidgetPageLayout();

            sys_WidgetPageLayout.Id           = (int)reader["Id"];
            sys_WidgetPageLayout.PageLayoutId = (int)reader["PageLayoutId"];
            sys_WidgetPageLayout.RegionId     = (string)reader["RegionId"];
            sys_WidgetPageLayout.WidgetId     = (int)reader["WidgetId"];
            sys_WidgetPageLayout.HTML         = (string)reader["HTML"];
            sys_WidgetPageLayout.Icon         = (string)reader["Icon"];
            sys_WidgetPageLayout.Info         = (string)reader["Info"];
            sys_WidgetPageLayout.Orders       = (int)reader["Orders"];
            sys_WidgetPageLayout.Record       = (int)reader["Record"];
            sys_WidgetPageLayout.Record2      = (int)reader["Record2"];
            sys_WidgetPageLayout.Status       = (bool)reader["Status"];
            sys_WidgetPageLayout.Title        = (string)reader["Title"];
            sys_WidgetPageLayout.Value        = (string)reader["Value"];
            sys_WidgetPageLayout.Value2       = (string)reader["Value2"];
            sys_WidgetPageLayout.Language     = (string)reader["Language"];


            return(sys_WidgetPageLayout);
        }
Ejemplo n.º 15
0
        public void UpdateSYS_WidgetPageLayout(SYS_WidgetPageLayout sys_WidgetPageLayout)
        {
            SYS_WidgetPageLayoutDAO sys_WidgetPageLayoutDAO = new SYS_WidgetPageLayoutDAO();

            sys_WidgetPageLayoutDAO.UpdateSYS_WidgetPageLayout(sys_WidgetPageLayout);
        }
Ejemplo n.º 16
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_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO();
                SYS_WidgetPageLayout    _widgetPageLayout    = _widgetPageLayoutBSO.GetSYS_WidgetPageLayoutById(ID);

                // Bind_ddlPageLayout();
                // ddlPageLayout.SelectedValue = Convert.ToString(_widgetPageLayout.PageLayoutId);
                hddPageLayout.Value = Convert.ToString(_widgetPageLayout.PageLayoutId);

                GetRegion(_widgetPageLayout.PageLayoutId);
                ddlRegion.SelectedValue = _widgetPageLayout.RegionId;

                Bind_ddlWidgetType();
                Bind_ddlWidget(0);
                ddlWidget.SelectedValue = Convert.ToString(_widgetPageLayout.WidgetId);

                txtWidgetTitle.Text = _widgetPageLayout.Title;
                hddIcon.Value       = _widgetPageLayout.Icon;
                //if (_widgetPageLayout.Icon != "")
                //    ltl_icon.Text = "<img src='" + ResolveUrl("~/") + "Upload/Widgets/Icons/" + _widgetPageLayout.Icon + "' width='48px'>";
                chkStatus.Checked = _widgetPageLayout.Status;

                hddRadInfo.Value = _widgetPageLayout.Info;
                hddRadHTML.Value = _widgetPageLayout.HTML;
                hddRecord.Value  = _widgetPageLayout.Record.ToString();
                hddRecord2.Value = _widgetPageLayout.Record2.ToString();
                hddValue.Value   = _widgetPageLayout.Value;
                hddValue2.Value  = _widgetPageLayout.Value2;
                hddOrders.Value  = _widgetPageLayout.Orders.ToString();
            }
            catch (Exception ex)
            {
                error.Text = ex.Message.ToString();
            }
        }
        else
        {
            // Bind_ddlPageLayout();
            Bind_ddlWidgetType();
            Bind_ddlWidget(0);
            txtID.Value = "";
            GetRegion(Convert.ToInt32(hddPageLayout.Value));
            // ddlPageLayout.SelectedIndex = 0;
            btn_add.Visible  = true;
            btn_edit.Visible = false;

            btn_add1.Visible  = true;
            btn_add2.Visible  = true;
            btn_edit1.Visible = false;
        }
    }
Ejemplo n.º 17
0
        public int CreateSYS_WidgetPageLayoutGet(SYS_WidgetPageLayout sys_WidgetPageLayout)
        {
            SYS_WidgetPageLayoutDAO sys_WidgetPageLayoutDAO = new SYS_WidgetPageLayoutDAO();

            return(sys_WidgetPageLayoutDAO.CreateSYS_WidgetPageLayoutGet(sys_WidgetPageLayout));
        }