public void OnPrikazi() { using (var db = new BazaZaLiguEntities()) { // List<string> treneriProc = db.SumProcedura(); System.Data.Entity.Core.Objects.ObjectResult <string> tr = db.SumProcedura(); } }
public List <ViewPaymankarReshte> SearchPaymankaranMojaz(string ReshteIds, string Conditions, int IDZirProje) { using (var myen = new AbyariEntities()) { System.Data.Entity.Core.Objects.ObjectResult <ViewPaymankarReshte> res = myen.ListOfPaymankaranMojaz(ReshteIds, Conditions, IDZirProje); if (res != null) { return(res.ToList <ViewPaymankarReshte>()); } return(null); } }
public List <Users> GetAllHouseMatesMapper(System.Data.Entity.Core.Objects.ObjectResult <spGetAllHouseMates_Result> items) { var HouseMates = new List <Users>(); foreach (var i in items) { HouseMates.Add(new Users() { UserID = i.UserID, FirstName = i.FirstName, LastName = i.LastName, Email = i.Email, HouseID = i.HouseID }); } return(HouseMates); }
public ActionResult Create(Sp_GetEmployee_Result obj) { System.Data.Entity.Core.Objects.ObjectResult i = db1.sp_insertEmployeeExample2(obj.EmpName, obj.EmpSalary, obj.EmpDesignation); int r = Convert.ToInt32(i); if (r > 0) { return(RedirectToAction("Index")); } else { return(View()); } }
public ActionResult Delete(string NUM, string T, string F) { int visitadorID = (Int32)Membership.GetUser().ProviderUserKey; try { resultado = db.SP_MWL_EliminarVisitaFarmacia(visitadorID, NUM, T, F); TempData["success"] = "LA VISITA SE HA ELIMINADO SATISFACTORIAMENTE"; } catch (Exception e) { TempData["notice"] = "Error al eliminar visita"; } return(View("Index")); }
public void DisplayDiagrams(CartesianChart Diagr, System.Data.Entity.Core.Objects.ObjectResult FED, string TitleValue, int Val, string Lab) { Diagr.Series.Clear(); Diagr.AxisX.Clear(); Diagr.AxisY.Clear(); if (Diagr.Series.Count >= 1) { } else { using (EDMX.fleerEntitiesDiagrams db = new EDMX.fleerEntitiesDiagrams()) { var data = FED; RowSeries col = new RowSeries() { DataLabels = true, Values = new ChartValues <double>(), LabelPoint = point => point.X.ToString(), Title = TitleValue, Foreground = new SolidColorBrush(Colors.Black) }; Axis ax = new Axis() { Separator = new LiveCharts.Wpf.Separator() { Step = 1, IsEnabled = false }, Foreground = new SolidColorBrush(Colors.Black) }; ax.Labels = new List <string>(); foreach (var x in data) { col.Values.Add(Val); ax.Labels.Add(Lab); } Diagr.Series.Add(col); Diagr.AxisY.Add(ax); Diagr.AxisX.Add(new Axis { LabelFormatter = value => value.ToString(), Separator = new LiveCharts.Wpf.Separator() { Stroke = new SolidColorBrush(Colors.LightGray) }, Foreground = new SolidColorBrush(Colors.Black) }); } } }
public ActionResult Create([Bind(Include = "ID_PSPNR,ID_BUKRS")] ProyectoSociedad proyectoSociedad) { //DET_PROYECTOV u = new DET_PROYECTOV(); //u.ID_PSPNR = proyectoSociedad.ID_PSPNR; //u.ID_BUKRS = proyectoSociedad.ID_BUKRS; //db.DET_PROYECTOV.Add(u); int us = 0; System.Data.Entity.Core.Objects.ObjectResult <int?> r = null; try { r = db.SP_ADD_DET_PROYECTO(proyectoSociedad.ID_BUKRS, proyectoSociedad.ID_PSPNR); db.SaveChanges(); if (r != null) { } else { throw new System.ArgumentException("El registro no fue insertado"); } return(RedirectToAction("Index")); } catch (Exception e) { ViewBag.Error = "El usuario ya existe. Introduzca un ID de usuario diferente. Mensaje: " + e.Message; int pagina = 723; //ID EN BASE DE DATOS FnCommon.ObtenerConfPage(db, pagina, User.Identity.Name, this.ControllerContext.Controller); ProyectoSociedad obj = new ProyectoSociedad(); return(View(obj)); } }
//Custom public DTO.SearchForm GetDataWithFilter(int userId, Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification) { notification = new Notification() { Type = NotificationType.Success }; DTO.SearchForm data = new DTO.SearchForm(); data.Data = new List <MasterExchangeRateSearch>(); totalRows = 0; string validDates = null; string currency = null; try { if (filters.ContainsKey("validDate") && !string.IsNullOrEmpty(filters["validDate"].ToString())) { validDates = filters["validDate"].ToString().Replace("'", "''"); } if (filters.ContainsKey("currency") && !string.IsNullOrEmpty(filters["currency"].ToString())) { currency = filters["currency"].ToString().Replace("'", "''"); } DateTime?validDate = validDates.ConvertStringToDateTime(); using (MasterExchangeRateMngEntities context = CreateContext()) { context.MasterExchangeRateMng_function_GetExchangeRate(DateTime.Now, "USD"); context.MasterExchangeRateMng_function_GetExchangeRate(DateTime.Now, "EUR"); context.MasterExchangeRateMng_function_GetExchangeRate(DateTime.Now, "CNY"); totalRows = context.MasterExchangeRateMng_Function_SearchView(validDate, currency, orderBy, orderDirection).Count(); System.Data.Entity.Core.Objects.ObjectResult <MasterExchangeRateMng_MasterExchangeRate_SearchView> result = context.MasterExchangeRateMng_Function_SearchView(validDate, currency, orderBy, orderDirection); data.Data = converter.DB2DTO_Search(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } return(data); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } return(data); } }
//private DateTime EnsureSchedulableDate(DateTime SelectedDate) //{ // Boolean IsValidDay = false; // while (!IsValidDay) // { // EnumDayOfWeeks d = Common.CustomDateTime.CustomDayOfTheWeek(SelectedDate.DayOfWeek); // if (GetDayThatCurriculumCourseCanBeScheduled().Contains(d)) // { // IsValidDay = true; // } // else // { // SelectedDate.AddDays(1); // } // } // return SelectedDate; //} private void dgvEnrollmentCourseMain_CellContentClick(object sender, DataGridViewCellEventArgs e) { CurriculumCourseEnrollment CurrentSelectedCurriculumCourseEnrollment = (CurriculumCourseEnrollment)curriculumCourseEnrollmentsMainCoursesBindingSource.Current; switch (e.ColumnIndex) { case 0: if (dgvEnrollmentCourseMain.Rows[e.RowIndex].Cells[0].Tag.Equals("EDIT")) { splitContainerUpdateCurriculumCourseDetails.Panel1Collapsed = true; splitContainerUpdateCurriculumCourseDetails.Panel2Collapsed = false; CurriculumCourseEnrollment CCE = (CurriculumCourseEnrollment)curriculumCourseEnrollmentsMainCoursesBindingSource.Current; txtUpdateCurriulumCourseEnrollemntCost.Text = Convert.ToInt32(CCE.CourseCost).ToString(); } else { //If if selected Course does not have a Parent Course then it can be scheduled any time forward from today if (CurrentSelectedCurriculumCourseEnrollment.CurriculumCourse.CurriculumCourseParentID == 0) { //TODO: Open Scheduling Form - Pass Currently Selected CurriculumCourseEnrollment Object. DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); using (frmScheduleCurriculumCourseWizard frm = new frmScheduleCurriculumCourseWizard( InitialStartDate: dt.Date.AddDays(1), CurrentSelectedCurriculumCourseEnrollment: CurrentSelectedCurriculumCourseEnrollment )) { frm.ShowDialog(); } } else { /*Has PreRequisite Course*/ //Step 1 //Determine if all PreRequisite Courses have been Scheduled. if (DetermineIfAllPreRequisiteCourseHaveBeenScheduled( _CurriculumCourseID: CurrentSelectedCurriculumCourseEnrollment.CurriculumCourseID, _EnrollmentID: CurrentSelectedCurriculumCourseEnrollment.EnrollmentID)) { //IF All Course Pre-Requiesties Are Scheduled then: //TODO: Open Scheduling Form - Pass the Selected Curriculum CourseEnrollment Object int PreRequisiteCurriculumCourseID = CurrentSelectedCurriculumCourseEnrollment.CurriculumCourse.CurriculumCourseParentID; Schedule PreRequisiteSchedule = (from a in CurrentEnrollment.CurriculumCourseEnrollments from c in a.Schedules where a.CurriculumCourseID == PreRequisiteCurriculumCourseID select c).FirstOrDefault <Schedule>(); using (var Dbconnection = new MCDEntities()) { DateTime dt = DateTime.Now; //Boolean hhh = Convert.ToBoolean((Dbconnection.DetermineIfTheFirstCousrseToBeScheduled( // curriculumID: CurrentSelectedCurriculumCourseEnrollment.CurriculumCourse.Curriculum.CurriculumID, // enrollmentID: CurrentSelectedCurriculumCourseEnrollment.EnrollmentID, // curriculumCourseID_ToCheck: CurrentSelectedCurriculumCourseEnrollment.CurriculumCourseID).First().Value)); if (!Convert.ToBoolean((Dbconnection.DetermineIfTheFirstCousrseToBeScheduled( curriculumID: CurrentSelectedCurriculumCourseEnrollment.CurriculumCourse.Curriculum.CurriculumID, enrollmentID: CurrentSelectedCurriculumCourseEnrollment.EnrollmentID, curriculumCourseID_ToCheck: CurrentSelectedCurriculumCourseEnrollment.CurriculumCourseID).First().Value))) { System.Data.Entity.Core.Objects.ObjectResult <DateTime?> CC = Dbconnection.GetCurriculumCourseEnrollmentPreRequisiteEndDate( curriculumCourseID: CurrentSelectedCurriculumCourseEnrollment.CurriculumCourseID, enrollmentID: CurrentSelectedCurriculumCourseEnrollment.EnrollmentID); dt = CC.FirstOrDefault <DateTime?>().Value; } if (dt <= DateTime.Now.Date) { dt = DateTime.Now.Date; } using (frmScheduleCurriculumCourseWizard frm = new frmScheduleCurriculumCourseWizard( InitialStartDate: dt.AddDays(1), CurrentSelectedCurriculumCourseEnrollment: CurrentSelectedCurriculumCourseEnrollment )) { frm.lblWziardHeading.Text = CurrentSelectedCurriculumCourseEnrollment.CurriculumCourse.Course.CourseName; frm.ShowDialog(); } }; } } } //this.CurrentEnrollmentPreRequisiteID = CurriculumCourseEnrollmentObj.Enrollment.EnrollmentID; //this.CurrentCurriculumCourseEnrollmentID = CurriculumCourseEnrollmentObj.CurriculumCourseEnrollmentID; this.refreshEnrollment(); this.hideAddCourseForEnrollment(); break; case 1: switch (dgvEnrollmentCourseMain.Rows[e.RowIndex].Cells[1].Tag.ToString()) { case "CompleteReport": //CurrentSelectedCurriculumCourseEnrollment using (frmAddNewApprenticeshipAssessmentReport frm = new frmAddNewApprenticeshipAssessmentReport(CurrentlySelectedCurriculumCourseEnrollment: CurrentSelectedCurriculumCourseEnrollment)) { frm.ShowDialog(); this.refreshEnrollment(); } break; case "ConfirmReservation": using (frmConfirmScheduledCourse frm = new frmConfirmScheduledCourse(CurrentSelectedCurriculumCourseEnrollment.Schedules.FirstOrDefault().ScheduleID, CurrentSelectedCurriculumCourseEnrollment.EnrollmentID)) { frm.ShowDialog(); this.refreshEnrollment(); } break; /* row.Cells[colAddEditCourseReport.Index].Value = "[ Confirm Reservation ]"; * row.Cells[colAddEditCourseReport.Index].Tag = "ConfirmReservation"; */ } // row.Cells[colAddEditCourseReport.Index].Value = "[ Complete Report ]"; // row.Cells[colAddEditCourseReport.Index].Tag = "CompleteReport"; //}else if (CurriculumCourseEnrollmentObj.LookupEnrollmentProgressStateID == (int)Common.Enum.EnumEnrollmentProgressStates.Complete) //{ // row.Cells[colAddEditCourseReport.Index].Value = "[ Update Report ]"; // row.Cells[colAddEditCourseReport.Index].Tag = "UpdateReport"; break; } }
public string GetApplicationVersion() { string strVersion = string.Empty; using (var dataEntities = new InfoTrakDataEntities()) { System.Data.Entity.Core.Objects.ObjectResult <InfoTrakMobileService.DataAccess.Model.spGetMobileAppVersion_Result> r = dataEntities.spGetMobileAppVersion(); //strVersion = r. .value_key; strVersion = r.FirstOrDefault().value_key; } return(strVersion); }
public static List <FavoritesForPage> GetFavoritesByCookies(string uid) { using (var ctx = new RentooloEntities()) { System.Data.Entity.Core.Objects.ObjectResult <spGetFavoritesByCookies_Result> result = ctx.spGetFavoritesByCookies(uid); List <FavoritesForPage> list = new List <FavoritesForPage>(); foreach (var item in result) { list.Add(new FavoritesForPage { Id = item.Id, AdvertId = item.AdvertId, CreatedFavorites = item.CreatedFavorites, Category = item.Category, Name = item.Name, Description = item.Description, CreatedAdverts = item.CreatedAdverts.Value, CreatedUserId = item.CreatedUserId.Value, Price = item.Price.Value, Address = item.Address, Phone = item.Phone, MessageType = item.MessageType.Value, Position = item.PositionString, ImgUrls = item.ImgUrls }); } return(list); } }
/// <summary> /// build the domain objects from custom result sets /// note: the result sets are ordered and they need to be read in the same order /// </summary> /// <param name="resultsR"></param> /// <returns></returns> private static IEnumerable <FeedItem> ReadResults(System.Data.Entity.Core.Objects.ObjectResult <GetEventLogs_Result> resultsR) { // the domain objects to build var feedItems = new SortedDictionary <DateTime, FeedItem>(); #region read and process the criteria-qualified events shared data // the first result set, mainly comes from EventLog table var logs = new List <GetEventLogs_Result>(); logs.AddRange(resultsR); // the second image result is removed since it not used // the third result set includes a distinct list of involved users var usersR = resultsR.GetNextResult <GetOsbideUsers_Result>(); var users = new List <OsbideUser>(); users.AddRange(usersR.Select(u => new OsbideUser { Id = u.Id, FirstName = u.FirstName, LastName = u.LastName, Email = u.Email, DefaultCourse = new Course { Id = u.DefaultCourseId, Prefix = u.DefaultCourseNamePrefix, CourseNumber = u.DefaultCourseNumber }, InstitutionId = u.InstitutionId, SchoolId = u.SchoolId, ReceiveEmailOnNewAskForHelp = u.ReceiveEmailOnNewAskForHelp, ReceiveEmailOnNewFeedPost = u.ReceiveEmailOnNewFeedPost, ReceiveNotificationEmails = u.ReceiveNotificationEmails, LastVsActivity = u.LastVsActivity, })); // the fourth result set includes the distinct list of comments on the criteria-qualified events var commentsR = usersR.GetNextResult <GetLogComments_Result>(); var comments = new List <LogCommentEvent>(); comments.AddRange(commentsR.Select(e => new LogCommentEvent { EventDate = e.EventDate, EventLog = new EventLog { Id = e.EventLogId, LogType = "LogCommentEvent" }, EventLogId = e.EventLogId, Id = e.Id, SolutionName = e.SolutionName, Content = e.Content, SourceEventLogId = e.SourceEventLogId })); // the fifth result set includes the user-event subscriptions var subscriptionsR = commentsR.GetNextResult <GetSubscriptions_Result>(); var subscriptions = new List <EventLogSubscription>(); subscriptions.AddRange(subscriptionsR.Select(s => new EventLogSubscription { LogId = s.LogId, UserId = s.UserId })); #endregion #region read and process the criteria-qualified event details // populate the detailed activity data into osbideEvents var osbideEvents = new List <IOsbideEvent>(); // the sixth result set, AskForHelpEvent var askforhelpR = subscriptionsR.GetNextResult <GetAskForHelpEvents_Result>(); osbideEvents.AddRange(askforhelpR.Select(e => new AskForHelpEvent { EventDate = e.EventDate, EventLog = new EventLog { Id = e.EventLogId, LogType = "AskForHelpEvent" }, EventLogId = e.EventLogId, Id = e.Id, SolutionName = e.SolutionName, UserComment = e.UserComment, Code = e.Code })); // the 7th result set, BuildEvent var buildR = askforhelpR.GetNextResult <GetBuildEvents_Result>(); osbideEvents.AddRange(buildR.GroupBy(e => new { e.EventLogId, e.Id, e.EventDate, e.SolutionName }) .Select(e => new BuildEvent { EventDate = e.Key.EventDate, EventLog = new EventLog { Id = e.Key.EventLogId, LogType = "BuildEvent" }, EventLogId = e.Key.EventLogId, Id = e.Key.Id, SolutionName = e.Key.SolutionName, CriticalErrorNames = e.Select(c => c.CriticalErrorName).ToList() })); // the 8th result set, ExceptionEvent var exceptionR = buildR.GetNextResult <GetExceptionEvents_Result>(); osbideEvents.AddRange(exceptionR.Select(e => new ExceptionEvent { EventDate = e.EventDate, EventLog = new EventLog { Id = e.EventLogId, LogType = "ExceptionEvent" }, EventLogId = e.EventLogId, Id = e.Id, SolutionName = e.SolutionName, ExceptionAction = e.ExceptionAction, DocumentName = e.DocumentName, ExceptionCode = e.ExceptionCode, ExceptionDescription = e.ExceptionDescription, ExceptionName = e.ExceptionName, ExceptionType = e.ExceptionType, LineContent = e.LineContent, LineNumber = e.LineNumber })); // the 9th result set, FeedPostEvent var feedpostR = exceptionR.GetNextResult <GetFeedPostEvents_Result>(); osbideEvents.AddRange(feedpostR.Select(e => new FeedPostEvent { EventDate = e.EventDate, EventLog = new EventLog { Id = e.EventLogId, LogType = "FeedPostEvent" }, EventLogId = e.EventLogId, Id = e.Id, SolutionName = e.SolutionName, Comment = e.Comment })); // the 10th result set, HelpfulMarkGivenEvent var helpfulmarkR = feedpostR.GetNextResult <GetHelpfulMarkGivenEvents_Result>(); //var test = helpfulmarkR.ToList(); osbideEvents.AddRange(helpfulmarkR.Select(e => new HelpfulMarkGivenEvent { EventDate = e.EventDate, EventLog = new EventLog { Id = e.EventLogId, LogType = "HelpfulMarkGivenEvent" }, EventLogId = e.EventLogId, Id = e.Id, SolutionName = e.SolutionName, LogCommentEventId = e.LogCommentEventId })); // the 11th result set, LogCommentEvent var logcommentR = helpfulmarkR.GetNextResult <GetLogCommentEvents_Result>(); osbideEvents.AddRange(logcommentR.Select(e => new LogCommentEvent { EventDate = e.EventDate, EventLog = new EventLog { Id = e.EventLogId, LogType = "LogCommentEvent" }, EventLogId = e.EventLogId, Id = e.Id, SolutionName = e.SolutionName, Content = e.Content, SourceEventLogId = e.SourceEventLogId })); // the 12th result set, SubmitEvent var submitR = logcommentR.GetNextResult <GetSubmitEvents_Result>(); osbideEvents.AddRange(submitR.Select(e => new SubmitEvent { EventDate = e.EventDate, EventLog = new EventLog { Id = e.EventLogId, LogType = "SubmitEvent" }, EventLogId = e.EventLogId, Id = e.Id, SolutionName = e.SolutionName, AssignmentId = e.AssignmentId })); #endregion // build the FeedItem damain objects foreach (var r in logs.Where(l => l.IsResult == true)) { // event comments var eventComments = comments.Where(c => c.SourceEventLogId == r.Id).ToList(); // osbide event of this log var osbideEventO = osbideEvents.First(oe => oe.EventLogId == r.Id); // check if this event is LogCommentEvent or HelpfulMarkGivenEvent var commentO = osbideEventO as LogCommentEvent; var helpfulmarkO = osbideEventO as HelpfulMarkGivenEvent; #region handles LogCommentEvent and HelpfulMarkGivenEvent object comments // LogCommentEvent's comments are consumed through source EventLog's Comments property if (commentO != null) { commentO.SourceEventLog = logs.Where(cs => cs.Id == commentO.SourceEventLogId) .Select(cs => new EventLog { Id = cs.Id, LogType = cs.LogType, SenderId = cs.SenderId, Sender = users.Single(u => u.Id == cs.SenderId), DateReceived = cs.DateReceived, }) .First(); commentO.SourceEventLog.Comments = eventComments; } // HelpfulMarkGivenEvent's comments are consumed through LogCommentEvent's source EventLog's Comments property if (helpfulmarkO != null) { helpfulmarkO.LogCommentEvent = comments.Where(cs => cs.Id == helpfulmarkO.LogCommentEventId) .Select(cs => new LogCommentEvent { Id = cs.Id, EventLogId = cs.EventLogId, SourceEventLogId = cs.SourceEventLogId, Content = cs.Content, EventDate = cs.EventDate, }) .First(); helpfulmarkO.LogCommentEvent.EventLog = logs.Where(cs => cs.Id == helpfulmarkO.LogCommentEvent.EventLogId) .Select(cs => new EventLog { Id = cs.Id, LogType = cs.LogType, SenderId = cs.SenderId, Sender = users.Single(u => u.Id == cs.SenderId), DateReceived = cs.DateReceived, }) .First(); helpfulmarkO.LogCommentEvent.SourceEventLog = logs.Where(cs => cs.Id == helpfulmarkO.LogCommentEvent.SourceEventLogId) .Select(cs => new EventLog { Id = cs.Id, LogType = cs.LogType, SenderId = cs.SenderId, Sender = users.Single(u => u.Id == cs.SenderId), DateReceived = cs.DateReceived, }) .First(); helpfulmarkO.LogCommentEvent.SourceEventLog.Comments = eventComments; } #endregion // instantiate a log object var log = new EventLog { Id = r.Id, LogType = r.LogType, SenderId = r.SenderId, Sender = users.Single(u => u.Id == r.SenderId), DateReceived = r.DateReceived, }; // assign the event comment source foreach (var c in eventComments) { c.SourceEventLog = log; } log.Comments = eventComments; // create a FeedItem instance var feedItem = new FeedItem { LogId = r.Id, Log = log, EventId = osbideEventO.Id, Event = (commentO ?? (helpfulmarkO ?? osbideEventO)), Comments = eventComments, HelpfulComments = eventComments.Count, }; // inherited from original osbide code // in case dup logs having exactly the same time tag while (feedItems.ContainsKey(feedItem.Log.DateReceived)) { feedItem.Log.DateReceived = feedItem.Log.DateReceived.AddMilliseconds(1); } // add the feeditem to the ordered dictionary feedItems.Add(feedItem.Log.DateReceived, feedItem); } return(feedItems.Values.Reverse().ToList()); }
// GET: AuthorPublisherSearch public ActionResult Index(string search, string option) { bookstoreEntities db = new bookstoreEntities(); System.Data.Entity.Core.Objects.ObjectResult <sp_searchauthororpublisher1_Result> rows = db.sp_searchauthororpublisher1(); if (option == "Author") { return(View(rows.Where(m => m.Name_of_Author.Contains(search)).ToList())); } if (option == "Publisher") { return(View(rows.Where(m => m.Name_of_Publisher.Contains(search)).ToList())); } else { return(View(rows.ToList())); } }