Пример #1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                numcol = UpDownNumOfColumn.Value.ToString();
                if (numcol != "")
                {
                    db = new QMSSystemEntities();
                    Q_Config model = db.Q_Config.FirstOrDefault(x => !x.IsDeleted && x.IsActived && x.Code.Trim().ToUpper().Equals(eConfigCode.Column));
                    if (model != null)
                    {
                        model.Value = numcol;
                        BLLConfig.Instance.UpdateConfigValueFromInterface(model);
                        //if (MessageBox.Show("Điều chỉnh này chỉ có tác dụng khi bạn khởi động lại chương trình", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
                        //    this.Close();

                        for (int i = 0; i < frm.Controls.Count; i++)
                        {
                            if (frm.Controls[i] is Button && frm.Controls[i].Name.StartsWith(eConfigCode.ButtonName))
                            {
                                frm.Controls.RemoveAt(i);
                                i--;
                            }
                        }
                        frm.frmIssueTicketScreen_Load(sender, e);
                    }
                }
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi:" + ex.Message);
            }
        }
Пример #2
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            db = new QMSSystemEntities(connect);
            Q_Config model;

            width  = UpDownButtonWidth.Value.ToString();
            heigth = UpDownButtonHeight.Value.ToString();
            space  = UpDownButtonSpace.Value.ToString();
            if (backcolor != "")
            {
                model       = db.Q_Config.FirstOrDefault(x => !x.IsDeleted && x.IsActived && x.Code.Trim().ToUpper().Equals(eConfigCode.ButtonBackColor));
                model.Value = backcolor;
                BLLConfig.Instance.UpdateConfigValueFromInterface(connect, model);
            }

            if (forecolor != "")
            {
                model       = db.Q_Config.FirstOrDefault(x => !x.IsDeleted && x.IsActived && x.Code.Trim().ToUpper().Equals(eConfigCode.ButtonForeColor));
                model.Value = forecolor;
                BLLConfig.Instance.UpdateConfigValueFromInterface(connect, model);
            }

            if (fontstr != "")
            {
                model       = db.Q_Config.FirstOrDefault(x => !x.IsDeleted && x.IsActived && x.Code.Trim().ToUpper().Equals(eConfigCode.ButtonFont));
                model.Value = fontstr;
                BLLConfig.Instance.UpdateConfigValueFromInterface(connect, model);
            }

            if (width != "")
            {
                model       = db.Q_Config.FirstOrDefault(x => !x.IsDeleted && x.IsActived && x.Code.Trim().ToUpper().Equals(eConfigCode.ButtonWidth));
                model.Value = width;
                BLLConfig.Instance.UpdateConfigValueFromInterface(connect, model);
            }

            if (heigth != "")
            {
                model       = db.Q_Config.FirstOrDefault(x => !x.IsDeleted && x.IsActived && x.Code.Trim().ToUpper().Equals(eConfigCode.ButtonHeight));
                model.Value = heigth;
                BLLConfig.Instance.UpdateConfigValueFromInterface(connect, model);
            }

            if (space != "")
            {
                model       = db.Q_Config.FirstOrDefault(x => !x.IsDeleted && x.IsActived && x.Code.Trim().ToUpper().Equals(eConfigCode.ButtonSpace));
                model.Value = space;
                BLLConfig.Instance.UpdateConfigValueFromInterface(connect, model);
            }

            //if (MessageBox.Show("Điều chỉnh này chỉ có tác dụng khi bạn khởi động lại chương trình", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
            //    this.Close();

            for (int i = 0; i < frm.Controls.Count; i++)
            {
                if (frm.Controls[i] is Button && frm.Controls[i].Name.StartsWith(eConfigCode.ButtonName))
                {
                    frm.Controls.RemoveAt(i);
                    i--;
                }
            }
            frm.frmIssueTicketScreen_Load(sender, e);
            this.Close();
        }