Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int    category_id = AddQuation.getCatId(this.cmbInfoCategory.Text);
            string answer      = this.txtInfoAnswer.Text;
            string sql         = "UPDATE Quations SET answer = '" + answer + "', category_id = " + category_id;

            if (ofd.FileName != "")
            {
                string imageName = DateTime.Now.ToString("yyyyMMddHHssmm") + ofd.SafeFileName;
                Extentions.ImageUpload(ofd, imageName, "Quations_Images");
                Extentions.DeleteFile(this.seleced.Image, "Quations_Images");
                sql += ", image = '" + imageName + "' WHERE id = " + this.seleced.Id;
            }
            else
            {
                sql += " WHERE id = " + this.seleced.Id;
            }

            SQLiteCommand com = new SQLiteCommand(sql, con);

            con.Open();
            com.ExecuteNonQuery();
            con.Close();
            //this.fillPanel(this.getAllQuations());
            int id = AddQuation.getCatId(this.cmbCategory.Text);

            this.fillPanel(this.getAllQuations(null, id));
            this.grpInfo.Visible = false;
        }
Exemplo n.º 2
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.grpInfo.Visible = false;
            this.selectedNumber  = null;
            int id = AddQuation.getCatId(this.cmbCategory.Text);

            this.fillPanel(this.getAllQuations(null, id));
            //this.fillPanel(this.getAllQuations());
        }
Exemplo n.º 3
0
        void selectQuationForNumber(string number = "")
        {
            this.selectedNumber = null;
            if (this.cmbCategory.SelectedIndex != -1)
            {
                int id = AddQuation.getCatId(this.cmbCategory.Text);
                this.fillPanel(this.getAllQuations(null, id));
            }

            if (number != "")
            {
                foreach (var control in this.pnlAllQuations.Controls)
                {
                    GroupBox grp = control as GroupBox;
                    if (grp.Text == number)
                    {
                        this.selectedNumber = grp.Text;
                        this.fillPanel(this.getAllQuations(Convert.ToInt32(grp.Name)));
                        return;
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void cmbCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            int id = AddQuation.getCatId(this.cmbCategory.Text);

            this.fillPanel(this.getAllQuations(null, id));
        }