|
Oh great.
This seems much easier since all the samples of data source I have seen so far seems very complicated.
I have not done it with more than one parameter before and have not done via binding as the Great Richard suggested.
I have been playing around with Richard's suggestion but I will try this and hopefully, I can get it to work.
Thanks a lot for your help.
|
|
|
|
|
I stopped using binding over a decade ago. When they break you have to fix them.
The internet is flooded with outdated information and tutorials and really needs to be cleaned up.
The example I gave you is home grown, sort of a natural evolution I leaned towards and not really in any tutorials. Notice how simple the code is. Using Jet Brains Ultimate Refactor, I learned that I don't have to fully Dim an object and can use Dim like var in c#, or like var or let in TypeScript. Once you carefully craft a good model, it can reused over and over with ease. Then you can use Linq to populate, manipulate, or spawn more copies of the model.
If you start coding like this, then that will pave the way for you to use MVC, then .Net Core, and Angular/React. But it's all in how you craft your model. And a model can be a single record, or a list or records. Or it can be a record with a list of records inside. Create a model, populate it with data, then use the model. Pass the model around to what ever needs it.
The example is really modern coding pratices taken backwards to web or win forms.
Give it a try, it's worth the investment in time.
See yah around Sam!
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
 I didn't like your database code.
Your code seemed really labor intensive. Maybe that's why Richard suggested binding.
Here's a sample to give you an idea of how you can condense and shorten your code. This code has been Jet Brains Ultimate Refactored to be as small as possible. You can feed as many parameters you want. This passes a model into the function, and returns another model as the result.
You just need to change the connection type and string and parameter type for whatever db server technology your using.
Private Shared Function Get_FI_Customer_SAInvoices(
ByVal sFi As FreeInvoice) As List(Of InvoiceIndex)
Dim pResults As New List(Of InvoiceIndex)
Dim dbPath = RegistryShared.Read_HKCU_DataPath()
Dim connString As String = "Provider=" & My.Resources.DBProviderOLE & "; Data Source=" & dbPath & "; Extended Properties=dBASE IV"
Const queryString As String =
"SELECT " &
" h.FINVNO " &
"FROM ARADD01H.dbf h" &
" WHERE h.FCOMPANY = @FCOMPANY " &
" AND h.FCITY = @FCITY " &
" AND h.FZIP = @FZIP " &
"UNION ALL " &
"SELECT " &
" v.FINVNO " &
"FROM ARADD01.dbf v" &
" WHERE v.FCOMPANY = @FCOMPANY " &
" AND v.FCITY = @FCITY " &
" AND v.FZIP = @FZIP "
Using connection As New OleDbConnection(connString)
Using command As New OleDbCommand(queryString, connection)
command.Parameters.Add(New OleDbParameter("@FCOMPANY", OleDbType.VarChar)).Value = sFi.FCUSTOMER_NAME
command.Parameters.Add(New OleDbParameter("@FCITY", OleDbType.VarChar)).Value = sFi.FADDRESS.City
command.Parameters.Add(New OleDbParameter("@FZIP", OleDbType.VarChar)).Value = sFi.FADDRESS.PostalCode
Try
connection.Open()
Using reader As OleDbDataReader = command.ExecuteReader()
While reader.Read()
If Not reader.IsDBNull(0) Then
pResults.Add(New InvoiceIndex() With {
.InvoiceNumber = reader.GetValue(0),
.InvoiceDate = DateTime.Now
})
End If
End While
reader.Close()
End Using
Catch ex As Exception
ErrorLogging.NLog_Exception(ex, "Db_FI_CustomerAdvByDate")
Finally
connection.Close()
End Try
End Using
End Using
Return pResults
End Function
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Hello,
Still having issues with the code from @jkirkerx. It is me, not the code, I am sure.
So, I decided to go the Richard route by switching back to binding to ListView datasource.
However, the code is not giving an error but when enter a vaue say for Caller List and click "Generate Report", nothing happens.
I just flickers for a second.
I know I am missing something critical but have been looking at this now for two days with no success.
I have decided to post some relevant HTML markup and some VB. Hopefuly, you guys can put me out of my misery.
Thank you very much.
<table class="criteria" runat="server">
<tr id="row_0" class="evenRow">
<th>UUID</th>
<td>
<asp:TextBox id="suuid" style="width:150px;" class="form-control" runat="server" />
</td>
</tr>
<tr id="row_1" class="oddRow">
<th>Call List ID</th>
<td>
<asp:TextBox id="caller_list_id" style="width:150px;" class="form-control" runat="server" />
</td>
</tr>
<tr id="row_2" class="evenRow">
<th>Phone Number</th>
<td>
<asp:TextBox id="phonenumber" style="width:150px;" class="form-control" runat="server" />
</td>
</tr>
<tr id="row_3" class="oddRow">
<th>Start Date</th>
<td>
<asp:TextBox id="date_start" style="width:150px;" class="form-control" runat="server" />
</td>
</tr>
<tr id="row_4" class="evenRow">
<th>End Date</th>
<td>
<asp:TextBox id="date_end" style="width:150px;" class="form-control" runat="server" />
</td>
</tr>
<tr class="oddRow">
<th>Call Type</th>
<td>
<asp:DropDownList id="call_type" runat="server">
<asp:ListItem SELECTED="True" value="">All</asp:ListItem>
<asp:ListItem value="0" Text="0 ">Unknown</asp:ListItem>
<asp:ListItem value="1" Text="1">Outbound Progressive</asp:ListItem>
<asp:ListItem value="2" Text="2">Outbound Predictive</asp:ListItem>
<asp:ListItem value="3" Text="4">Inbound</asp:ListItem>
<asp:ListItem value="4" Text="8">Blaster</asp:ListItem>
<asp:ListItem value="5" Text="16">Personal Inbound</asp:ListItem>
<asp:ListItem value="6" Text="32">Nailin</asp:ListItem>
<asp:ListItem value="7" Text="64">External Transfer</asp:ListItem>
<asp:ListItem value="8" Text="128">PBX Outbound</asp:ListItem>
<asp:ListItem value="9" Text="256">PBX Inbound</asp:ListItem>
<asp:ListItem value="10" Text="512">Snoop</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
<div class="menuToolbar" style="padding-bottom: 30px;">
<asp:Button runat="server" id="btnSubmit" Text="Generate Report" OnClick="btnSubmit_Click" />
<asp:Button runat="server" id="btnExport" Text="Export to CSV" OnClick="btnExport_Click" />
</div>
<asp:ListView ID="ProductsListView" runat="server" DataKeyNames="uuid" DataSourceID="SqlDataSource1">
<LayoutTemplate>
<table runat="server" border="0" style="">
<tr>
<th style="border-left: 1px solid #557799" class="reportHeader">
Dialed Phone Number
</th>
<th class="reportHeader">
Caller ID
</th>
<th class="reportHeader">
Call List ID
</th>
<th class="reportHeader">
Start Time
</th>
<th class="reportHeader">
Connect Time
</th>
<th class="reportHeader">
End Time
</th>
<th class="reportHeader">
Duration
</th>
<th class="reportHeader">
Full Duration
</th>
<th class="reportHeader">
Campaign Name
</th>
<th class="reportHeader">
Queue Name
</th>
<th class="reportHeader">
Call Type
</th>
<th class="reportHeader">
Employee
</th>
<th class="reportHeader">
ISDN Cause Code
</th>
<th class="reportHeader">
Disposition
</th>
<th class="reportHeader">
Telephony Server
</th>
<th class="reportHeader">
Trunk Name
</th>
<th class="reportHeader">
UUID
</th>
<th class="reportHeader">
Recording
</th>
<th class="reportHeader">
Details
</th>
</tr>
<tr runat="server" id="itemPlaceholder">
<td colspan="19">
There is no data!
</td>
</tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<table runat="server" border="0" style="">
<tr>
<td><asp:Label ID="lblphonenumber" Text='<%# Eval("phone_number") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblcallerid" Text='<%# Eval("callerid") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblcallerlist" Text='<%# Eval("call_list_id") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblstarttime" Text='<%# Eval("startttime") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblconnectime" Text='<%# Eval("connecttime") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblendtime" Text='<%# Eval("endtime") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblduration" Text='<%# Eval("duration") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblfullduration" Text='<%# Eval("fullduration") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblampaignname" Text='<%# Eval("camapign_id") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblqueuename" Text='<%# Eval("queue_id") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblcalltype" Text='<%# Eval("call_type_id") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblemployee" Text='<%# Eval("roll_id") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblisdn" Text='<%# Eval("cause_code") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lbldisposition" Text='<%# Eval("cause_code") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lbltelephony" Text='<%# Eval("box_id") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lbltrunkname" Text='<%# Eval("trunk_name") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lbluuid" Text='<%# Eval("uuid") %>' runat="server"></asp:Label></td>
<td><asp:Label ID="lblrecording" Text='<%# Eval("customer_id") %>' runat="server"></asp:Label></td>
<td><a href="#"></a></td>
</tr>
</table>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:test %>"
SelectCommand="SELECT phone_number, callerid, call_list_id, startttime,connecttime, endtime, duration, fullduration,
camapign_id, queue_id, name, roll_id, cause_code, uuid, box_id, trunk_name, uuid, customer_id FROM cti.qpcdr, cti.call_types
WHERE cti.qpcdr.call_type_id = cti.call_types.id">
<SelectParameters>
<asp:ControlParameter ControlID="suuid" Name="uuid" PropertyName="Text" Type="String" DefaultValue="%" />
<asp:ControlParameter ControlID="caller_list_id" PropertyName="Text" Name="callerlist" />
<asp:ControlParameter ControlID="phonenumber" PropertyName="Text" Name="phone" />
<asp:ControlParameter ControlID="date_start" PropertyName="Text" Name="start" />
<asp:ControlParameter ControlID="date_end" PropertyName="Text" Name="end" />
<asp:ControlParameter ControlID="call_type" PropertyName="SelectedValue" Name="calltype" />
</SelectParameters>
</asp:SqlDataSource>
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
'TODO
End If
End Sub
Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
'ProductsListView.DataSource = SqlDataSource1
ProductsListView.DataBind()
End Sub
Protected Sub btnExport_Click(sender As Object, e As EventArgs)
ProductsListView.DataBind()
End Sub
|
|
|
|
|
Well the code I gave you is concept code, and not actual code.
To perfect my code, you have to do one step at a time.
So the first step would be to write the database code. And confirm that the proper data is returned in the model that you designed.
Once confirmed, you can move to the next step, which is to plug the code into your page code behind and reconfirm that the data model is still intact.
The last step would be to do a small sample in HTML, to confirm that you understand how to transfer the model from the code behind to the asp.net web form.
But this should be the same process as what Richard suggested.
What I do sometimes, is startup a new project or open a test project on a really small scale, and isolate the new code in a fresh environment. Most times it works correctly, which tells me that some other code is the problem.
I totally get the frustration. You don't know how bad I needed help with a project that I just could not figure out, and knew posting here would not help. I wished someone could of done a remote terminal on my project. But using a test project and plugging the code in 1 section at a time solved it for me.
I haven't work with web forms in over 4 years now. I would create a new form on a smaller scale, and work with 1 or 2 columns first and get that working. Then expand a couple columns at a time. It might be a miss typed column name or wrong data type and you got a silent crash.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Ok thank you so much for your encouragement.
Can you please explain this code just a bit mor.
I see that you are passing one param InvoiceIndex to your function.
But I also see three other variables that are part of the WHERE predicate.
I understand the variables are part of the search filters but I am a bit confused by them.
I
|
|
|
|
|
I didn't go back and delete the extra parameters. I thought I might need them to narrow down the customer in case of a duplicate.
I passed a model into the database function, and returned a model out of the database function.
So I made a model called "Invoice", then called a database function to populate the Invoice.
Then passed the "Invoice" model to another database function to get the rest of the invoice data.
I kept everything in models because it was just easier to do and less code to write. Rather than Dim more space, I just used the existing space I already made. I'm just populating the model, so I can pass it to the presentation layer and consume it.
You just seem to be having trouble at an unknown point and need to isolate the problem.
So you can write code to get the data, package it and confirm it.
Then write fake data and pass it to the presentation layer, or your code behind and the web form to confirm that.
And you should see your mistake.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
 Greetings again.
I am still working on this issue but I have made good progress.
Right now, I am using GridView control which seems to be displaying more than one, several rows as a matter of fact.
My issue now is with embedded query.
There are 6 input parameters and a user can search with one or more at same time.
The query is not results based on input parameter.
For instance, if I select an item from the call_type dropdownList, I expect results based on the selected item from the dropdownList.
The query is not doing that. It is displaying ALL the records.
Same is the case with the rest of the parameters; the filtering is not working and I believe it has to do with the WHERE clauses in the query.
Can you please, please help?
Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
Me.SearchCustomers()
End Sub
Private Sub SearchCustomers()
Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand()
Dim sql As String = "Select top 100 phone_number, callerid, call_list_id, startttime, "
sql += "connecttime, endtime, duration, fullduration,ca.campName,"
sql += "camapign_id, q.queueName, c.name as call_type, roll_id, (e.first_name +' '+ e.last_name) employee, i.name as cause_code, uuid, box_id, trunk_name, uuid, customer_id "
sql += "From cti.qpcdr qp inner join cti.call_types c on qp.call_type_id = c.id "
sql += "inner join cti.queues q on qp.queue_id = q.queueId "
sql += "inner join cti.campaign ca on qp.camapign_id = ca.campaign_id "
sql += "inner join cti.isdn_cause_code i On qp.cause_code = i.cause_code "
sql += "inner join cti.employee e on qp.employee_id = e.employee_id "
If Not String.IsNullOrEmpty(suuid.Text.Trim()) Or Not String.IsNullOrEmpty(caller_list_id.Text.Trim()) Or Not String.IsNullOrEmpty(phone.Text.Trim()) Or Not String.IsNullOrEmpty(start.Text.Trim()) Or Not String.IsNullOrEmpty(endd.Text.Trim()) Or Not String.IsNullOrEmpty(calltype.Text.Trim()) Then
sql += " WHERE 1 = 1 AND qp.uuid LIKE '%' + @uuid + '%'"
sql += " OR qp.call_list_id LIKE '%' + @callerlist + '%'"
sql += " OR qp.phone_number LIKE '%' + @phone + '%'"
sql += " OR qp.startttime LIKE '%' + @start + '%'"
sql += " OR qp.endtime LIKE '%' + @Endd + '%'"
sql += " OR c.id LIKE '%' + @calltype + '%'"
cmd.Parameters.AddWithValue("@uuid", suuid.Text)
cmd.Parameters.AddWithValue("@callerlist", caller_list_id.Text)
cmd.Parameters.AddWithValue("@phone", phonenumber.Text)
cmd.Parameters.AddWithValue("@start", date_start.Text)
cmd.Parameters.AddWithValue("@Endd", date_end.Text)
cmd.Parameters.AddWithValue("@calltype", call_type.SelectedValue)
End If
cmd.CommandText = sql
cmd.Connection = con
Using sda As New SqlDataAdapter(cmd)
Dim dt As New DataTable()
sda.Fill(dt)
gvCustomers.DataSource = dt
gvCustomers.DataBind()
End Using
End Using
End Using
End Sub
|
|
|
|
|
I have an OData api and I wanna have a client side software to send request to this api and recieve answer. I used simple odata client but it gives me the answer in dictionary. I need the answer in object. Some people told me to use microsoft-odata-client and I search for it and I cannot fined any good answer for my problem. Anybody can help me?
|
|
|
|
|
According to the documentation, you should be able to feed the API a JSON string and receive one back. The JSON returned should be able to be cast to your model being Linq capable.
Actions and Functions in OData v4 Using ASP.NET Web API 2.2 | Microsoft Docs
Here is a sample Http Response header in the documentation. The returned data is in JSON format.
HTTP/1.1 200 OK
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true
OData-Version: 4.0
Date: Sat, 28 Jun 2014 00:44:07 GMT
Content-Length: 85
{
"@odata.context":"http://localhost:38479/$metadata#Edm.Decimal","value":50.00
}
This is simple JSON. It may look like a dictionary but it's not. It's similar to YAML as well.
"@odata.context":"http://localhost:38479/$metadata#Edm.Decimal",
"value":50.00
You can test with Postman; send a request and inspect the response in raw format to confirm if it's your code or the API result.
The Basics of Using Postman for API Testing - YouTube
But I think your just mistaking this for Dictionary, because I can't see a dictionary as being capable of HTTP transport.
Now you need to make a model of the result to convert the JSON result. or use var result = callapi();
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Hi
I have an existing class that sits in a library project that is used natively for handling data object instances and also serialized/deserialized for use with json, xml and datasets. Changing the class looks to be tricky without compromising other projects.
I'm trying to put a SOAP wrapper around some of the class logic but running into problems because the class has multiple Subclasses with the same name.
Error
Types 'Library.DataModel.HardwareOrder.ResponseSet' and 'Library.DataModel.ProduceOrder.ResponseSet' both use the XML type name, 'ResponseSet', from namespace 'http://MyTest.com/'. Use XML attributes to specify a unique XML name and/or namespace for the type.
This is my ASMX
<WebMethod()>
Public Function SubmitHardwareOrder(ByVal Parameters As DataModel.HardwareOrder.Parameters) As DataModel.HardwareOrder.ResponseSet
End Function
<WebMethod()>
Public Function SubmitProduceOrder(ByVal Parameters As DataModel.ProduceOrder.Parameters) As DataModel.ProduceOrder.ResponseSet
End Function
This is a small sample of my class
Public Class DataModel
Public Class HardwareOrder
Public Class ResponseSet
Public Property ResponseHeader As List(Of ResponseHeaderRow)
Public Class ResponseHeaderRow
Public Property TransactSucceed As Boolean
Public Property TransactCode As String
Public Property TransactDescription As String
Public Property TransactionReference As String
Public Property TpxID As String
End Class
End Class
End Class
Public Class ProduceOrder
Public Class ResponseSet
Public Property ResponseHeader As List(Of ResponseHeaderRow)
Public Class ResponseHeaderRow
Public Property TransactSucceed As Boolean
Public Property TransactCode As String
Public Property TransactDescription As String
Public Property StaffID As String
Public Property PurchaseOrder As String
End Class
End Class
End Class
End Class
I've been looking for solutions but so far I haven't found anything that has enabled me to use my existing class without alteration.
Does anyone know of any tricks that can be done in the ASMX to make it work?
modified 26-Apr-19 23:38pm.
|
|
|
|
|
I was going to answer this a couple of days ago when I was compiling; sorry about that. Had to test it.
You really just have a bad design and should change it. If your using this for soap you should decorate the class with serializable, so the data sent back to the client can be encoded.
I would of wrote it like this to make ResponseSet reusable.
Public Class DataModel
[Serializable()]
Public Class HardwareOrder
Public Class ResponseSet
Public Property TpxID As String
Public Property ResponseHeader As List(Of ResponseHeaderRow)
End Class
End Class
[Serializable()]
Public Class ProduceOrder
Public Class ResponseSet
Public Property StaffID As String
Public Property ResponseHeader As List(Of ResponseHeaderRow)
End Class
End Class
[Serializable()]
Public Class ResponseHeaderRow
Public Property TransactSucceed As Boolean
Public Property TransactCode As String
Public Property TransactDescription As String
Public Property TransactionReference As String
End Class
End Class
Or perhaps add a property to the ResponseHeader called ID, a generic name and drop your property of TpxId. But if you do that then there is no need to have HardwareOrder and ProduceOrder because they become the same model. Technically this can just become
[Serializable()]
Public Class Order
Public Property Id As String
Public Property TransactSucceed As Boolean
Public Property TransactCode As String
Public Property TransactDescription As String
Public Property TransactionReference As String
End Class
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Hi Jkirkerx
Thanks for your posting. I tried it the code compiles fine but the same error I described earlier arises from the asmx at runtime
Error
Types 'Library.DataModel.HardwareOrder.ResponseSet' and 'Library.DataModel.ProduceOrder.ResponseSet' both use the XML type name, 'ResponseSet', from namespace 'http://MyTest.com/'. Use XML attributes to specify a unique XML name and/or namespace for the type.
When serializing to xml or json the class works fine but in SOAP things start to get a little ugly.
I found a solution that makes it work by adding the following XmlElement tags to the routines.
<WebMethod()>
Public Function SubmitHardwareOrder(<XmlElement("Parameters", Namespace:="http://MyTest.com/HardwareOrder.Parameters")> Parameters As DataModel.HardwareOrder.Parameters) As XmlElement("ResponseSet", Namespace:="http://MyTest.com/HardwareOrder.ResponseSet")> DataModel.HardwareOrder.ResponseSet
End Function
<WebMethod()>
Public Function SubmitProduceOrder(<XmlElement("Parameters", Namespace:="http://MyTest.com/ProduceOrder.Parameters")> Parameters As DataModel.ProduceOrder.Parameters) As XmlElement("ResponseSet", Namespace:="http://MyTest.com/ProduceOrder.ResponseSet")> DataModel.ProduceOrder.ResponseSet
End Function
I note that yes the above makes it work but its not beautiful because when you generate your web reference in visual studio the generated class does not have levels eg not not do this "DataModel.ProduceOrder.ResponseSet" instead its just "ResponseSet" and so next time it sees another class called "ResponseSet" it renames it to "ResponseSet1" and next time "ResponseSet2" and so on. So if you are working of a large complicated namespace/class with many levels the web references created wont be overly intuitive if naming is not unique.
Clearly SOAP (Simple Object Access Protocol) is just that simple and this endeavor hits it's limitations bang on.
The foreseeable options are
-consume the webservice as per my above example with the inconvenience of none intuitive naming
-modify the class or create a separate duplicated class just for SOAP webservice
-use SOAP differently with passing/returning literals/datasets not strictly working of object model
-modify or build the wsdl class manually (this is the biggest time waster! I stay well away from wsdls that dont work as is especially if not generated by visual studio)
-just use xml or json and stream the data back via a handler
-use something else WCF?
|
|
|
|
|
 I don't know. It looks like your still using the original models or classes to me and not the modified ones.
I wrote mine like this, but used serialized classes and not actual XML
Then tested it calling the API in the browser, and getting that white and blue page that shows the all the WSDL services.
I remember seeing my class outputted on the screen, but can't remember if it was XML. But I wrote a Win App to call this web service and it worked really well.
<WebMethod(EnableSession:=True)>
Public Function customers_load(
ByVal CustomerRequest As ws_customers_Request) As ws_customers_Response
Dim customer As New ws_customers_Response
Dim customerList As List(Of ws_customers_list) = Nothing
Dim dwXCode As Integer = crm_ef_login.administrator_Login(
CustomerRequest.Credentials_Key,
CustomerRequest.Credentials_Password
)
If (0 = dwXCode) Then
If CustomerRequest.PageIndex = 0 Then CustomerRequest.PageIndex = 1
If CustomerRequest.PageSize = 0 Then CustomerRequest.PageSize = 25
Dim m_count As Integer = crm_ws_ef_customers.customers_Load(
CustomerRequest.PageIndex,
CustomerRequest.PageSize,
customerList
)
If (m_count > 0) Then
customer.response_Code = "OK"
customer.response_Text = m_count & " subscribers have loaded successfully"
customer.customerList = customerList
Else
customer.response_Code = "E001"
customer.response_Text = "No subscribers exist in the database"
customer.customerList = customerList
End If
Else
customer.response_Code = "E000"
customer.response_Text = "Failed Authentication"
customer.customerList = Nothing
End If
Return customer
End Function
<Serializable()>
Public Class ws_customers_Response
Private m_response_Code As String
Private m_response_Text As String
Private m_customerList As List(Of ws_customers_list)
Public Property response_Code As String
Get
Return m_response_Code
End Get
Set(value As String)
m_response_Code = value
End Set
End Property
Public Property response_Text As String
Get
Return m_response_Text
End Get
Set(value As String)
m_response_Text = value
End Set
End Property
Public Property customerList As List(Of ws_customers_list)
Get
Return m_customerList
End Get
Set(value As List(Of ws_customers_list))
m_customerList = value
End Set
End Property
End Class
<Serializable()>
Public Class ws_customers_list
Private m_CustomerID As Integer
Private m_FirstName As String
Private m_LastName As String
Private m_EmailAddress As String
Public Property CustomerID As Integer
Get
Return m_CustomerID
End Get
Set(value As Integer)
m_CustomerID = value
End Set
End Property
Public Property FirstName As String
Get
Return m_FirstName
End Get
Set(value As String)
m_FirstName = value
End Set
End Property
Public Property LastName As String
Get
Return m_LastName
End Get
Set(value As String)
m_LastName = value
End Set
End Property
Public Property EmailAddress As String
Get
Return m_EmailAddress
End Get
Set(value As String)
m_EmailAddress = value
End Set
End Property
End Class
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Hi,
Want to develop a software by which view and print the sql data by searching data by specific name , date and time. Can anyone guide me ?
|
|
|
|
|
|
Hello,
I am trying to share a few API's between multiple sites on the same server (IIS 8.5).
In a simple architecture, I would have each site on its own port, and each API on its own port, with the sites pointing to the API's they need.
Unfortunately, we have a restriction that forces us to have the actual API's "under" the main site, by using "add application" in IIS, and using aliases for each API.
This works fine actually.
What I would like to now is to have other sites use the same API's, also by having aliases, but without physically duplicating the API's either on disk, or even in memory.
Put simply, it looks like this:
localhost:1000/index.html = site1
localhost:1000/aliasAPI1/… = api1
localhost:1000/aliasAPI2/… = api2
…
and I would like:
localhost:2000/index.html = site2
localhost:2000/aliasAPI1/… = api1 = same as on site 1, in the same physical folder
localhost:2000/aliasAPI2/… = api2 = same as on site 1, in the same physical folder
The reason being that site 1 is fully intranet, and site 2 will be visible from the outside world via junctions created somewhere else on the network, and where we want to enable only 1 port to reach site 2.
I actually made a test simply by adding applications under site 2, and pointing physically to the same API folders, and it works, but it shows that the API's are ran twice in memory.
Tried both in the same application pool, and in separate pools.
Is there a way to really share the API's in a configuration like this one ?
I've Googled the issue.. but couldn't find anything relevant
Any help would be appreciated
Fred
|
|
|
|
|
|
Oh I did not know ARR .. I will look into it deeper, but at first glance it looks like it could solve my problem. Many thanks ! 
|
|
|
|
|
Wow what a trip! Sort of excited that I finally got my app to work in a production environment.
Having to learn Docker like real fast, and then really having to understand how .Net Core 2.2 works. What made it worst was wrapping Angular V7 in .Net Core 2.2, making it much more complicated now. And then connecting it to MongoDB running in another container.
Working with VS2017 and Docker
VS2017 gives you the ability to run your .Net Core 2.2 app in a Docker for Windows container so you can test and debug. But after creating the container, you can't start it again unless you use VS2017 to run it again. What ends up happening is that VS2017 does 1/2 the work in the background and uses the needed components from your shared drive and you can't see it unless you look really close at the output. Now try and use release to build that app and put it in a container, still won't work because your missing the rest of the files needed to run it that are on your shared drive. When you go to peek inside a debug container, it's totally different than a release container. You have to alter your Dockerfile to copy the rest of the files needed to run isolated without a shared drive. Then when you push to Docker Hub you will have everything required.
Visual Studio 2017 will program your environment variables, but to run self contained you have to create them in your Dockerfile or docker-compose.yaml file. eg. DOTNET_RUNNING_IN_CONTAINER=true
VS2017 and Azure:
I actually got to the point where I thought that Docker support for VS2017 was locked into Azure, and that they didn't want us to host Docker containers ourselves, but that was not the case. What it boiled down to was going back to basics and building my project by command line to better understand how "dotnet" works and then build the Docker container. Once I understood the relationship between the two, I was able to go back to VS2017 and craft a better Dockerfile, and then compose it. But what works in Docker for Windows is a whole different story in Docker for Linux.
So to answer some questions that you may have:
Can you host your .Net Core 2.2 app in Docker just using Kestrel - YES
Can you program Kestrel to use SSL with an embedded PFX file - YES
Can you control Kestrel's ciphers such as TLS, no SSL - YES
Do you need a reverse proxy server such as Nginx - NO - so far I haven't had to
Will the stock Dockerfile work - NO - You have to modify it to your needs
Do the current MongoDB C# V2.8 drivers work with Docker and .Net Core 2.2 - YES - but programing the connection string is different than not being in a container. SHA256 auth errors.
Some Advice:
Learn "dotnet" command line first before learning Docker.
Carefully prepare your Programs.cs file for Docker, because if this file crashes your container startup, you won't be able to debug it. No logs, nothing. Add Logging to your Programs.cs will help isolate issues.
Don't hard code much, use json files instead.
Don't trust search engine results:
The most frustrating part is the ocean of outdated information on the internet. When I started learning Angular, all the information was outdated and for V2 and not V6. But it's been cleaned up now. It's the same for .Net Core 2.2 and Docker in which the info is outdated.
Port Numbers:
The other frustrating issue is port numbers. Why does .Net Core want to use ports like 5000, 5001?
When you develop for IIS, normally the port number is 44367 or something. I still don't have the answer for this but used ports 80,443 any ipAddress in Programs.cs and set the ip address in Docker. This took the longest to understand.
Version of Linux:
I tried 2 versions, CentOs and Ubuntu. Not being a fan of Ubuntu, I used it because of it's small footprint and builtin Docker, Docker-Compose support. The build size is so small, I think I can run this on a Raspberry. So Ubuntu Bionic Beaver V18 worked the best.
So what's next?
I'll cleanup my website content at home and run the Docker Compose production version for a couple of weeks. Then build the next server with Docker Swarm and see how that works.
Hope this helps someone looking to do the same thing.
March 16, 2019
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
That is a good candidate for a Tip, or with a little more detail, as an Article.
|
|
|
|
|
Good idea!
But I need to get more knowledgeable about it first. A couple of things back fired on me as I tried to perfect Kestrel to obtain a "A" rating on GMetrix, but I figured it out. As I perfected external HTTP request, I broke the internal HTTP request.
And I still have to fix the problem with using the refresh button on the browser which is an Angular or SPA issue not playing nice with .Net Core's routing. I see Microsoft has created a new project template for React/Angular/SPA that seems to have fixed it; and it uses a more native version of Angular for wrapping without using Web Pack. This I'm happy to see because it makes more sense to be able to just create an Angular project and then wrap it in .Net Core.
But overall, just getting .Net Core 2.2.4 working in Docker for production use using SSL would be a good place to start.
Maybe later this month. The link below is a working example of the project running in Docker using just Kestrel. It's a work in progress, the refresh button may not work, and I'm trying to determine the best way to fix it.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Actually in my GirdView link button click open new page with passing more than one values usin querystring. Now we want to remove querystring. And we don't want to use session. is their any process to pass values.
Thanks
|
|
|
|
|
|
Hi,
Question, I was trying to get expiry date from my database, I already got those list display on my Listview.
But when Im trying to update the year. Still showing on my list.
sample Date today is 13-Apr-2019, i want to display those upcoming expiry +30 Days.
but if I update it to 13-Apr-2020, still showing.
My code i use.
"Select * from TblEmployee where IDExpiry<=@IDExpiry"
siemdi.Parameters.Add("@IDExpiry", OleDbType.Date).Value = DateTime.Today.AddDays(30)
|
|
|
|
|