Click here to Skip to main content
14,928,677 members

Comments by miss786 (Top 185 by date)

miss786 17-Jun-16 9:43am View
   
Hi, Thank you for your suggestion and help. I am little unclear in regards your solution. Should i be returning the method outside the loop? Thanks
miss786 17-Jun-15 9:22am View
   
Hi, Thank you for your reply. I have updated my function above with pasteSpecial property, but I am still getting a blank data output in the book1.xls file.

Any further help would be very much appreciated.
miss786 28-May-15 7:45am View
   
Thank you you so much for the updated answer. I very much appreciated that. :)
miss786 28-May-15 7:15am View
   
Thank you for your response and help. However, when executing the above expression i get the following error parsing "(+|[a-zA-z])\d+(+|[a-zA-z])" - Quantifier {x,y} following nothing.. I have tried editing this but I cannot seem to resolve it. Thank you
miss786 15-Apr-15 7:48am View
   
Thank you very much for your solution. Much appreciated.
miss786 15-Apr-15 7:14am View
   
I have updated my original post, showing how the result variable is being returned at the end of the loop. Is this correct? Thank for your time and help.
miss786 15-Apr-15 4:42am View
   
Thank you for your feedback. I was originally only using foreach loop, but that only outputted the last anchor tag (1) from the string, however the string contains two anchor tags, which should be the correct output.
Any further guide, would be very helpful. Thanks
miss786 23-Mar-15 8:24am View
   
apology for the late response.
the cors headers are already in place under the host domain files - test.domain.com/test2.aspx.

i would like to clarify, if the need to define the cors header in the head tag of the text.aspx page as well.
thank you for your feedback.
miss786 23-Mar-15 8:19am View
   
Thank you for your reply. I have updated my original post showing the server side code behind test2.aspx, for further reference. many thanks for any further help.
miss786 18-Mar-15 12:30pm View
   
Hi, thank you for your explanation. I tried your suggestion, i am sorry to inform, i was unable to get any output. I am now getting blank's in my table id from the ajax function. I tried changing my server code to output json string instead of array but I am still experiencing the no data showing in my table id. (please the my main post for further reference).

Any further advise would be very helpful. Thank you
miss786 4-Feb-15 9:57am View
   
Thank you for your reply and help. I have tried the above approach and it keep giving me --> Object reference not set to an instance of an object -- error.

I have tried many variations to get this functionality to work but I seem to keep failing. Here is my updated code, which currently is throwing the object null error

SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
// da.Fill(ds);
da.Fill(ds, "articles read");

//DataRow dr = ds.Tables[0].Rows[0];
// lblRead.Text = dr["rDATE"].ToString();

if (ds != null && ds.Tables[0].Rows.Count > 0)
{
lblRead.Text = ds.Tables["articles read"].Rows[0][1].ToString();
}


I am able to get a value in row[1], does that mean I am getting data in my datatable?
Thank you
miss786 28-Jan-15 5:08am View
   
APology for the late reply. Thank you very much for providing a great solution. I appreciate your time and help.
miss786 27-Jan-15 7:36am View
   
thank you for your reply. please see the above reply, for I what i would like to extract from the list variable. Thank you for suggesting 'Regexp', I shall look into that.
Many thanks
miss786 27-Jan-15 7:35am View
   
apology for the being clearer.

My if conditions are:
- extract values which are >125 & contains 's' at the end of the string (i.e. 160s)
- extract values which contain alphabet & '+' & number (i.e. R+160)

desired output:
the extracted values, be placed inside 'row["Value"] = ?'

I hope this helps, to clarify my desired output.
Thank you for your help.
miss786 20-Jan-15 7:39am View
   
Apology for the late response. I manage to solve the issue, using row bound event for creating header in my gridview. many thanks
miss786 12-Jan-15 10:30am View
   
Thank you for your reply. Your solution looks quite promising and I shall give this approach a try. Many thanks your your help and time.
miss786 24-Nov-14 6:02am View
   
Thank you very much for the your help and explanation.
miss786 21-Nov-14 10:21am View
   
Thank you very much for your help and time. That worked.
miss786 21-Nov-14 9:03am View
   
thank you for your quick response. I changed my code, as you suggested but the above line, still gives a similar error (i.e. cannot convert from object to string). Please advice further if possible. Thanks
miss786 12-Nov-14 7:23am View
   
Hi, thank you for reply. would it be possible to update the function, so it only looks for tags name after date September 2014?
Thank you for your advice.
miss786 6-Nov-14 10:39am View
   
Thank you you all for your suggestion. Will the following procedure work, if I partition the tag_library data into smaller subset called "small_libraryTag". Then create a update trigger, to update the article field body with hyperlinks (i.e. call the above function). Is this new procedure plausible, to execute quickly.

Many thanks for your help and advice/
miss786 6-Nov-14 6:12am View
   
Thank you for your reply. I am slightly struggling to figure out a way, if there is way to execute the query under 1 min time, if possible. Please advice further.
miss786 27-Oct-14 6:50am View
   
Thank you for your reply. i have already tried this variation of code for my get data method. I am still experiencing the same error, with the 'product' class.

However, I would like to clarify, in what do your mean by "try updating the model and run custom tools.". Is their some guide/framework, i could follow to proceed further. Many thanks for your time and help.
miss786 23-Oct-14 10:39am View
   
Thank you so much for solution and your time, into explaining the issue and improvement in my code. I really appreciate your help and from generous answer, i was able to implement my task. Many thanks. Have great evening. :)
miss786 22-Oct-14 7:44am View
   
Would i need call something in page_load method, to trigger the preRender method. Please advice further. Thanks
miss786 22-Oct-14 7:40am View
   
Thank you for your reply. I changed my output string for the Article() method to the following above in the post(htmlStr).

I tested the getArticle() method separately, it renders the article on the client-side, as whole, its still failing to display the tags' name within the article, as hyperlink, on the client-side. I have attached my html in the above post, as further reference.
miss786 22-Oct-14 6:47am View
   
Thank you for your reply. I have updated my code with the requested methods. I have tested the return for each method and they seem to work fine. I am little unsure, of how to implement the logic in the preRender() method. Some guide/hints would be very much appreciated. Many thanks.
miss786 17-Oct-14 12:07pm View
   
Thank you so much for solution and you explanation, into why I was experiencing this issue. You have been great help. Much appreciated. Many thanks & have a great weekend! =D
miss786 17-Oct-14 10:11am View
   
Hi, thank you for your help. Sadly, I have already tried this above in my code, which does not remove the html tags on the client-side.
miss786 17-Oct-14 10:10am View
   
Thank you for your reply & apology for the late response. I have copied the output as text, in my above post for further reference. I was unable to attach screenshot of my output, as I could not find option, on the forum to do so.

I also would like to inform, I am insert the articles into database using "tinymce'' text editor, could this be the reason, why the 'replace' string is not rendering correctly? Thank you
miss786 17-Oct-14 7:27am View
   
Thank you for your reply. I have corrected the tags for <br/>, but it still appearing on the client-side. Please advice further.
miss786 16-Oct-14 7:55am View
   
Thank you for your reply. I am writing to seek help with the "to set ALL instances of [tag1, tag2] as hyperlinks?". Would I create this functionality, in insertData method() or getData() method. Many thanks.
miss786 14-Oct-14 12:26pm View
   
Thank you very much for your help. =D
miss786 25-Sep-14 9:28am View
   
Apology for the late reply. This great, exactly what I was look for. Many thanks for your time and support. Have a great day/evening! :)
miss786 25-Sep-14 7:03am View
   
I would like the "target_type" & "target" nodes to have values. Thanks.
miss786 25-Sep-14 6:56am View
   
Thank you for your response. I am trying to get the <target> tag under the <targets> tag. I am little unclear how to do this and would you know a specific method within XElement class, I could use to achieve this. Many thanks.
miss786 24-Sep-14 10:57am View
   
Thank you for your reply, but the url for the sending name API and tag API is different. I need to send the Name API and if that comes back with id response, then I need to use that response id and create a tag url, and then create a tag API using that tag url.

I hope i have explained my issue clearly, if not, please do let me know. Many thanks. Please advice further, if possible.
miss786 24-Sep-14 7:09am View
   
Many thanks for explaining the logic. This mistake will not happen again.
miss786 24-Sep-14 7:08am View
   
Thats amazing. Many thanks for your great help. :)
miss786 22-Sep-14 9:30am View
   
thank you for your reply back. I would like to clarify, if the create Issue method is returning the xml into the findURL link? Is this correct?
miss786 11-Sep-14 5:08am View
   
I have tried adding the following line of code, under the if statement ( System.Web.HttpUtility.UrlPathEncode(name);), but I am still getting the same output.

Please help. Many thanks
miss786 9-Sep-14 12:30pm View
   
Thank you for your reply. I was originally creating my XML (createXMLPub) within the page_load method as you have created above in your example, which rendered the XML onto the page, but If I reference the XML data from the createXMLPub() method, into the pageLoad(), and it does not show, does that indicate createXMLPub() is not returning the XML string.

Please advice, if possible. Thanks
miss786 9-Sep-14 12:10pm View
   
I see. Sadly still no luck with your above suggestion.

public void createXML(string data)
{
// string a = createXMLPub(data);
// Label1.Text = HttpUtility.HtmlEncode(a);
Label1.Text = "createXML";
}

if (!IsPostBack)
{
// string a = createXMLPub(data);
// Label1.Text = a;

createXML2(data);
}

Thanks for reply.
miss786 9-Sep-14 12:05pm View
   
Apology for not mentioning this in the original post, but there is not html data in the ViewSource page either. I have checked this many times with different code.

I am little stuck, what other approaches to take, in order to render XML string on to current page.

Many thanks for your time and help.
miss786 9-Sep-14 11:53am View
   
I am not getting no errors, just blank page. I tried to debug the page_load method, which calls the createXML(), but it does not show the local variable window, hence I am assuming my approach to call the createXML() in the page_load method, maybe incorrect.

Please advice, further if possible. Many thanks.
miss786 9-Sep-14 11:46am View
   
Dear Richard, Thank you for your solution input. I am sorry to inform, I was unable to get your approach to work. Do I need to add extra properties to the label tag in my HTML;

<form id="form1" runat="server">
<div id="format_dvi" runat="server">
<asp:label ID="Label1" runat="server" >
</div>
</form>

Thank you
miss786 9-Sep-14 11:43am View
   
Dear Raju, Thank you for your response. I have added CreateXMLPub() method, in the original post. Thank you for your help.
miss786 9-Sep-14 11:10am View
   
Dear Raju, Thank you for your solution, but i am sorry to inform, I could not get your solution to work, hence I am still getting the same error. I have updated my code in the above post. My goal is to view the XML string from the CreateXMLPub() method on to the web page. Further guide, into what I could look into to solve this issue, please. Many thanks.
miss786 9-Sep-14 7:49am View
   
Hi, Thank you very much for your approach. I followed you guide but I am still experiencing a blank page.
string a = createXMLPub(data);
XmlDocument xml = new XmlDocument();
// xml.LoadXml(a);
// Response.Write(xml.OuterXml);
// format_dvi.InnerText = xml.OuterXml;


However, I tried creating try and catch method and calling that in the page load, however that also is showing blank page.
public void createXML(string data)
{
string a = createXMLPub(data);
XDocument xDoc = new XDocument(a);
try
{
xDoc = XDocument.Load(Server.MapPath("xml/products-string2.xml"));
// xDoc.Load(path + "products-string2.xml");
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
return;
}

Response.Redirect("products-string2.xml");//load web browser

}

Please advice further.
miss786 9-Sep-14 7:22am View
   
Thank you for your reply. I am trying to show it on the current page. Would LoadXML property work here?
miss786 9-Sep-14 6:01am View
   
Hi, Apology for the late response. I had previously tried this but this approach gave me sadly more compiling errors, such as
1. No overload for method 'createXMLPub' takes 0 arguments

2.An object reference is required for the non-static field, method, or property 'System.Web.UI.Page.Server.get'

To the code below:
public static void createXMLPub(string data )
{
XElement xeRoot = new XElement("pub");
XElement xeName = new XElement("name", "###");
xeRoot.Add(xeName);
XElement xeCategory = new XElement("category", "#####");
xeRoot.Add(xeCategory);
XDocument xDoc = new XDocument(xeRoot);
xDoc.Save(Server.MapPath("products-string2.xml"));

//Response.Redirect("products-string2.xml");//load web browser
//return xDoc;

data = xDoc.ToString();
return data;
}

Please advice. Thank you.
miss786 3-Sep-14 5:09am View
   
Hi, Thank you very much for your time and help. This has been a great help.
miss786 29-Aug-14 8:09am View
   
Thanks this is great help. Many thanks
miss786 22-Aug-14 10:44am View
   
thanks for your reply. I am slightly unfamiliar with the SSIS, is there a link or guide, i could use, which could give me some hints into how to approach this issue in c#, if possible.
miss786 12-Aug-14 11:25am View
   
Hi, I am consuming the web api from API controller and I am calling the POST request from Fiddler only. I have debugged the Private and Post method, and it has resulted in query object as null.

It looks to me that the problem lies in the values not correctly submitted to the server. I have tried playing around with the web-api routing and adding in ActionName property to the code, but here also I experienced the same issue.

I would like to seek advice, if the issue could be the type of request HttpContext request, I am using. I appreciate your time and help and patiece into this. Many thanks for your help.
miss786 12-Aug-14 11:18am View
   
Deleted
jj
miss786 8-Aug-14 12:22pm View
   
Apology for the very late response. I am writing to inform the request forcefully from the client-side, have not made any impact on the POST API, as I am still experiencing the same issue -- query = null. I have changed and updated the client-side code many times, using many examples from online and I am still unable to get this to work.

Is there another approach I could look into, for calling both GET and POST request from one controller. Please advice further, if possible.

I really appreciate your time and help into this. Thank you very much.
miss786 31-Jul-14 9:59am View
   
Hi, I tried adding in the 'query' verfication check and now its throwing a 404 error "something wrong with query statement" in fiddler as an output.

if (User.IsInRole("admin"))
{
IQueryable Data = null;
if (query != null)
{
if (!string.IsNullOrEmpty(query.name))
{
//do something
}
if (Data == null)
Data = db.data;

if (query.endDate != null)
{
Data = Data.Where(c => c.UploadDate <= query.endDate);
}
Data = Data.OrderByDescending(c => c.UploadDate);
var data = Data.ToList();

if (!data.Any())
{
var message = string.Format("No data");
return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);
}
return Request.CreateResponse(HttpStatusCode.OK, data);
}
return Request.CreateErrorResponse(HttpStatusCode.NotFound, "something wrong with query statement.");
}
return Request.CreateErrorResponse(HttpStatusCode.NotFound, "Access Denied");
}

Am I doing something wrong in the code above. Or my approach to the verification line of code, is incorrect. I really appreciate your time and help. Many thanks
miss786 31-Jul-14 9:16am View
   
public class Query
{
public string name { get; set; }
public Nullable<datetime> startDate { get; set; }
public Nullable<datetime> endDate{ get; set; }
}
miss786 31-Jul-14 9:16am View
   
Query is my object class and db.data is my model class. If you do not mind explaining, what you mean by creating script level. I am still learning my way through .Net programming and APIs. Thank you very much for your time and help.
miss786 31-Jul-14 8:13am View
   
Thank you for your feedback. I am calling the post method in fiddler. I tried the URL which you suggested but I am still getting the same error. Can this error be prevented using try and catch statement within the private method, if possible. Many thanks for your time and help.
miss786 31-Jul-14 7:10am View
   
Apology for the missing out the 'query' questions. The query value is null, when I debugged it while testing the POST request in fiddler, however, its not null, when I call the GET request using URI (web browser). Does that mean, I need to amend my code for the POST request, if so, then how, please advice.
miss786 31-Jul-14 6:47am View
   
Thank you for your reply back. I have updated my question, with the Fiddler POST request call procedure code, as requested. Any help would be very much appreciated. Many thanks.
miss786 17-Jul-14 4:38am View
   
Thank you so much for correcting this. I really appreciate your help. Many thanks for solution.
miss786 23-Jun-14 11:01am View
   
Hi thank you for your reply. I have updated my question with the relevant information requested. Please advice, further. Many thanks.
miss786 10-Jun-14 9:47am View
   
I am trying to build a line chart which is able to show, multi-series line for names column, using event listener. I have attached sample code on the following link below: http://jsfiddle.net/mis786/FRz59/2/.

I am currently unable to run the code, as I am having trouble compiling the function. please advice. Many thanks for your response.
miss786 6-Jun-14 12:40pm View
   
thank you for your response. Taking your consideration into account, the application executes the (NewsTrials) query first. So i tried merging the two and I am trying to create method which executes query1 first then query:

public UserDetail full(string username, string password)
{
var query1 = from s in db.Subscriptions
join u in db.UserDetails on s.sUID equals u.uID
where s.sPrice_ExpiryDate >= DateTime.Now &&
s.sPID.Value == 163 &&
s.sWIC_All.Value == true &&
u.uUsername == username &&
u.uPassword == password
select u;

var query = from s in db.Subscriptions
join u in db.UserDetails on s.sUID equals u.uID
where s.sTrialExpiryDate >= DateTime.Now &&
s.sPID.Value == 163 &&
u.uUsername == username &&
u.uPassword == password
select u;

if (query1 != null)
{
return query1.FirstOrDefault();
}

return query.FirstOrDefault();
}

Currently, user1 is still falling under var query, instead of query1. Could you please advice, how could i make the order of the query work? Thank you.
miss786 6-Jun-14 10:46am View
   
Many thanks for your feedback.

I have a web-api application, where I have the following two queries set-up, newsTrial(query), leads to [Newspage] and fullTest(query), leads to [fullPage]. when I login as user1, it leads to [Newspage] instead of [fullPage]. However, I have tested the user1 against the following sql query and it shows user1 records in the sql query below, but using the trial sql query.

select u.[uID], u.[uUsername], u.[uPassword], s.[sPriceABS_ExpiryDate]
from [dbo].[UserDetails] u
join [dbo].[Subscriptions] s
on u.uID = s.sUID
where s.[sPrice_ExpiryDate]>= getdate()
and s.[sWIC_All] = '1'
and s.sPID = '163'
miss786 6-Jun-14 10:27am View
   
Apology for not making question clearer. when user1 has only trialexpiry and trialstart date, then user1 is known as newsUser, however when the user1 also has wic_all,priceStart and priceExpiryDate, then the user1 becomes a full user. Currently, I cannot get the user1 to login as full-test, this is my current issue at the moment. please advice, if possible.
miss786 5-Jun-14 9:41am View
   
Deleted
thanks that worked. I would like to ask one small thing, in regards post methods. Can you call post methods as querystring such as localhost####/api/test?name=###?

please advice. many thanks.
miss786 5-Jun-14 8:43am View
   
Thank you for your response. I tried your code but I am sorry to inform, I still experiencing the same error as mentioned above. I would like to ask, can you call post method as q query string --> api/test?name=bacm.

any help much appreciated.
miss786 4-Jun-14 10:20am View
   
Apology for the late response. I was unable to solve the issue using the above link. However I have added a ajax code on the client end and i am little unsure, if its the correct logic and syntax, as the query is still throwing the same error as an output response. Please advice. Thank you for your time and help.
miss786 2-Jun-14 7:56am View
   
Can you please recommend a process or plausible approach I could look into. Many thanks for your reply.
miss786 2-Jun-14 7:29am View
   
Thank you for your reply. I am trying create function in javascript, which displays 500 records of data, when the page loads but when the user trigger the controls[stringFilter], it filter the results using 100,000 datatset. In order to do that, I need to pass data and create two datatables within drawvisualisation() function, which I am currently unsure, how to go about doing so. Any feedback would be most appreciated.
miss786 2-Jun-14 7:29am View
   
Deleted
Thank you for your reply. I am trying create function in javascript, which displays 500 records of data, when the page loads but when the user trigger the controls[stringFilter], it filter the results using 100,000 datatset. In order to do that, I need to pass data and create two datatables within drawvisualisation() function, which I am currently unsure, how to go about doing so. Any feedback would be most appreciated.
miss786 30-May-14 9:32am View
   
apology for the late response. I have got it partially working at the moment. This is a great help. I really appreciate your hardwork and time into this. Many thank you.
miss786 29-May-14 11:43am View
   
Thank you for your response and feedback. I have updated my original post above in regards to the input and query object class. I have tried adding in [Enumerable.Range(1, 50);], to contain clause but I cannot seem to get that to work.
Please advice, if possible. Thank you.
miss786 29-May-14 10:15am View
   
Thank you for response. My code above, is currently passing the data value as ToList. If anyone ,could provide some guide to how I can remove the limit to search contain clause. Many thanks.
miss786 29-May-14 9:16am View
   
Deleted
Thank you for your response and feedback. I have updated my original post above in regards to the input and query object class. I have tried adding in [Enumerable.Range(1, 50);], to contain clause but I cannot seem to get that to work.
Please advice, if possible. Thank you.
miss786 23-May-14 9:53am View
   
thank you. that helped.
miss786 20-May-14 16:29pm View
   
thank you for your feedback. My current format for dates is -- May 19, 2014, 12:00:00 AM. I would like to trim the time from the date, if possible. please advise. thanks
miss786 14-May-14 5:19am View
   
Thank you for your quick response. I was originally using (data) however this shows the date format as 'NaN'. I would like to know how can I use (dt) in the parseInt line code. The (dt) value parse the date as string. Please advice if possible. Many Thanks.
miss786 12-May-14 9:51am View
   
Thank you for your feedback, apology for the silly mistake. I got it to work:

query = query.Where(c => ids.Contains(c.TAG));

Thank you very much for your help. :)
miss786 12-May-14 9:25am View
   
thank you for your quick response. I have posted my updated code above. Many thanks.
miss786 12-May-14 9:11am View
   
apology for the late response. I am sorry to inform, I am still getting the same error on the 'contain' clause:

cannot convert from 'string[]' to 'string' --> error

please advice, if possible. Thank you very much for your feedback.
miss786 12-May-14 7:49am View
   
Apology for not clarifying earlier, but I already tried this method and it throws many compiling issues such as:
Cannot implicitly convert type 'string[]' to 'var[]' -- error.
The best overloaded method match for 'string.Contains(string)' has some invalid arguments -- error.

Please advice, if possible. Thank you
miss786 12-May-14 6:40am View
   
Thank you for your quick response. Apology for the silly mistake and thanks a lot for pointing this out. Many thanks for your time and help. :)
miss786 9-May-14 11:42am View
   
apology, for the silly mistake in leaving out the error. The above post updated. please advice, thanks.
miss786 8-May-14 6:59am View
   
Thank you so much for clarifying this issue up. You have as been a great help. Thanks a million. =D. Have a great day!
miss786 8-May-14 6:58am View
   
Thank you for your reply back. I got the issue partially resolved using yours and Agent_007. I really appreciate your help and time. Many thanks.
miss786 8-May-14 6:30am View
   
Thanks but I have tried this query before and this does not filter the query data by only showing unique names. Please advice, if possible. Thank you
miss786 8-May-14 6:21am View
   
Thank you for your feedback. I tried your suggestion and the code works but when I run the query, it only shows me name fieldname data, not the entire data fields. How can I, get the query to display all the data fieldnames by filtering only the name fieldname as distinct. Thank you for your help and time.

var query = (from c in db.data_qy
where c.UploadDate == yesterday &&
c.Cover == "prest"
select (c.Name)).Distinct();
miss786 8-May-14 6:14am View
   
data_qy class is a sql server entity class generated through entity framework, and it may not work. However, I have tried doing that also, and I am still receiving the same error. Please advice, if possible. Thank you.
miss786 8-May-14 6:04am View
   
Thank you for your quick response. I am writing to clarify, if you are suggesting me to change the nullable date property in my 'data_qy' class? Thanks.
miss786 8-May-14 6:02am View
   
Deleted
I am sorry to inform, I have already tried this approach and still throws me the same error. Please advice, if possible. Thank you.
miss786 8-May-14 6:00am View
   
Apology, if you misunderstood my last comment. I am still getting the string error. if you could explain, why I am getting this error, then I can try something from there. I appreciate all your help and time.
miss786 8-May-14 5:23am View
   
Yes that is correct. I have updated my code with the requested Date class, which has 'AddBusinessDays' method. Thank you for your time and help.
miss786 8-May-14 5:23am View
   
Deleted
Yes that is correct. I have updated my code with the requested Date class, which has 'AddBusinessDays' method. Thank you for your time and help.
miss786 8-May-14 5:12am View
   
Thank you for your quick response back. I am sorry to inform, I had already tried this approach and it still shows me the same 'string' error. Please advice, if possible.
miss786 6-May-14 9:03am View
   
The datatype for 'UploadDate' is nullable datetime and the data entity is created through entity framework. I am still getting the above error on the uploadDate fieldname. This is what my current code looks like:

public HttpResponseMessage Get(DateTime? date)
{
if (User.IsInRole("admin"))
{

DateTime yesterday = DateTime.Today.AddBusinessDays(-4);


var data = (from c in db.data_qy
where c.UploadDate == yesterday &&
c.Cover == "storm"
select (c.Name)).OrderByDescending(a => a.UploadDate).Distinct();

if (!data.Any())
{
var message = string.Format("No data found");
return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);

}

return Request.CreateResponse(HttpStatusCode.OK, new {data });

}

return Request.CreateErrorResponse(HttpStatusCode.NotFound, "Access Denied, Please try again.");
}
miss786 6-May-14 8:22am View
   
Thank you very much for your response and help. I am sorry to inform, I have tried your code, but it outputs following compiling error:

'string' does not contain a definition for 'UploadDate' and no extension method 'UploadDate' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)

Thanks.
miss786 6-May-14 7:48am View
   
thank you for your response back. I tried that but it throws many compiling errors, in regards to 'a' not existing and many more. Please advice further, if possible. Thanks
miss786 29-Apr-14 5:22am View
   
Deleted
Dear Sampath Lokuge, I am writing to seek help, how can I filter the 'filter data' parameters and then merge two result. I manage to amend the code a little but I am experiencing with the updated code (please see the original post), an -- error ExceptionMessage":"Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.-- error.

Please advice, in where I may be going wrong?
Thank you
miss786 25-Apr-14 10:28am View
   
Deleted
Thank you so much for your response and feedback. I manage to create the method using the framework you suggested:<br>
 <br>
var filteredData = new List<iqueryable<database_bd>>();<br>
 <br>
if (!string.IsNullOrEmpty(query.name))<br>
{<br>
var ids = query.name.Split(',');<br>
foreach (string i in ids)<br>
{<br>
filteredData.AddRange((data.Where(c => c.Name != null && c.Name.Contains(i))));<br>
}<br>
}<br>
 <br>
I am sorry to inform, I cannot get the (AddRange) property to work in the code. I tired using your code as well, but its gives same error. <br>
 <br>

its throwing the following error:
The best overloaded method match for 'System.Collections.Generic.List<system.linq.iqueryable<api_09.database_bd>>.AddRange(System.Collections.Generic.IEnumerable<system.linq.iqueryable<api_09.database_bd>>)' has some invalid argument


Any advice would be very much appreciated. Thank you
miss786 25-Apr-14 6:20am View
   
select *
from [dbo].[database_BD]
where TAG like '%78473TAC4%'
or TAG LIKE '%05946XYZ0%'
OR NAME LIKE '%TAP%'
OR NAME LIKE '%STORM%'


Many thanks for your response and feedback.
miss786 24-Apr-14 12:40pm View
   
Deleted
Many thanks for the solution, it solved the error. I have small question, when I try to query (/api/data?name=storm,prestl,bcam&tag=78473TAC4,12669VAC2,05946XYZ0). I am getting (no data). I have tested the values against my sql record it should be giving me 10 results. Any advice, would be much appreciated, if possible.

Please note: I have updated my code for further reference.
miss786 24-Apr-14 7:21am View
   
Many Thanks for your response, that helped.
miss786 23-Apr-14 6:55am View
   
Many thanks for your solution. Is their a way to manipulate the group parameter to be able to login using both trial and full user credentials. I am assuming it would require an 'or' operator but i am little unsure where would add it. please advice. Many thanks in advance.
miss786 17-Apr-14 7:33am View
   
Deleted
Thanks for your response and help. I was previously using this code -- data = data.OrderByDescending(c => c.UploadDate).Take(10);, but if i use this code, i can not get my count variable to work, please see the updated code. I am trying to use the count variable to count records before the take(10), is this possible to do so. Please advice.
miss786 14-Apr-14 6:11am View
   
hi, I am really sorry for to inform, i already tried using toList(), as above and it gives the same old error:

Cannot implicitly convert type 'System.Collections.Generic.List<anonymoustype#1>' to 'System.Collections.Generic.IEnumerable<######>'. An explicit conversion exists (are you missing a cast?) -- error.
miss786 14-Apr-14 5:54am View
   
Many thanks for your solution, but I am sorry to inform, I am getting another error -- Cannot initialize type 'API_09.database_BD' with a collection initializer because it does not implement 'System.Collections.IEnumerable'.
miss786 14-Apr-14 5:50am View
   
Thanks for your response. when I add the 'return data' i get:

Cannot implicitly convert type 'System.Collections.Generic.List<anonymoustype#1>' to 'System.Collections.Generic.IEnumerable<######>'. An explicit conversion exists (are you missing a cast?) -- error.
miss786 25-Mar-14 12:55pm View
   
Hi, Thank you for your response. Is their link or tutorial i can follow, to implement this SSL feature into my server. Apology for unclear explanation, as I just read upon SSL being security feature of api feeds.
many thanks for your help.
miss786 21-Mar-14 11:54am View
   
Thank you for response. I have previously visited those links, is it possible to view any any sample or existing code, which i can use a guide to start implementing this feature.

Many thanks.
miss786 20-Mar-14 8:10am View
   
This is great. while i was research hash and salt, it only showed hashing new users, so I was unaware of this information. Many thanks for this information. I can finally move forward.

Its really basic API which call data and the data is authenticated using basic authentication. I will updated my original post with api and hash code for further reference.
miss786 20-Mar-14 7:31am View
   
Thank you for clarifying and giving helpful suggestions. I understand a hash password is created when a new user is created. Is it possible to create hash for existing users. for example, when I pass user's password through API, can i get the code to create hash password then, is this feasible.

Sorry for not clarifying my issue clearer, but I will be passing user's username and password through an api, which I have created (not using external api).

Many thanks for your support and I really appreciate your time.
miss786 20-Mar-14 6:33am View
   
Thank you so much for your response ryan. I am trying to encrypt the password stored in my database, when i send them over using web api (http). From the suggestions below, I am currently looking into "SHA512 or SHA256:" hash algorithms. I manage to create crypto class using the following code as a framework:(http://www.java2s.com/Code/CSharp/Security/CreatePasswordHash.htm.)

I am still little unsure of the process of, how do I create hash password when i send the username and password over the web api, and when would i store the hash password in the database. I already has existing users in the database which do not have hash password, so is it possible to encrypt their password, when sending details through web api. I hope this clarifies any misunderstanding regarding my problem.

Any help much appreciated.
miss786 19-Mar-14 14:00pm View
   
Hi, I manage to update my code and if you get time, could you please advise on the issue I am currently experiencing(please the above updated code), if possible please. Many thanks for your time and help.
miss786 19-Mar-14 13:39pm View
   
Thank you so much for your feedback. I am still little unclear, how do i go about storing the hash password or encrypting the passwords, when sending them over the http. if you get time, could you provide some guide or reference to any learning material to look into. Many thanks.
miss786 19-Mar-14 13:11pm View
   
Deleted
Hi, I manage to update my code and if you get time, could you please advise on the issue I am currently experiencing(please the above updated code), if possible please. Many thanks for your time and help.
miss786 19-Mar-14 12:15pm View
   
hi, I currently new into this encryption code, if you can advise a better alternative, then I happy to look into and update my code. any feedback is much welcomed.
miss786 18-Mar-14 8:18am View
   
hi, I am little unclear where would i add this and how this helps with the above issue. if you do not mind, clarifying this for me. many thanks for your help and time.
miss786 17-Mar-14 20:02pm View
   
Thank you for your response. thank you for clarifying this up. Is their a way to name or group this query? I have another two queries which call users and these queries represent different group of users, so i was wondering if their is a way to label the query above as particular user group, without the rolename fieldname from the database, so I can test query by:
if user details match query1(trial)
{
return page 1
}
else...

any help much appreciated. many thanks.
miss786 17-Mar-14 13:39pm View
   
hi, thank you for your response. I am not clear what would you like me to elaborate on, with the above query.
I would like to know, how can I assign a role to my query, so when i search for a username and password, it would display its assigned role. Hope this clarifies any misunderstanding.

Many thanks for your help.
miss786 17-Mar-14 8:57am View
   
Hi, thank you for your help. I have tried using 'List' and 'IEnumerable' as a method type but this makes my querystring such as api/data?name=app&price=78, return a blank screen on the client-side. This query type only allows me to search one value, whereas I would like to search both parameters name and price. Any help please.
miss786 13-Mar-14 13:43pm View
   
Hi, thank you for your response. I have tried your suggestion before, the 'repository.username' gives me error -- does not contain definition for username' -- error. Any help is most welcomed.
miss786 13-Mar-14 13:17pm View
   
IPrincipal principal = new GenericPrincipal(new GenericIdentity(user.username, BasicAuthResponseHeaderValue), null);

The 'user.username' parameter is throwing the issue.

Thank you for reply.
miss786 13-Mar-14 11:06am View
   
This is great help. Many thanks. Have a great day. =D
miss786 13-Mar-14 10:45am View
   
thank you so much for your response and help. if possible, could you provide some example to the user group function. Many thanks for clarifying that up.
miss786 13-Mar-14 9:52am View
   
thank you for your response. the two queries above, output two different user group and i would like to combine the both queries using a condition such as:
if (user = query1)
{
display page 1
}
else if (user = query 2)
{
display page 2
}
else
{
display page 3
}

apology for the confusion and hope my explanation clarifies my issue. Many thanks for your help and time.
miss786 11-Mar-14 13:38pm View
   
Many thanks. That solved it.
miss786 10-Mar-14 8:03am View
   
Hi, thank you for your response. I would like to be able to use the date interval, to plot line chart(googe charts api). the line chart would show x-axis with values 07 Mar in the beginning of the axis and end of the axis would show 07 Mar and between this values, there would be data points plotted showing on the y-axis. I was going to represent this using image, but i cannot upload a image representation of the desired output. Hope this clarifies the output. Any help much appreciated.
miss786 6-Mar-14 5:27am View
   
Thank you so much for your help and response. I am trying to convert the datetime into date type instead of converting into string type. Is their way to do this in the [web method] code? This what I have so far and the current code is giving me compiling errors:

DateTime dat = DateTime.Now;
//DateTime dat = new DateTime();

//dat = DateTime.ParseExact("yyyyMMddHHmmss", CultureInfo.InvariantCulture);
//var dtt = dat.ToShortDateString();
var dtt = DateTime.ParseExact(dat, "dd/MM/yyyy", null);

foreach (DataRow dr in dt.Rows)
{
try
{
cat = dr[0].ToString();

val = Convert.ToInt32(dr[1]);

typ = dr[2].ToString();

//dat = (DateTime)(dr[3]);
dtt = (Date)(dr[3]);
//dtt = dr[3].ToString();

}

Many thanks for your help.
miss786 5-Mar-14 10:15am View
   
Hi, Thank you so much for your response and help. I added in alert function, was able to find the code was not parsing json datetime into date. I tried updating my code and manage to get the date to parse into readable format (please see the above updated code), but I am currently experiencing this new issue -- Uncaught Error: Type mismatch. Value 16/1/2013 does not match type datetime in column index 3 -- error and getting blank screen on the client-end. Any advice would be helpful. Many thanks.
miss786 4-Mar-14 11:39am View
   
Hi, Thank you so much for your detailed response. I updated my post with datasource to the datalist, as requested. I think it maybe a format issue, as the other data point is not matching up with the date's years, which are showing up as 2014,2015,2016..etc on the chart. I will keep trying here on my end, but any suggestion or help would be very helpful. Many thanks.
miss786 28-Feb-14 7:31am View
   
Hi, Thank you reply. 'UploadDate is declared as 'datetime' type in the database. I manage to get it work, not sure if its the right approach, but its currently working. Thank you for your time and support. Many thanks.
miss786 28-Feb-14 6:31am View
   
hi, Thank you for your suggestion. I am still a little unclear, how do i go about writing sql query in c#, to be able to retriever yesterday's date's data. Its currently throwing -- Conversion failed when converting date and/or time from character string.-- error for the above code in my original post. Many thanks for your time.
miss786 27-Feb-14 5:35am View
   
Thank you so much for your suggestions, I manage to declare the variable using your suggestion. I have come across a little error in converting the datetime to string and I am experiencing - Cannot implicitly convert type 'string' to 'System.DateTime' -- error, on the following code:

List dataList = new List();
string cat="";
float val=0;
string typ = "";
DateTime dat = DateTime.Now;

dat.ToString("ddmmYYYY", System.Globalization.CultureInfo.InvariantCulture);

foreach (DataRow dr in dt.Rows)
{
try
{
cat = dr[0].ToString();

val = Convert.ToInt32(dr[1]);

typ = dr[2].ToString();

dat = Convert.ToString(dr[3]);

}
catch
{
}
dataList.Add(new Data(cat, val, typ, dat));
}
return dataList;
}

Thank you for your time and help.
miss786 27-Feb-14 5:20am View
   
hi, thank you for your reply. That is correct, how do i go about declaring the DateTime variable in the 'data' class? Many thanks
miss786 27-Feb-14 4:32am View
   
Thank you for your reply. Apology for not making my question clearer, but I would like to show exception, when the user fails to login on the client-side. I updated my code but I still cannot see any error message, when i leave the user credentials blank or input incorrect values. Thank you for your help.
miss786 26-Feb-14 9:04am View
   
Thank you for your response back. I am not sure, how to go about constructing a code to throw custom errors, if the username does not match or if the username is null. Is their some specific library, i should look into for creating custom error handlers? Thank you for your 'failAttempt' variable feedback, i shall also look into that. Any help much appreciated.
miss786 20-Feb-14 7:50am View
   
Thank you so much for your response. I manage to update the global.aspx code to the following:
GlobalConfiguration.Configuration.MessageHandlers.Add(new BasicAuthHandler(new User()));
miss786 20-Feb-14 7:27am View
   
I tired adding that but that gives me error - "Object reference not set to an instance of an object"

on the following line of code:

api_login user = repository.Validate2(credentials[0], credentials[1]);

Thank you for your response and help.
miss786 18-Feb-14 10:35am View
   
Hi, Thank you for your reply. I have tried removing the 'override' but then I get another error - 'object' does not contain a definition for 'SendAsync' -- error. On the following line:
"return base.SendAsync(request, cancellationToken);"

I am little confuse by, what you mean by "base class", if you don't mind clarifying this.

for example(do you mean something like this):
public User(cdwEntities context) : base(context) {
// ...
}

Thank you for your help.
miss786 14-Feb-14 6:43am View
   
Thank you for reply. I would like to use identity name property only but when I use that alone, it throws an error.
miss786 14-Feb-14 5:33am View
   
Thank you so much for your response. I manage get my linq query updated (please see the above original post), but I am still experiencing the following compiling error - Cannot use local variable 'query' before it is declared. I am aiming to use the linq to query to return username based on the where conditions. Is this right approach to an linq query for the getting the username output? I really appreciate your help and time.
miss786 13-Feb-14 6:08am View
   
Thank you for your response and solution, but when i added "dataTime.now", it throws -- Operator '&&' cannot be applied to operands of type 'bool' and 'int?'-- error.
miss786 10-Feb-14 7:50am View
   
I actually have basic authentication filter but the filter is setup to take static array username and password string values (coded in) and I would like to be able to call username and password from my ER ( entity diagram) but I am not sure how do i got about going so, hence I broken the down the problem, concentrating on how to build the logic. Apology if my approach was not clear. I will try to update my original post. Is their any framework I can use to call data from entity diagram. Many thanks
miss786 7-Feb-14 9:59am View
   
There is not specific error message, i cannot get the above method to produce accurate result and i tried debugging it and application shows null for data parameter in the price_type method, on the following - {System.Data.Entity.DbSet}. Thank you for your response.
miss786 4-Feb-14 12:33pm View
   
Hi, thank you for your response. I manage to get debug my postback method but I can only get droplist to the filter the data by itself. if try to use textbox2 and droplist together the filter the data, the droplist does not work. any solutions?

P.S I have updated my original code
miss786 4-Feb-14 5:34am View
   
Thank you so much for your response. I little unclear of what you mean in your solution. I manage to update my code using your example but I am still unable to get the count to show up in the client-side by calling api/data?name=storm. Many thanks.
miss786 3-Feb-14 11:51am View
   
Thank you, I manage to get to it work using your suggestion.
Many thanks
miss786 3-Feb-14 11:51am View
   
Thank you so much for your help.
miss786 31-Jan-14 11:19am View
   
Thank you so much for your response. I changed the conditions into else if but I am still not getting any results. If you do not mind clarifying, what did you mean by the following statement "change the return data". Many thanks for your help.
miss786 31-Jan-14 6:04am View
   
Thank you very much for your solution and hardwork. Its working as expected.
Many thanks.
miss786 28-Jan-14 8:16am View
   
Thank you for your response. I have updated my code above for further reference. The code is written in API controller class. Many thanks for your help and time.
miss786 28-Jan-14 8:01am View
   
Thank you so much for your response and help. I added the following line code and I am getting the "The name 'Response' does not exist in the current context" error.

public api_login Getapi_login(string id)
{
api_login api_login = db.api_login.Find(id);
if (api_login == null)
{
//throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
Response.Write("<script>alert('Your alert box')</script>");
}

return api_login;
}
miss786 21-Jan-14 9:57am View
   
Dear all, Thank you all so much for your response. I am currently working through my code following your suggestion to get this issue solves. You all have been a great help. Many thanks.
miss786 17-Jan-14 11:21am View
   
Thank you so much for your suggestion and help. I have previously written the same code as above and I had to change it due to, making the url as window pop up. Thank you for javascript tools, I shall have a go debugging it and get back to you.
miss786 17-Jan-14 5:42am View
   
Hi ryan, apology for the late reply,I manage to update my code and I narrow down the problem to sql error. If you get time, could you suggest any solution, if possible. Many thanks.
miss786 17-Jan-14 5:36am View
   
Hello, Thank you so much for your help. I manage to re-write textbox method and have updated little bit.
miss786 16-Jan-14 6:26am View
   
Thank you so much for your help.
miss786 15-Jan-14 12:23pm View
   
Your a Star!! Thank you so much for help and your time in writing a thorough solution. I am very grateful to your help. Many thanks.
miss786 15-Jan-14 12:08pm View
   
Hi, Thank you for your response. I have updated my post with entire code I am currently using. If I am missing a method or something to make this functionality work, please do let me know. Thank you for your time and help.
miss786 15-Jan-14 12:03pm View
   
Hi, Thank you so much for your suggestion. I tired updating my code using your suggestion and now I am experiencing a new error (Cannot implicitly convert type 'void' to 'System.Data.DataTable'). I tried changing the 'DataTable table' function to 'Dataset' but that again gave me bunch of more errors. I have updated my post with additional methods as requested. Any suggestion would be most welcome. Thank you.
miss786 14-Jan-14 9:25am View
   
Thank you for the advice.
miss786 14-Jan-14 7:58am View
   
Many thanks. Just what I need.
miss786 13-Jan-14 11:49am View
   
Thank you for your quick response. Is their a specific name for this functionality or any little example, to get myself started. Many thanks.
miss786 13-Jan-14 6:15am View
   
Thank you! =D
miss786 10-Jan-14 4:54am View
   
Thank you for your response and example. I have updated my original post, with the BasicAuthMessageHandler class and api-login class. I would like to ask, if i could create user verification method in the BasicAuthMessageHandler class. Thank you for your time and help.
miss786 9-Jan-14 11:30am View
   
Hi, Thank you for your suggestion. i am started to implement the sql class but I am also 'basic authenticate' class which authorizes web api feed and was wondering how would i integrate both classes? Thank you
miss786 9-Jan-14 8:25am View
   
I am aware of SqlCommand and SqlConnection classes a little a bit. Are you suggesting, that I create a sql class and reference it the above DummyPrincipalProvider class. Thank you so much or reply.
miss786 9-Jan-14 7:49am View
   
Thank you so much for your reply and pointing out the silly mistake. I got the textbox to filter through your suggestion and updating the query string. Many thanks

if (TextBox1.Text != "")
{

String constr = ConfigurationManager.ConnectionStrings["cdwConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand cmd = new SqlCommand("select [description], [role] from [dbo].[login] where role like '%" + TextBox1.Text + "%'");
cmd.Connection = con;
cmd.Parameters.Add("@role", SqlDbType.VarChar).Value = TextBox1.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
//TextBox1.Text = "";
}
miss786 6-Jan-14 6:35am View
   
Apology for the late response. I get 402 unauthorized error, whenever i try to login using the above code in window explorer, whereas it works fine in firefox. This issue only occurs, when the API application is deployed onto the ftp(live), otherwise in the development mode it works fine on all browsers. I have attached an updated fiddler log of the error. maybe if you get time, you could provide me any small further assistant to what the above fiddler log represent. I really appreciate your help and time. Thanks
miss786 25-Dec-13 6:09am View
   
Thank you for your response. it only works on firefox and in other browsers, it throws a 401 unauthorized error. This issue only occurs once i have deployed the web-api onto the server.
miss786 24-Dec-13 21:59pm View
   
Hi, Thank you so much for your response. I have debugged the code many times and I cannot seem to find any difference in the authorize property between the web browser.
miss786 24-Dec-13 13:22pm View
   
Thank you for your response JoCodes, but it fails authenticate user credentials.
miss786 23-Dec-13 7:29am View
   
Dear bowlturner, I manage to use your framework to solve my gridview pop issue. Thank you for your time and help. Happy Holidays!
miss786 20-Dec-13 12:16pm View
   
Thank you for your help. There seems to be issue with the javascript code and the alert function does not work. I shall try to debug this and get back to you. I really appreciate your help and time
miss786 20-Dec-13 11:49am View
   
I am not getting any error, I cannnot click on the gridview rows to open new window pop-up. thank you for your help.
miss786 20-Dec-13 11:33am View
   
Hi, Thank you for time and suggestion. Sadly, i tired your suggestion and I still can not click on the gridview row.
miss786 20-Dec-13 11:21am View
   
Thank you so much for your response and your suggestion. I am sorry to sound ungrateful but I am unaware of "asp:TemplateField" and I am not sure how to integrate this function into the code behind.
miss786 20-Dec-13 7:43am View
   
Thank you so much for your help and response. Apology for not making the problem clear enough. I was looking for an example, where I can search items in one textbox. I really appreciate your time. Many thanks
miss786 20-Dec-13 7:42am View
   
Thank you for suggestion and example. I really appreciate your help. I shall have a go, implementing my solution using your code as framework. Many thanks for your time and help.
miss786 20-Dec-13 7:41am View
   
Deleted
Thank you for your response. Apology for not making the problem clear enough. I would like to search items in one textbox.