Example #1
0
 public LinRegForm()
 {
     InitializeComponent();
     LinRegBetaRefEdit._Excel = Globals.ThisAddIn.Application;
     LinRegXRefEdit._Excel    = Globals.ThisAddIn.Application;
     mvExcelGet = new cExcelStockModel(2, (int)eCondMeanEnumCli.eLinReg);
 }
Example #2
0
 public SkewTForm()
 {
     InitializeComponent();
     SkewTRefEdit._Excel = Globals.ThisAddIn.Application;
     GammaRefEdit._Excel = Globals.ThisAddIn.Application;
     mvExcelGet          = new cExcelStockModel(2, (int)eDistrTypeEnumCli.eSkewT);
 }
Example #3
0
 public ARCHForm()
 {
     InitializeComponent();
     ArchRefEdit._Excel  = Globals.ThisAddIn.Application;
     ConstRefEdit._Excel = Globals.ThisAddIn.Application;
     mvExcelGet          = new cExcelStockModel(2, (int)eCondVarEnumCli.eArch);
 }
Example #4
0
 public TARCHForm()
 {
     InitializeComponent();
     ConstRefEdit._Excel     = Globals.ThisAddIn.Application;
     ArchPlusRefEdit._Excel  = Globals.ThisAddIn.Application;
     ARCHMoinsRefEdit._Excel = Globals.ThisAddIn.Application;
     mvExcelGet = new cExcelStockModel(3, (int)eCondVarEnumCli.eTarch);
 }
Example #5
0
        private void NormAddButton_Click(object sender, EventArgs e)
        {
            Globals.ThisAddIn.mAddInModel.DeleteCondDistr();
            cExcelStockModel myDistr = new cExcelStockModel(0, (int)eDistrTypeEnumCli.eNormal);

            Globals.ThisAddIn.mAddInModel.AddCondDistr(myDistr);
            UpdateControl();
        }
Example #6
0
 public ARFIMAForm()
 {
     InitializeComponent();
     FracDRefEdit._Excel = Globals.ThisAddIn.Application;
     ArRefEdit._Excel    = Globals.ThisAddIn.Application;
     MaRefEdit._Excel    = Globals.ThisAddIn.Application;
     mvExcelGet          = new cExcelStockModel(3, (int)eCondMeanEnumCli.eArfima);
 }
 public EstimationForm()
 {
     InitializeComponent();
     ObsRefEdit._Excel           = Globals.ThisAddIn.Application;
     LinRegMatrixRefEdit._Excel  = Globals.ThisAddIn.Application;
     DefaultRadioButton.Checked  = Globals.ThisAddIn.mDefaultInitPointBool;
     CurrentRadioBouton.Checked  = !DefaultRadioButton.Enabled;
     LinRegMatrixRefEdit.Enabled = (Globals.ThisAddIn.mAddInModel.mCondMean[(int)eCondMeanEnumCli.eLinReg] != null);
     if (LinRegMatrixRefEdit.Enabled)
     {
         LinRegMatrixRefEdit.Text = Globals.ThisAddIn.mAddInModel.mCondMean[(int)eCondMeanEnumCli.eLinReg].mParam[1].mCells;
     }
     mvExcelGet = new cExcelStockModel();
     mvYtRange  = Globals.ThisAddIn.mExcelEstimation.mYtRange;
     mvXtRange  = Globals.ThisAddIn.mExcelEstimation.mXtRange;
 }
Example #8
0
 public StudentForm()
 {
     InitializeComponent();
     DdlRefedit._Excel = Globals.ThisAddIn.Application;
     mvExcelGet        = new cExcelStockModel(1, (int)eDistrTypeEnumCli.eStudent);
 }
Example #9
0
 public ARForm()
 {
     InitializeComponent();
     ARRefedit._Excel = Globals.ThisAddIn.Application;
     mvExcelGet       = new cExcelStockModel(1, (int)eCondMeanEnumCli.eAr);
 }
Example #10
0
 public ConstVarForm()
 {
     InitializeComponent();
     ConstRefedit._Excel = Globals.ThisAddIn.Application;
     mvExcelGet          = new cExcelStockModel(1, (int)eCondVarEnumCli.eCste);
 }
Example #11
0
        private void OKBoutton_Click(object sender, EventArgs e)
        {
            Tools.Workbook myWorkBook           = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook);
            string         myModelStr           = this.ModeleRefEdit.Text;
            int            myLength             = myModelStr.Length;
            int            myWorksheetNameIndex = myModelStr.IndexOf("!");
            string         myWorkSheetName;

            Tools.Worksheet myWorkSheet;
            if (myWorksheetNameIndex >= 0)
            {
                myWorkSheetName = myModelStr.Substring(0, myWorksheetNameIndex);
                myModelStr      = myModelStr.Substring(myWorksheetNameIndex + 1, myLength - myWorksheetNameIndex - 1);
                myWorkSheet     = myWorkBook.Worksheets[myWorkSheetName];
            }
            else
            {
                myWorkSheet = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet);
            }

            myWorkSheet.Range[myModelStr].Select();
            Excel.Range myExcelRange = Globals.ThisAddIn.Application.Selection.Cells;
            int         myNCol       = myExcelRange.Columns.Count;
            int         myNRow       = myExcelRange.Rows.Count;
            int         i            = 1;

            if (((int)myExcelRange[i, 3].Cells.Value == 0) && ((int)myExcelRange[i, 4].Cells.Value == -1))
            {
                Globals.ThisAddIn.mAddInModel.mNCondMean = 0;
                for (int j = 0; j < Globals.ThisAddIn.gvMaxNCondMean; j++)
                {
                    Globals.ThisAddIn.mAddInModel.DeleteCondMean(j);
                }
                Globals.ThisAddIn.mAddInModel.mCondMeanDone = true;
                i++;
            }
            while (i <= myNRow)
            {
                if ((int)myExcelRange[i, 3].Cells.Value == 0) // CondMean
                {
                    int myCondMeanType = (int)myExcelRange[i, 4].Cells.Value;
                    Globals.ThisAddIn.mAddInModel.DeleteCondMean(myCondMeanType);
                    int j = 1;
                    while (((int)myExcelRange[i + j, 3].Cells.Value == 0) && ((int)myExcelRange[i + j, 4].Cells.Value == myCondMeanType))
                    {
                        j++;
                    }
                    cExcelStockModel myAuxStockModel = new cExcelStockModel(j, myCondMeanType);
                    for (int k = 0; k < j; k++)
                    {
                        cExcelRangeClass myExcelRangeClass = new cExcelRangeClass();
                        myExcelRangeClass.mWorkbook      = myExcelRange[i + k, 1].Cells.Value;
                        myExcelRangeClass.mWorksheet     = myExcelRange[i + k, 2].Cells.Value;
                        myExcelRangeClass.mLeftUpCell    = myExcelRange[i + k, 5].Cells.Value;
                        myExcelRangeClass.mRightDownCell = myExcelRange[i + k, 6].Cells.Value;
                        myExcelRangeClass.mCells         = myExcelRangeClass.mLeftUpCell + ":" + myExcelRangeClass.mRightDownCell;
                        Tools.Workbook  myTempWorkBook  = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.Workbooks[myExcelRangeClass.mWorkbook]);
                        int             myNumber        = GetSheetNumber(myTempWorkBook, myExcelRangeClass.mWorksheet);
                        Tools.Worksheet myTempWorkSheet = Globals.Factory.GetVstoObject(myTempWorkBook.Worksheets[myNumber]);
                        myTempWorkBook.Activate();
                        myTempWorkSheet.Activate();
                        myTempWorkSheet.Range[myExcelRangeClass.mLeftUpCell, myExcelRangeClass.mRightDownCell].Select();
                        Excel.Range myTempExcelRange = Globals.ThisAddIn.Application.Selection.Cells;
                        myExcelRangeClass.mNColumn = myTempExcelRange.Columns.Count;
                        myExcelRangeClass.mNRow    = myTempExcelRange.Rows.Count;
                        myExcelRangeClass.mNSize   = myTempExcelRange.Count;
                        myAuxStockModel.AddParam(myExcelRangeClass, k);
                        myWorkBook.Activate();
                        myWorkSheet.Activate();
                    }
                    Globals.ThisAddIn.mAddInModel.AddOneCondMean(myAuxStockModel);
                    myAuxStockModel.Delete();
                    i += j;
                }
                else
                {
                    if ((int)myExcelRange[i, 3].Cells.Value == 1) // CondVar
                    {
                        int myCondVarType = (int)myExcelRange[i, 4].Cells.Value;
                        Globals.ThisAddIn.mAddInModel.DeleteCondVar();
                        int j = 1;
                        while (((int)myExcelRange[i + j, 3].Cells.Value == 1) && ((int)myExcelRange[i + j, 4].Cells.Value == myCondVarType))
                        {
                            j++;
                        }
                        cExcelStockModel myAuxStockModel = new cExcelStockModel(j, myCondVarType);
                        for (int k = 0; k < j; k++)
                        {
                            cExcelRangeClass myExcelRangeClass = new cExcelRangeClass();
                            myExcelRangeClass.mWorkbook      = myExcelRange[i + k, 1].Cells.Value;
                            myExcelRangeClass.mWorksheet     = myExcelRange[i + k, 2].Cells.Value;
                            myExcelRangeClass.mLeftUpCell    = myExcelRange[i + k, 5].Cells.Value;
                            myExcelRangeClass.mRightDownCell = myExcelRange[i + k, 6].Cells.Value;
                            myExcelRangeClass.mCells         = myExcelRangeClass.mLeftUpCell + ":" + myExcelRangeClass.mRightDownCell;
                            Tools.Workbook  myTempWorkBook  = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.Workbooks[myExcelRangeClass.mWorkbook]);
                            int             myNumber        = GetSheetNumber(myTempWorkBook, myExcelRangeClass.mWorksheet);
                            Tools.Worksheet myTempWorkSheet = Globals.Factory.GetVstoObject(myTempWorkBook.Worksheets[myNumber]);
                            myTempWorkBook.Activate();
                            myTempWorkSheet.Activate();
                            Excel.Range myTempExcelRange = Globals.ThisAddIn.Application.Selection.Cells;
                            myExcelRangeClass.mNColumn = myTempExcelRange.Columns.Count;
                            myExcelRangeClass.mNRow    = myTempExcelRange.Rows.Count;
                            myExcelRangeClass.mNSize   = myTempExcelRange.Count;
                            myAuxStockModel.AddParam(myExcelRangeClass, k);
                            myWorkBook.Activate();
                            myWorkSheet.Activate();
                        }
                        Globals.ThisAddIn.mAddInModel.AddCondVar(myAuxStockModel);
                        myAuxStockModel.Delete();
                        i += j;
                    }
                    else
                    {
                        int myCondDistrType = (int)myExcelRange[i, 4].Cells.Value;
                        Globals.ThisAddIn.mAddInModel.DeleteCondDistr();
                        if (myCondDistrType == (int)(eDistrTypeEnumCli.eNormal))
                        {
                            cExcelStockModel myAuxStockModel = new cExcelStockModel(0, myCondDistrType);
                            Globals.ThisAddIn.mAddInModel.AddCondDistr(myAuxStockModel);
                            i++;
                        }
                        else
                        {
                            int j = 1;
                            if (i + j <= myNRow)
                            {
                                while (((int)myExcelRange[i + j, 3].Cells.Value == 2) && ((int)myExcelRange[i + j, 4].Cells.Value == myCondDistrType))
                                {
                                    j++;
                                }
                            }
                            cExcelStockModel myAuxStockModel = new cExcelStockModel(j, myCondDistrType);
                            for (int k = 0; k < j; k++)
                            {
                                cExcelRangeClass myExcelRangeClass = new cExcelRangeClass();
                                myExcelRangeClass.mWorkbook      = myExcelRange[i + k, 1].Cells.Value;
                                myExcelRangeClass.mWorksheet     = myExcelRange[i + k, 2].Cells.Value;
                                myExcelRangeClass.mLeftUpCell    = myExcelRange[i + k, 5].Cells.Value;
                                myExcelRangeClass.mRightDownCell = myExcelRange[i + k, 6].Cells.Value;
                                myExcelRangeClass.mCells         = myExcelRangeClass.mLeftUpCell + ":" + myExcelRangeClass.mRightDownCell;
                                Tools.Workbook  myTempWorkBook  = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.Workbooks[myExcelRangeClass.mWorkbook]);
                                int             myNumber        = GetSheetNumber(myTempWorkBook, myExcelRangeClass.mWorksheet);
                                Tools.Worksheet myTempWorkSheet = Globals.Factory.GetVstoObject(myTempWorkBook.Worksheets[myNumber]);
                                myTempWorkBook.Activate();
                                myTempWorkSheet.Activate();
                                Excel.Range myTempExcelRange = Globals.ThisAddIn.Application.Selection.Cells;
                                myExcelRangeClass.mNColumn = myTempExcelRange.Columns.Count;
                                myExcelRangeClass.mNRow    = myTempExcelRange.Rows.Count;
                                myExcelRangeClass.mNSize   = myTempExcelRange.Count;
                                myAuxStockModel.AddParam(myExcelRangeClass, k);
                                myWorkBook.Activate();
                                myWorkSheet.Activate();
                            }
                            Globals.ThisAddIn.mAddInModel.AddCondDistr(myAuxStockModel);
                            myAuxStockModel.Delete();
                            i += j;
                        }
                    }
                }
            }
            Globals.ThisAddIn.mAddInModel.SetDescription();
            Globals.ThisAddIn.mAddInBackupModel = new cExcelModelClass(Globals.ThisAddIn.mAddInModel);
//            bool myModelDone = Globals.ThisAddIn.mAddInModel.mCondDistrDone & Globals.ThisAddIn.mAddInModel.mCondMeanDone & Globals.ThisAddIn.mAddInModel.mCondVarDone;

            Globals.ThisAddIn.mRuban.RefreshRegArchRibbon();
            Close();
        }
 public StdevInMeanForm()
 {
     InitializeComponent();
     StdevInMeanRefEdit._Excel = Globals.ThisAddIn.Application;
     mvExcelGet = new cExcelStockModel(1, (int)eCondMeanEnumCli.eStdDevInMean);
 }