示例#1
0
        private void createGroupsDimensionFormToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmCreateFromGroups FrmGrp = new FrmCreateFromGroups(new Font("Verdana", 9, FontStyle.Regular));

            FrmGrp.ShowDialog();
        }
示例#2
0
 private void BtnCreateFrm_Click(object sender, EventArgs e)
 {
     if (TxtFormTitle.Text == "" && EditForm == false)
     {
         MessageBox.Show("Please provide Form Title.", "message:", MessageBoxButtons.OK);
     }
     else if (DGVCriteria.Rows.Count == 0)
     {
         MessageBox.Show("Please provide Criteria Fields", "message:", MessageBoxButtons.OK);
     }
     else if (DGVDisplay.Rows.Count == 0)
     {
         MessageBox.Show("Please provide Display Fields", "message:", MessageBoxButtons.OK);
     }
     else
     {
         int    FormKey  = 0;
         string FormName = "";
         if (EditForm == true)
         {
             FormKey  = CommFunc.FetchKey("FormDim", CmbFormTitle.Text);
             FormName = CmbFormTitle.Text;
         }
         else
         {
             FormKey  = CommFunc.FetchMaxKey("FormKey", "FormDim");
             FormName = TxtFormTitle.Text;
         }
         string FormColor = string.Format("{0:x6}", TxtColor.BackColor.ToArgb());
         string FormSize  = TxtSize.Text;
         if (FormSize == "")
         {
             FormSize = "Maximised";
         }
         string FormFont         = CmbFont.Text;
         string FormAccess       = CmbAccess.Text;
         int    Counter          = 0;
         string FormCalculations = "";
         if (BtnSum.Text.Contains("(") == true && BtnSum.Text.Contains("()") == false)
         {
             FormCalculations = FormCalculations + "," + BtnSum.Text;
         }
         if (BtnAverage.Text.Contains("(") == true && BtnAverage.Text.Contains("()") == false)
         {
             FormCalculations = FormCalculations + "," + BtnAverage.Text;
         }
         if (BtnMaximum.Text.Contains("(") == true && BtnMaximum.Text.Contains("()") == false)
         {
             FormCalculations = FormCalculations + "," + BtnMaximum.Text;
         }
         if (BtnMinimum.Text.Contains("(") == true && BtnMinimum.Text.Contains("()") == false)
         {
             FormCalculations = FormCalculations + "," + BtnMinimum.Text;
         }
         if (BtnCount.Text.Contains("(") == true && BtnCount.Text.Contains("()") == false)
         {
             FormCalculations = FormCalculations + "," + BtnCount.Text;
         }
         if (BtnProduct.Text.Contains("(") == true && BtnProduct.Text.Contains("()") == false)
         {
             FormCalculations = FormCalculations + "," + BtnProduct.Text;
         }
         if (FormCalculations.StartsWith(",") == true)
         {
             FormCalculations = FormCalculations.Substring(1, FormCalculations.Length - 1);
         }
         if (EditForm == true)
         {
             DialogResult Res = MessageBox.Show("Do you want to delete all earlier set Groups for this form?",
                                                "message:", MessageBoxButtons.YesNo);
             if (Res == DialogResult.Yes)
             {
                 CommFunc.delete_table("FormGroupFact", "FormKey = " + FormKey);
             }
             CommFunc.delete_table("MakeFormFact", "FormKey = " + FormKey);
             CommFunc.delete_table("FormDim", "FormKey = " + FormKey);
         }
         CommFunc.Insert_into_DB(FormKey + ",'" + FormName + "','" + FormAccess + "','" + FormSize + "','" + FormColor
                                 + "','" + FormFont + "','" + FormCalculations + "'", "FormDim");
         Counter = 0;
         while (Counter < DGVCriteria.Rows.Count)
         {
             string TName     = DGVCriteria[0, Counter].Value.ToString();
             string FName     = DGVCriteria[1, Counter].Value.ToString();
             string IsFreezed = "";
             if (DGVCriteria[2, Counter].Value != null)
             {
                 IsFreezed = DGVCriteria[2, Counter].Value.ToString();
             }
             if (IsFreezed == "True")
             {
                 IsFreezed = "Y";
             }
             else
             {
                 IsFreezed = "N";
             }
             CommFunc.Insert_into_DB(FormKey + ",'" + FName + "','" + TName + "','" + IsFreezed
                                     + "','C'", "MakeFormFact");
             Counter++;
         }
         Counter = 0;
         while (Counter < DGVDisplay.Rows.Count)
         {
             string TName = DGVDisplay[0, Counter].Value.ToString();
             string FName = DGVDisplay[1, Counter].Value.ToString();
             CommFunc.Insert_into_DB(FormKey + ",'" + FName + "','" + TName + "','','D'", "MakeFormFact");
             Counter++;
         }
         DGVCriteria.Rows.Clear();
         DGVDisplay.Rows.Clear();
         TxtSize.Text = "";
         CmbFont.Text = "Verdana";
         FrmCreateFromGroups FrmGrp = new FrmCreateFromGroups(TxtFormTitle.Text, new Font("Verdana", 9, FontStyle.Regular));
         FrmGrp.ShowDialog();
         TxtFormTitle.Text = "";
     }
 }