I am interested in displaying an input dialog and once the user enters the name of the node in the dialog I would like to create a tree node with the name they entered.
I am creating the edit dialog and then adding the node all in the same function but the behavior that I am seeing is that the tree node appears before the dialog appears or before the user even gets a chance to submit the name for the node, meaning the rest of the code that is included after displaying the dialog doesn't wait for the dialog to return the input.
Is there a way to provide an input dialog and wait for completion before taking another action?
Here is my code - The add() method calls editKey() method and then adds the node.
I expected to be able to wait for the input for each key and build the tag name before the rest of the code in the add function continues but that appears not to be the case:
public void add(){
log.debug("node=<" + node.getValue() + ">");
Node saveNode = node;
if (node.getInfo().isList() ||
node.getInfo().isLeafList()){
try{
TreeHelper treeHelper = (TreeHelper)device.getTreeHelper();
Node n = treeHelper.getSchemaNode(node, node.getTagPath());
if (n != null){
if (node.getInfo().isList()){
log.debug("node<" + node.getName() + " is a list!");
String tagName = "";
if (n.getKeys().size() > 0){
for(String key: n.getKeys()){
node = n.getChildren().get(key);
if (node != null){
editKey(node);
}
if (tagName.equals("")){
tagName += node.getValue();
}else{
tagName += "-" + node.getValue();
}
}
}
n.setTag(tagName);
n.getInfo().setListEntry(true);
n.getNodeTypes().remove("List");
n.getNodeTypes().add("ListEntry");
node = saveNode;
}else if (node.getInfo().isLeafList()){
log.debug("node <" + node.getName() + "> is a leaf list!");
n.getInfo().setLeafListEntry(true);
n.getNodeTypes().remove("LeafList");
n.getNodeTypes().add("LeafListEntry");
}
addTreeNode(this.device,
selectedNode,
n,
true,
true);
}else{
log.debug("schema node is null for node <" + node.getName() + ">");
}
}catch(Exception e){
log.error(IO.stackTrace(e));
}
selectedNode.setExpanded(true);
}
RequestContext.getCurrentInstance().update("treeForm:treeSingle");
}
Here is the editKey() function:
public void editKey(Node node) throws Exception{
FacesContext ctx = FacesContext.getCurrentInstance();
UIViewRoot rootView = ctx.getViewRoot();
Dialog dialog = (Dialog)rootView.findComponent("editDialog");
dialog.setVisible(true);
dialog.setModal(true);
dialog.getChildren().clear();
UIForm form = new UIForm();
form.getChildren().clear();
PanelGrid panel = new PanelGrid();
panel.setColumns(2);
OutputLabel label = new OutputLabel();
label.setValue(node.getName());
label.setFor("valueId");
panel.getChildren().add(label);
if (node.getDataTypes().contains("BOOL") ||
(node.getValue() != null &&
(node.getValue().equals("false") || node.getValue().equals("true")))){
SelectOneMenu menu = new SelectOneMenu();
ValueExpression valueExpression = createValueExpression("#{treeBean.node.value}");
menu.setValueExpression("value", valueExpression);
menu.setId("valueId");
menu.setLabel(node.getName());
if (node.getValue() != null &&
node.getValue().equals("false")){
UISelectItem item = new UISelectItem();
item.setItemLabel("false");
item.setItemValue("false");
menu.getChildren().add(item);
item = new UISelectItem();
item.setItemLabel("true");
item.setItemValue("true");
menu.getChildren().add(item);
}else{
UISelectItem item = new UISelectItem();
item.setItemLabel("true");
item.setItemValue("true");
menu.getChildren().add(item);
item = new UISelectItem();
item.setItemLabel("false");
item.setItemValue("false");
menu.getChildren().add(item);
}
panel.getChildren().add(menu);
}else if (node.getEnums().size() > 0){
SelectOneMenu menu = new SelectOneMenu();
ValueExpression valueExpression = createValueExpression("#{treeBean.node.value}");
menu.setValueExpression("value", valueExpression);
menu.setId("valueId");
menu.setLabel(node.getName());
for(String s : node.getEnums()){
int index = s.indexOf(":");
if (index != -1){
s = s.substring(0, index);
}
UISelectItem item = new UISelectItem();
item.setItemLabel(s);
item.setItemValue(s);
menu.getChildren().add(item);
}
panel.getChildren().add(menu);
}else{
InputText inputText = new InputText();
ValueExpression valueExpression = createValueExpression("#{treeBean.node.value}");
inputText.setValueExpression("value", valueExpression);
inputText.setId("valueId");
inputText.setLabel(node.getName());
inputText.setType("text");
panel.getChildren().add(inputText);
}
UIOutput output = new UIOutput();
output.setValue("Data types: ");
panel.getChildren().add(output);
output = new UIOutput();
output.setValue(node.getDataTypes().toString().replace("]", "").replace("[", ""));
panel.getChildren().add(output);
output = new UIOutput();
output.setValue("Min. occurs: ");
panel.getChildren().add(output);
output = new UIOutput();
output.setValue(node.getMinOccurs()+"");
panel.getChildren().add(output);
output = new UIOutput();
output.setValue("Max. occurs: ");
panel.getChildren().add(output);
output = new UIOutput();
output.setValue(node.getMaxOccurs()+"");
panel.getChildren().add(output);
form.getChildren().add(panel);
CommandButton button = new CommandButton();
button.setOnclick("$('#progress').show();$('#editDialog').hide();");
button.setOncomplete("$('#progress').hide();$('#editDialog').hide();");
button.setValue("submit");
MethodExpression me = createMethodExpression("#{treeBean.save}");
button.setActionExpression(me);
form.getChildren().add(button);
dialog.getChildren().add(form);
RequestContext.getCurrentInstance().update("editDialog");
RequestContext.getCurrentInstance().execute("editWidget.show()");
}
Related
I have a map with a single pin on it. as follows:
var map = new Map()
{
IsShowingUser = true,
HeightRequest = 100,
WidthRequest = 960,
VerticalOptions = LayoutOptions.FillAndExpand
};
and the pin location and label as follows:
var pin1 = new Pin();
pin1.Type = PinType.Place;
pin1.Position = position;
pin1.Label = "Ticket Number: " + Cache.Instance.Ticket.TicketNumber;
clicked event:
pin1.Clicked += delegate
{
uri = new Uri("http://maps.google.com/maps?daddr=" + position.Latitude + "," + position.Longitude);
Device.OpenUri(uri);
}
map loading:
var stack = new StackLayout { Spacing = 00 };
stack.Children.Add(map);
Content = stack;
when clicking on the pin marker, it opens an info window and clicking on the window and clicked event code triggers. It there any way to not show the info window and the event triggers as soon as I click on the marker?
Thanks
Use Map_PinClicked to handle the PinClick event, If you set e.Handled = true, then Pin selection doesn't work automatically. All pin selection operations are delegated to you.
In the Page:
map.PinClicked += Map_PinClicked;
// Selected Pin changed
map.SelectedPinChanged += SelectedPin_Changed;
map.InfoWindowClicked += InfoWindow_Clicked;
map.InfoWindowLongClicked += InfoWindow_LongClicked;
And then clickEvent:
void Map_PinClicked(object sender, PinClickedEventArgs e)
{
e.Handled = true;
uri = new Uri("http://maps.google.com/maps?daddr=" + position.Latitude + "," + position.Longitude);
Device.OpenUri(uri);
}
You can have a look at here for more information.
Currently with Xamarin.Forms 5, PinClicked event is designated as obsolete. Same goes for Device.OpenUri.
One can use pin1.MarkerClicked += Pin_Clicked; instead.
You can prevent the Info window from opening by setting the EventArgs's HideInfoWindow property to true.
docs.microsoft
private async void Pin_Clicked(object sender, PinClickedEventArgs e)
{
try
{
e.HideInfoWindow = true;
var pin = sender as Pin;
var uri = new Uri("http://maps.google.com/maps?daddr=" + pin.Position.Latitude + "," + pin.Position.Longitude);
Launcher.OpenAsync(uri);
}
catch (Exception ex)
{
//log error
}
}
I have built an SSIS package which reads CSV from certain folder. But now I need to download same csv from exchange server.Also Outlook is not installed on my machine. Will I be able to download CSV from exchange server and how ? Thanks!
I have used some of the code from the link http://sqlandbilearning.blogspot.com.au/2014/07/download-email-attachment-using-ssis.html but i have added some new code for removing TCP binding error using ServicePointManager as well as added search filter for retrieving specific emails and this code also takes care of multiple attachment from different emails to be saved on file system.
public void Main()
{
string filePath = "";
string fileName = "";
List<SearchFilter> searchFilterCollection = new List<SearchFilter>();
DateTime now = DateTime.Now;
DateTime beginRecievedTime = new DateTime(now.Year, now.Month, now.Day, 7, 55, 0);
DateTime finishRecievedTime = new DateTime(now.Year, now.Month, now.Day, 8, 15, 0);
EmailMessage latestEmail = null;
try
{
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
service.UseDefaultCredentials = true;
//service.Credentials = new WebCredentials("username", "password");
service.Url = new Uri("");
// 10 mails per page in DESC order
ItemView view = new ItemView(10);
view.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);
searchFilterCollection.Add(new SearchFilter.ContainsSubstring(ItemSchema.Subject, "Scheduled search"));
SearchFilter greaterthanfilter = new SearchFilter.IsGreaterThanOrEqualTo(ItemSchema.DateTimeReceived, beginRecievedTime);
searchFilterCollection.Add(greaterthanfilter);
SearchFilter lessthanfilter = new SearchFilter.IsLessThan(ItemSchema.DateTimeReceived, finishRecievedTime);
searchFilterCollection.Add(lessthanfilter);
SearchFilter filter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, searchFilterCollection);
//Find mails
FindItemsResults<Item> fir = service.FindItems(WellKnownFolderName.Inbox, filter, view);
Dictionary<EmailMessage, string> emailsMap = new Dictionary<EmailMessage, string>();
foreach (Item item in fir.Items)
{
item.Load(); //Load the entire message with attachment
EmailMessage email = item as EmailMessage;
if (email != null)
{
if (email.HasAttachments == true && email.Attachments.Count == 1)
{
if (email.Subject.StartsWith("Scheduled search") == true)
{
filePath = Path.Combine(Dts.Variables["User::SourceFolderPath"].Value.ToString()
, email.DateTimeReceived.Date.ToString("MM.dd.yyyy") + "_" +
email.Attachments[0].Name);
// fileName = email.DateTimeReceived.Date.ToString("MM.dd.yyyy") + "_" +
// email.Attachments[0].Name.ToString();
emailsMap.Add(email, filePath);
}
}
}
}
if (emailsMap.Count > 0) {
foreach (var item in emailsMap) {
//Save attachment
EmailMessage email = item.Key;
filePath = item.Value;
FileAttachment fileAttachment = email.Attachments[0] as FileAttachment;
fileAttachment.Load(filePath);
string extractPath = Dts.Variables["User::SourceFolderPath"].Value.ToString() + "\\" + email.Attachments[0].Name;
System.IO.Compression.ZipFile.ExtractToDirectory(filePath, extractPath);
fileName = Dts.Variables["User::SourceFolderPath"].Value.ToString() + "\\" + email.DateTimeReceived.Date.ToString("MM.dd.yyyy") + "_" +
email.Attachments[0].Name.ToString();
if (File.Exists(fileName))
{
File.Delete(fileName);
}
}
}
// Dts.Variables["User::SourceFileName"].Value = fileName;
Dts.TaskResult = (int)ScriptResults.Success;
}
catch(System.Runtime.InteropServices.COMException ex)
{
if (Dts.Variables.Locked == true)
{
Dts.Variables.Unlock();
}
//An error occurred.
Dts.Events.FireError(0, "Error occured", ex.Message, String.Empty, 0);
Dts.TaskResult = (int)ScriptResults.Failure;
}
}
I'm trying to generate checkboxlist dynamically using this code:
string IDToEdit = Request.QueryString["id"].ToString();
List<DAL.EF.Dental_Price_Lists> lstOfCategDental = BAL.Helpers.Prices.GetDentalCategories();
string HTMLTag = "";
string HTMLTag2 = "";
int count = 1;
foreach (var x in lstOfCategDental)
{
HTMLTag += string.Format("<a href='#tab{0}'>{1}</a>", count, x.Category);
List<DAL.EF.Dental_Price_Lists> priceList = BAL.Helpers.Prices.GetDentalPrices(x.Category);
HTMLTag2 += string.Format("<div id='tab{0}' class='tab'>", count);
HTMLTag2 += string.Format(" <asp:CheckBoxList ID='chkListDental{0}' runat='server'>", count);
foreach (var price in priceList)
{
HTMLTag2 += string.Format(" <asp:ListItem Value='{0}' price='{1}' Text='{2}'></asp:ListItem>", price.ID.ToString(), price.Price.ToString(), price.Type);
}
HTMLTag2 += " </asp:CheckBoxList>";
HTMLTag2 += " </div>";
count++;
}
ltrCategories.Text = HTMLTag;
ltrChkListDental.Text = HTMLTag2;
}
but it didn't work correctly "explained in the below image", i think thats because the ASP.NET tag instead of the HTML tag but i'm not sure of that ... so, can you help me solve this issue?
As you see in the following image the asp.net tags didn't converted to html tags?
http://i.stack.imgur.com/ufSq3.png
You can not do it. But you can instantiate a new control and then append it the the page controls property:
foreach (var x in lstOfCategDental) {
List<DAL.EF.Dental_Price_Lists> priceList = BAL.Helpers.Prices.GetDentalPrices(x.Category);
var checkboxList = new CheckBoxList();
checkboxList.ID = string.Format("chkListDental{0}", count);
foreach (var price in priceList) {
var listItem = new ListItem(price.Type);
listItem.Value = price.ID.ToString();
checkboxList.Attributes.Add("price", price.Price.ToString());
checkboxList.Items.Add(listItem);
}
count++;
Page.Controls.Add(checkboxList);
}
or use the RenderControl method of the control for each of the controls, but it is not recommended.
StringBuilder sb = new StringBuilder();
StringWriter stWriter = new StringWriter(sb);
HtmlTextWriter htmlWriter = new HtmlTextWriter(stWriter);
ControlToRender.RenderControl(htmlWriter);
.
.
.
foreach (var x in lstOfCategDental) {
List<DAL.EF.Dental_Price_Lists> priceList = BAL.Helpers.Prices.GetDentalPrices(x.Category);
var checkboxList = new CheckBoxList();
checkboxList.ID = string.Format("chkListDental{0}", count);
foreach (var price in priceList) {
var listItem = new ListItem(price.Type);
listItem.Value = price.ID.ToString();
checkboxList.Attributes.Add("price", price.Price.ToString());
checkboxList.Items.Add(listItem);
}
count++;
checkboxList.RenderControl(htmlWriter);
}
ltrChkListDental.Text = sb.ToString();
I solved it by creating the div dynamically too then add the checkboxlist to that div.
string IDToEdit = Request.QueryString["id"].ToString();
List<DAL.EF.Dental_Price_Lists> lstOfCategDental = BAL.Helpers.Prices.GetDentalCategories();
string HTMLTag = "";
int count = 1;
foreach (var x in lstOfCategDental)
{
var checkboxList = new CheckBoxList();
List<DAL.EF.Dental_Price_Lists> priceList = BAL.Helpers.Prices.GetDentalPrices(x.Category);
HTMLTag += string.Format("<a href='#tab{0}'>{1}</a>", count, x.Category);
checkboxList.ID = string.Format("chkListDental{0}", count);
HtmlGenericControl divControl = new HtmlGenericControl("div");
// Set the properties of the new HtmlGenericControl control.
divControl.ID = "tab" + count;
divControl.Attributes.Add("class", "tab");
// Add the new HtmlGenericControl to the Controls collection of the
// PlaceHolder control.
divPlaceHolder.Controls.Add(divControl);
foreach (var price in priceList)
{
var listItem = new ListItem(price.Type);
listItem.Value = price.ID.ToString();
checkboxList.Attributes.Add("price", price.Price.ToString());
checkboxList.Items.Add(listItem);
}
count++;
divControl.Controls.Add(checkboxList);
}
ltrCategories.Text = HTMLTag;
I have web application in asp.net 3.5. I just want to add record to 3 tables and one table contains multiple file details that I associated with table primary key value.
For more info I include this code:
protected void submit_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
using (DataClassesDataContext db = new DataClassesDataContext())
{
int user_id = 0;
var query = from u in db.Users
where u.Username == (String)Session["Username"]
select new
{
Id = u.Id
};
foreach (var item in query)
{
if (item != null)
{
user_id = int.Parse(item.Id.ToString());
break;
}
}
Post myPost = new Post();
myPost.Title = txt_ComName.Text.Trim();
myPost.Category_id = int.Parse(DDL_Categorynames.SelectedItem
.Value.ToString());
myPost.Description = txt_ComName1.Text.Trim();
myPost.User_id = user_id;
myPost.ToUser_id = user_id;
if(file_upload.HasFile)
{
myPost.IsFileAttached = true;
}
else
{
myPost.IsFileAttached = false;
}
db.Posts.InsertOnSubmit(myPost);
db.SubmitChanges();
int newId = myPost.Id;
Flag myFlag = new Flag();
myFlag.IsRead = false;
myFlag.IsImportant = false;
myFlag.IsRemoved = false;
myFlag.User_id = user_id;
myFlag.Post_History_id = newId;
db.Flags.InsertOnSubmit(myFlag);
db.SubmitChanges();
File myFile = new File();
HttpFileCollection fileCollection = Request.Files;
for (int i = 0; i < fileCollection.Count; i++)
{
HttpPostedFile uploadfile = fileCollection[i];
string fileName = Path.GetFileName(uploadfile.FileName);
string fileType = System.IO.Path.GetExtension(fileName)
.ToString().ToLower();
myFile.Post_History_id = newId;
myFile.File_name = fileName;
myFile.File_ext = fileType;
myFile.File_Size = uploadfile.ContentLength.ToString();
if (uploadfile.ContentLength > 0)
{
uploadfile.SaveAs(Server.MapPath("~/PostFiles/")
+ fileName);
db.Files.InsertOnSubmit(myFile);
db.SubmitChanges();
}
}
Panel_AddNew.Visible = false;
Panel_ViewPostList.Visible = true;
this.FillGrid();
}
}
}
However, with this scenario first file that was selected that was inserted and after that second file iterated then error occurred like:
Cannot add an entity that already exists.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Cannot add an entity that already exists.
Source Error:
Line 248: {
Line 249: uploadfile.SaveAs(Server.MapPath("~/PostFiles/") + FileName);
Line 250: db.Files.InsertOnSubmit(myFile);
Line 251: db.SubmitChanges();
Line 252: }
Source File: f:\EasyWeb\EndUser\Post_History.aspx.cs Line: 250
please help me...
Create a new File in each iteration of the foreach loop:
for (int i = 0; i < fileCollection.Count; i++)
{
File myFile = new File();
HttpPostedFile uploadfile = fileCollection[i];
...
I am new to application block.
I am trying to get data from database. Following is the code snap.
JsonResponse.ashx:
public void ProcessRequest(HttpContext context)
{
HttpContext _context = HttpContext.Current;
context.Response.ContentType = "application/json";
int user_id = Convert.ToInt32(HttpContext.Current.Session["userid"]);
DateTime start = new DateTime(1970, 1, 1);
DateTime end = new DateTime(1970, 1, 1);
start = start.AddSeconds(double.Parse(context.Request.QueryString["start"]));
end = end.AddSeconds(double.Parse(context.Request.QueryString["end"]));
String result = String.Empty;
result += "[";
List<int> idList = new List<int>();
foreach (CalendarEvent cevent in EventDAO.getEvents(start, end, user_id))
{
result += convertCalendarEventIntoString(cevent);
idList.Add(cevent.id);
}
if (result.EndsWith(","))
{
result = result.Substring(0, result.Length - 1);
}
result += "]";
//store list of event ids in Session, so that it can be accessed in web methods
context.Session["idList"] = idList;
context.Response.Write(result);
}
private String convertCalendarEventIntoString(CalendarEvent cevent)
{
String allDay = "true";
if (ConvertToTimestamp(cevent.start).ToString().Equals(ConvertToTimestamp(cevent.end).ToString()))
{
if (cevent.start.Hour == 0 && cevent.start.Minute == 0 && cevent.start.Second == 0)
{
allDay = "true";
}
else
{
allDay = "false";
}
}
else
{
if (cevent.start.Hour == 0 && cevent.start.Minute == 0 && cevent.start.Second == 0
&& cevent.end.Hour == 0 && cevent.end.Minute == 0 && cevent.end.Second == 0)
{
allDay = "true";
}
else
{
allDay = "false";
}
}
return "{" +
"id: '" + cevent.id + "'," +
"title: '" + HttpContext.Current.Server.HtmlEncode(cevent.title) + "'," +
"start: " + ConvertToTimestamp(cevent.start).ToString() + "," +
"end: " + ConvertToTimestamp(cevent.end).ToString() + "," +
"allDay:" + allDay + "," +
"user_id:" + cevent.user_id + "," +
"description: '" + HttpContext.Current.Server.HtmlEncode(cevent.description) + "'" +
"},";
}
DA:
public static List<CalendarEvent> getEvents(DateTime start, DateTime end, int user_id)
{
List<CalendarEvent> events = new List<CalendarEvent>();
SqlParameter[] sqlParam = new SqlParameter[3];
sqlParam[0] = new SqlParameter("#start", start);
sqlParam[1] = new SqlParameter("#end", end);
sqlParam[2] = new SqlParameter("#user_id", user_id);
return SqlHelper.ExecuteDataset(connectionString,CommandType.StoredProcedure, "GetData", sqlParam);
}
sqlhelper:
public static DataSet ExecuteDataset(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
{
//create a command and prepare it for execution
SqlCommand cmd = new SqlCommand();
cmd.CommandTimeout = 120;
PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters);
//create the DataAdapter & DataSet
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
//fill the DataSet using default values for DataTable names, etc.
da.Fill(ds);
// detach the SqlParameters from the command object, so they can be used again.
cmd.Parameters.Clear();
//return the dataset
return ds;
}
I am getting error:
Cannot implicitly convert type 'System.Data.DataSet' to 'System.Collections.Generic.List'.
I am unable to understand what is the problem.
In getEvents method, you need to iterate through the records in the dataset and fill in the list that you would return in this method.
var dataset = SqlHelper.ExecuteDataset(connectionString,CommandType.StoredProcedure, "GetData", sqlParam);
foreach (var row in ds.Tables["FooTable"].Rows)
{
events.Add(new CalendarEvent(...));
}
return events;
That's because you try to return a dataset as List, which it isn't.
You need to convert the dataset to a list. A possible solution would be to change the getEvents method to something like this ->
public static List<CalendarEvent> getEvents(DateTime start, DateTime end, int user_id)
{
List<CalendarEvent> events = new List<CalendarEvent>();
SqlParameter[] sqlParam = new SqlParameter[3];
sqlParam[0] = new SqlParameter("#start", start);
sqlParam[1] = new SqlParameter("#end", end);
sqlParam[2] = new SqlParameter("#user_id", user_id);
var ds = SqlHelper.ExecuteDataset(connectionString,CommandType.StoredProcedure, "GetData", sqlParam);
return ds.Tables[0].AsEnumerable().Select(datarow => new CalendarEvent{ Title = datarow.Field<string>("Title), /*the rest of your params*/}).ToList();
}
Your problem is this piece of code:
public static List<CalendarEvent> getEvents(DateTime start, DateTime end, int user_id)
{
List<CalendarEvent> events = new List<CalendarEvent>();
SqlParameter[] sqlParam = new SqlParameter[3];
sqlParam[0] = new SqlParameter("#start", start);
sqlParam[1] = new SqlParameter("#end", end);
sqlParam[2] = new SqlParameter("#user_id", user_id);
return SqlHelper.ExecuteDataset(connectionString,CommandType.StoredProcedure, "GetData", sqlParam);
}
You defined the type of this method as List<CalenderEvent> but you return a DataSet.
I do not know which datatables are contained in your dataset, but I assume there is one which represents your calenderevents.
This means you need to extract the data you want from your dataset and make a list out of it. Assuming there is one table in your dataset your new method would look something like this:
public static List<CalendarEvent> getEvents(DateTime start, DateTime end, int user_id)
{
List<CalendarEvent> events = new List<CalendarEvent>();
SqlParameter[] sqlParam = new SqlParameter[3];
sqlParam[0] = new SqlParameter("#start", start);
sqlParam[1] = new SqlParameter("#end", end);
sqlParam[2] = new SqlParameter("#user_id", user_id);
var data = SqlHelper.ExecuteDataset(connectionString,CommandType.StoredProcedure, "GetData", sqlParam);
events = ds.Tables[0].AsEnumerable().Select(r => new CalenderEvent
{
//using dummy properties because I dont know
//your class
Property1 = r.Field<string>("Column1"),
Property2 = r.Field<string>("column2"),
//...
}).ToList();
return events;
}