示例#1
0
        public override void Execute()
        {
            DataSourceBase DataSource = null;
            string         outVal     = "";

            foreach (DataSourceBase ds in DSList)
            {
                if (DSName == null)
                {
                    string[] Token = ValueExp.Split(new[] { "{DS Name=", " " }, StringSplitOptions.None);
                    DSName = Token[1];
                }

                if (ds.Name == DSName)
                {
                    DataSource = ds;
                }
            }
            if (DataSource.DSType == DataSourceBase.eDSType.LiteDataBase)
            {
                GingerCoreNET.DataSource.GingerLiteDB liteDB = new GingerCoreNET.DataSource.GingerLiteDB();
                string Query = ValueExp.Substring(ValueExp.IndexOf("QUERY=") + 6, ValueExp.Length - (ValueExp.IndexOf("QUERY=") + 7));
                liteDB.FileFullPath = WorkSpace.Instance.SolutionRepository.ConvertSolutionRelativePath(DataSource.FileFullPath);
                liteDB.Execute(this, Query);
            }
            else if (DataSource.DSType == DataSourceBase.eDSType.MSAccess)
            {
                switch (ControlAction)
                {
                case eControlAction.GetValue:
                    ValueExpression VE = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    VE.Value = ValueExp;
                    AddOrUpdateReturnParamActual("Output", VE.ValueCalculated);
                    break;

                case eControlAction.SetValue:
                    ValueExpression SVE = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    SVE.Value = this.Value;

                    ValueExpression VEUpdate = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList, true, SVE.ValueCalculated);
                    VEUpdate.Value = ValueExp;
                    outVal         = VEUpdate.ValueCalculated;
                    break;

                case eControlAction.MarkAsDone:
                    ValueExpression VEMAD = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    VEMAD.Value = ValueExp;
                    outVal      = VEMAD.ValueCalculated;
                    break;

                case eControlAction.RowCount:
                case eControlAction.AvailableRowCount:
                    ValueExpression VERC = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    VERC.Value = ValueExp;
                    AddOrUpdateReturnParamActual("Output", VERC.ValueCalculated);
                    break;

                case eControlAction.ExportToExcel:
                    ValueExpression VEETE = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    VEETE.Value = ExcelPath;
                    string ExcelFilePath = VEETE.ValueCalculated;

                    if (ExcelFilePath.ToLower().EndsWith(".xlsx"))
                    {
                        DataSource.ExporttoExcel(DSTableName, ExcelFilePath, ExcelSheetName);
                    }
                    else
                    {
                        this.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
                        Error       = "The Export Excel can be *.xlsx only";
                    }
                    break;

                case eControlAction.DeleteRow:
                    ValueExpression veDel = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    veDel.Value = ValueExp;
                    outVal      = veDel.ValueCalculated;
                    int rowCount = 0;
                    if (!string.IsNullOrEmpty(outVal) && !int.TryParse(outVal, out rowCount))
                    {
                        this.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
                        Error       = outVal;
                    }
                    break;

                case eControlAction.AddRow:
                    DataSourceTable DSTable = null;
                    ObservableList <DataSourceTable> dstTables = DataSource.GetTablesList();
                    foreach (DataSourceTable dst in dstTables)
                    {
                        if (dst.Name == DSTableName)
                        {
                            DSTable           = dst;
                            DSTable.DataTable = dst.DSC.GetTable(DSTableName);
                            break;
                        }
                    }
                    if (DSTable != null)
                    {
                        List <string> mColumnNames = DataSource.GetColumnList(DSTableName);
                        DataSource.AddRow(mColumnNames, DSTable);
                        DataSource.SaveTable(DSTable.DataTable);
                        //Get GingerId
                        DataTable dt       = DataSource.GetTable(DSTableName);
                        DataRow   row      = dt.Rows[dt.Rows.Count - 1];
                        string    GingerId = Convert.ToString(row["GINGER_ID"]);
                        AddOrUpdateReturnParamActual("GINGER_ID", GingerId);
                    }
                    else
                    {
                        Error = "No table present in the DataSource with the name =" + DSTableName;
                    }
                    break;

                default:
                    ValueExpression VEDR = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    VEDR.Value = ValueExp;
                    outVal     = VEDR.ValueCalculated;
                    break;
                }
            }
            return;
        }
示例#2
0
        public override void Execute()
        {
            DataSourceBase DataSource = null;
            string         outVal     = "";

            foreach (DataSourceBase ds in DSList)
            {
                if (DSName == null)
                {
                    string[] Token = ValueExp.Split(new[] { "{DS Name=", " " }, StringSplitOptions.None);
                    DSName = Token[1];
                }

                if (ds.Name == DSName)
                {
                    DataSource = ds;
                }
            }
            if (DataSource.DSType == DataSourceBase.eDSType.LiteDataBase)
            {
                GingerCoreNET.DataSource.GingerLiteDB liteDB = new GingerCoreNET.DataSource.GingerLiteDB();
                string Query = ValueExp.Substring(ValueExp.IndexOf("QUERY=") + 6, ValueExp.Length - (ValueExp.IndexOf("QUERY=") + 7));
                liteDB.FileFullPath = WorkSpace.Instance.SolutionRepository.ConvertSolutionRelativePath(DataSource.FileFullPath);
                liteDB.Execute(this, Query);
            }
            else if (DataSource.DSType == DataSourceBase.eDSType.MSAccess)
            {
                switch (ControlAction)
                {
                case eControlAction.GetValue:
                    ValueExpression VE = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    VE.Value = ValueExp;
                    AddOrUpdateReturnParamActual("Output", VE.ValueCalculated);
                    break;

                case eControlAction.SetValue:
                    ValueExpression SVE = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    SVE.Value = this.Value;

                    ValueExpression VEUpdate = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList, true, SVE.ValueCalculated);
                    VEUpdate.Value = ValueExp;
                    outVal         = VEUpdate.ValueCalculated;
                    break;

                case eControlAction.MarkAsDone:
                    ValueExpression VEMAD = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    VEMAD.Value = ValueExp;
                    outVal      = VEMAD.ValueCalculated;
                    break;

                case eControlAction.RowCount:
                case eControlAction.AvailableRowCount:
                    ValueExpression VERC = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    VERC.Value = ValueExp;
                    AddOrUpdateReturnParamActual("Output", VERC.ValueCalculated);
                    break;

                case eControlAction.ExportToExcel:
                    ValueExpression EVE = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    EVE.Value = this.Value;

                    ValueExpression ETERC = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList, false, EVE.ValueCalculated);
                    ETERC.Value = ValueExp;
                    if (ETERC.ValueCalculated == "The Export Excel can be *.xlsx only")
                    {
                        this.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
                        Error       = "The Export Excel can be *.xlsx only";
                    }
                    else
                    {
                        outVal = ETERC.ValueCalculated;
                    }
                    break;

                case eControlAction.DeleteRow:
                    ValueExpression veDel = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    veDel.Value = ValueExp;
                    outVal      = veDel.ValueCalculated;
                    int rowCount = 0;
                    if (!string.IsNullOrEmpty(outVal) && !int.TryParse(outVal, out rowCount))
                    {
                        this.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
                        Error       = outVal;
                    }
                    break;

                default:
                    ValueExpression VEDR = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                    VEDR.Value = ValueExp;
                    outVal     = VEDR.ValueCalculated;
                    break;
                }
            }
            return;
        }