Skip to content

Commit

Permalink
Merge pull request #1807 from Ginger-Automation/Releases/Beta
Browse files Browse the repository at this point in the history
Releases/beta
  • Loading branch information
shahanemahesh authored Feb 1, 2021
2 parents 9c5151c + e9b635d commit 424542f
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Ginger="clr-namespace:Ginger"
xmlns:GingerCore="clr-namespace:GingerCore;assembly=GingerCore"
mc:Ignorable="d" d:DesignWidth="600" Height="900"
mc:Ignorable="d" d:DesignWidth="600" Height="1040"
Title="DataSource Expression Editor" >

<Grid Background="{StaticResource $BackgroundColor_LightGray}" Margin="0,0,0,0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ private void ShowContolActionSpecificPage()
if (ControlActionComboBox.SelectedValue.ToString() == "ExportToExcel")
{
mActDSTblElem.DSTableName = mDSTable.Name;
mActDSTblElem.DSName = mDSTable.DSC.Name;
Page pageContent = new Ginger.DataSource.DataSourceExportToExcel(mActDSTblElem);
ExcelSpecificFrame.Content = pageContent;
ExcelSpecificFrame.Visibility = Visibility.Visible;
Expand Down
2 changes: 1 addition & 1 deletion Ginger/Ginger/DataSource/DataSourceExportToExcelPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<StackPanel x:Name="xExcelExportCustomPanel" Visibility="Collapsed" >
<Label HorizontalAlignment="Left" FontWeight="Medium" Style="{StaticResource @LabelStyle}">Select Column To Export :</Label>
<Ginger:ucGrid x:Name="xColumnListGrid" AutomationProperties.AutomationId="ColumnListGrid AID" ShowTitle="Collapsed" ShowAdd="Collapsed" Width="500" HorizontalAlignment="Left" ShowClearAll="Collapsed" ShowUpDown="Collapsed" ShowRefresh="Collapsed" ShowEdit="Collapsed" ShowDelete="Collapsed" />
<Ginger:ucGrid x:Name="xColumnListGrid" MaxHeight="250" AutomationProperties.AutomationId="ColumnListGrid AID" ShowTitle="Collapsed" ShowAdd="Collapsed" Width="500" HorizontalAlignment="Left" ShowClearAll="Collapsed" ShowUpDown="Collapsed" ShowRefresh="Collapsed" ShowEdit="Collapsed" ShowDelete="Collapsed" />

<CheckBox x:Name="xExportWhereChkBox" Content="Filter Record Based On Where Clause :" Click="xExportWhereChkBox_Click" Margin="0,20,0,5" FontWeight="Medium"/>

Expand Down
3 changes: 2 additions & 1 deletion Ginger/Ginger/DataSource/DataSourceExportToExcelPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public partial class DataSourceExportToExcel : Page

public ObservableList<ActDSConditon> mWhereConditionList = new ObservableList<ActDSConditon>();

private DataTable mDataTable = null;
private DataTable mDataTable = new DataTable();
private ActDSTableElement mActDSTableElement = null;

private DataSourceTable mDataSourceTable = null;
Expand Down Expand Up @@ -132,6 +132,7 @@ public DataSourceExportToExcel(ActDSTableElement actDSTableElement)
}

SetConditionGridView();
UpdateQueryValue();
}

private void SetFilePath()
Expand Down
2 changes: 1 addition & 1 deletion Ginger/GingerCoreNET/DataSource/ActDSTableElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public override void Execute()

if (excelFilePath.ToLower().EndsWith(".xlsx"))
{
DataSource.ExporttoExcel(DSTableName, excelFilePath, excelSheetName,query);
DataSource.ExporttoExcel(DSTableName, excelFilePath, excelSheetName,query.ToLower());
}
else
{
Expand Down
32 changes: 26 additions & 6 deletions Ginger/GingerCoreNET/DataSource/ExportToExcelConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,23 +153,39 @@ public string CreateQueryWithWhereList(List<ColumnCheckListItem> mColumnList, Ob
{
if (wColVal == "GINGER_ID")
{
wQuery = string.Concat(wQuery," ", wCond," ",wColVal," != ", wRowVal);
wQuery = string.Concat(wQuery," ", wCond," ",wColVal," <> ", wRowVal);
}
else
{
wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " != \"", wRowVal, "\"");
wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " <> \"", wRowVal, "\"");
}
}
else if (wOpr == "Contains")
{
wQuery = string.Concat(wQuery, " ", wCond , " ", wColVal, " contains ", "\"", wRowVal, "\"");
wQuery = string.Concat(wQuery, " ", wCond , " ", wColVal, " Like ", "\"%", wRowVal, "%\"");
}
else if (wOpr == "NotContains")
{
wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " Not Like ", "\"%", wRowVal, "%\"");
}
else if (wOpr == "StartsWith")
{
wQuery = string.Concat(wQuery , " ", wCond, " ", wColVal, " like ", "\"", wRowVal, "\"");
wQuery = string.Concat(wQuery , " ", wCond, " ", wColVal, " like ", "\"", wRowVal, "%\"");
}
else if (wOpr == "NotStartsWith")
{
wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " Not Like ", "\"", wRowVal, "%\"");
}
else if (wOpr == "EndsWith")
{
wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " like ", "\"%", wRowVal, "\"");
}


else if (wOpr == "NotEndsWith")
{
wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " not like ", "\"%", wRowVal, "\"");
}


whereQuery = string.Concat(whereQuery, wQuery);
}
if (whereQuery != string.Empty)
Expand All @@ -192,6 +208,10 @@ public string CreateQueryWithWhereList(List<ColumnCheckListItem> mColumnList, Ob
}
}

if (mDataTable == null)
{
return dsConditionList;
}

List<string> tableColsValue = new List<string>();
var columns = mDataTable.Columns;
Expand Down
4 changes: 4 additions & 0 deletions Ginger/GingerCoreNET/DataSource/LiteDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ public override bool ExporttoExcel(string TableName, string sExcelPath, string s
selectedColumn = sTableQueryValue.Substring(0, index);

var filter = whereCond.Remove(0,6).Trim();
if (filter.Contains("\""))
{
filter = filter.Replace("\"", "'");
}
DataView dv = new DataView(dataTable);
dv.RowFilter = filter;
dataTable = dv.ToTable();
Expand Down
7 changes: 6 additions & 1 deletion Ginger/GingerCoreNET/ValueExpressionLib/ValueExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,12 @@ public void ReplaceDataSource(string p)
{
nextavail = true;
}
liteDB.RunQuery(litedbquery, 0, tableName[0], Markasdone, nextavail);

if (litedbquery != "" && Markasdone == true)
{
liteDB.RunQuery(litedbquery, 0, tableName[0], Markasdone, nextavail);
mValueCalculated = "";
}
}
}
else
Expand Down

0 comments on commit 424542f

Please sign in to comment.