Пример #1
0
        private void btnAddField_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && txtResult.Text != "")
            {
                var _dic         = new Dictionary <string, object>();
                var rect         = R_Rectangle;
                var _Template_ID = Convert.ToInt32(txtTemplate_ID.Text);
                _dic.Add("Lable", textBox1.Text);
                _dic.Add("Rect_Bottom", rect.Bottom);
                _dic.Add("Rect_Top", rect.Top);
                _dic.Add("Rect_Left", rect.Left);
                _dic.Add("Rect_Right", rect.Right);
                _dic.Add("X", rect.X);
                _dic.Add("Y", rect.Y);
                _dic.Add("Width", rect.Width);
                _dic.Add("Height", rect.Height);

                _dic.Add("TemplateID", _Template_ID);
                var _service = new TemplateService();
                var result   = _service.Create_Region(_dic);
                if (result == 1)
                {
                    MessageBox.Show("Record Inserted Successfully");
                    dataGridView(_Template_ID);
                    ClearData();
                    btnUpdate.Enabled      = false;
                    btnFieldRemove.Enabled = false;
                    Remove();
                }
            }
            else
            {
                MessageBox.Show("Please Provide Details!");
            }
        }
Пример #2
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "")
     {
         var _dic = new Dictionary <string, object>();
         _dic.Add("Lable", textBox1.Text);
         _dic.Add("ID", ID);
         var _service = new TemplateService();
         var result   = _service.Create_Region(_dic);
         if (result == 1)
         {
             MessageBox.Show("Record Updated Successfully");
             dataGridView(Template_ID);
             ClearData();
             ID = 0;
             btnUpdate.Enabled      = false;
             btnFieldRemove.Enabled = false;
         }
     }
     else
     {
         MessageBox.Show("Please Select Record to Update");
     }
 }