Exemplo n.º 1
0
 // Introduce some middleware to inject the id into the response headers for debugging purposes
 app.Use(async(context, next) =>
 {
     context.Response.OnStarting(() =>
     {
         context.Response.Headers["X-Response-Azure-FDID"] = getAFDID(context);
         return(Task.FromResult(0));
     });
        public ActionResult ShowClientsCards(string id = "SelectAll")
        {
            context       data = new context();
            List <Client> list;
            bool          isInt = true;

            foreach (var item in id)
            {
                if (item < '0' && item > '9')
                {
                    isInt = false;
                }
            }
            if (id.Length == 14 && isInt)
            {
                long nationalid = long.Parse(id);
                list = data.Clients.Where(c => c.ssn == nationalid).ToList();
            }
            else if (id == "SelectAll")
            {
                list = data.Clients.ToList();
            }
            else
            {
                list = data.Clients.Where(c => (c.FirstName.Contains(id) || c.LastName.Contains(id))).ToList();
            }

            return(View(list));
        }
Exemplo n.º 3
0
        public ActionResult ShowPackageCards(string id = "")
        {
            context        data = new context();
            List <Package> list;

            int idint = -1;

            try {
                idint = int.Parse(id);
            }
            catch (Exception e) {
                idint = -1;
            }

            if (id == "")
            {
                list = data.Packages.ToList();
            }
            else if (idint != -1)
            {
                list = data.Packages.Where(pack => pack.ID == idint).ToList();
            }
            else
            {
                Brand brand = (Brand)Enum.Parse(typeof(Brand), id);
                list = data.Packages.Where(pack => pack.Title == id).ToList();
            }
            return(View(list));
        }
Exemplo n.º 4
0
 public ActionResult PostMachineEvent(MachineEvent machineEvent)
 {
     try
     {
         if (ModelState.IsValid)
         {
             try
             {
                 context db = new context();
                 db.machineEvents.Add(machineEvent);
                 db.SaveChanges();
                 return(Json(1));
             }
             catch (Exception ex)
             {
                 return(Json(ex.ToString()));
             }
         }
         else
         {
             return(Json(0));
         }
     }
     catch (Exception ex)
     {
         return(Json(ex.ToString()));
     }
 }
Exemplo n.º 5
0
        public ActionResult CourseTeacher(int id)
        {
            List <Teacher> AllTeachers   = new List <Teacher>();
            Teacher        courseTeacher = new Teacher();

            using (var context = new context())
            {
                // var courseTeacher = context.Teachers.SqlQuery("SELECT * FROM Teachers JOIN Courses ON Teachers.TeachingInCourse.CourseId=Courses.CourseId WHERE CourseId=@id", new SqlParameter("@id", id));
                foreach (var teacher in context.Teachers.Include("TeachingInCourses"))
                {
                    AllTeachers.Add(teacher);
                }
            }
            foreach (var teacher in AllTeachers)
            {
                foreach (var course in teacher.TeachingInCourses)
                {
                    if (course.CourseId == id)
                    {
                        courseTeacher.Firstname = teacher.Firstname;
                        courseTeacher.Lastname  = teacher.Lastname;
                    }
                }
            }
            return(PartialView("_CourseTeacher", courseTeacher));
        }
Exemplo n.º 6
0
        public ActionResult ShowCarsCards(string id = "")
        {
            context    data = new context();
            List <Car> list;

            int idint = -1;

            try {
                idint = int.Parse(id);
            }
            catch (Exception e) {
                idint = -1;
            }

            if (id == "")
            {
                list = data.Cars.ToList();
            }
            else if (idint != -1)
            {
                list = data.Cars.Where(car => car.ID == idint).ToList();
            }
            else
            {
                Brand brand = (Brand)Enum.Parse(typeof(Brand), id);
                list = data.Cars.Where(car => car.Brand == brand).ToList();
            }
            return(View(list));
        }
Exemplo n.º 7
0
        public IActionResult Index()
        {
            var context            = new context();
            HealthCheckOrder order = context.Order.First();

            return(View(order));
        }
Exemplo n.º 8
0
        public static void Main()
        {
            var html_context = new context();

            html_context.load_master_stylesheet(master_css);
            //var win = new browser_window(html_context);
        }
Exemplo n.º 9
0
 void NotifyProgress(context coContext, float progress)
 {
     if (coContext.m_OnProgress != null)
     {
         coContext.m_OnProgress(progress);
     }
 }
Exemplo n.º 10
0
        public mainmenu(Game Game, context c)
        {
            game    = Game;
            middle  = 768 / 2;
            visible = true;
            this.c  = c;

            if (manager != null)
            {
                manager = new gameManager(game);
            }

            switch (c)
            {
            case context.menu:
                b1Text = "play";
                b2Text = "settings";
                b3Text = "music";
                break;

            case context.game:
                b1Text = "resume";
                b2Text = "back";
                b3Text = "retry";
                break;
            }

            leaveConfirmation = new NB_dialoguebox(game);
        }
Exemplo n.º 11
0
        public ActionResult StudentListAssignment(int id)
        {
            Student           studentToShow      = new Student();
            List <Assignment> studentsAssignment = new List <Assignment>();

            using (var context = new context())
            {
                studentToShow = context.Students.SingleOrDefault(s => s.StudentId == id);
                //foreach (var assignment in context.Assignments)
                //{
                //    studentsAssignment.Add(assignment);
                //}
            }
            //for (int i = studentToShow.StudentAssignments.Count(); i >=0; i--)
            //{
            //    studentToShow.StudentAssignments.Remove(studentsAssignment[i]);

            //}
            //foreach (var assignment in studentsAssignment)
            //{
            //    if (assignment.IsTemplateAssignment == false)
            //    {
            //        if (assignment.StudentId == studentToShow.StudentId)
            //        {
            //            studentToShow.StudentAssignments.Add(assignment);
            //        }
            //    }
            //}
            return(PartialView("_StudentListAssignment", studentToShow));
        }
Exemplo n.º 12
0
        public ActionResult AddPackage(int car1_id, int car2_id, int car3_id, Package package)
        {
            context data = new context();
            Car     c1   = data.Cars.FirstOrDefault(m => m.ID == car1_id);
            Car     c2   = data.Cars.FirstOrDefault(m => m.ID == car2_id);
            Car     c3   = data.Cars.FirstOrDefault(m => m.ID == car3_id);

            c1.period = 0;
            c2.period = 0;
            c3.period = 0;

            if (package.Cars == null)
            {
                package.Cars = new List <Car>();
            }

            package.RentDate = DateTime.Today;
            package.Cars.Add(c1);
            package.Cars.Add(c2);
            package.Cars.Add(c3);

            data.Packages.Add(package);
            data.SaveChanges();

            return(RedirectToAction("ShowPackageCards"));
        }
Exemplo n.º 13
0
    void OnGUI()
    {
        if (isCameraFocused())
        {
            // Display home stats/Tenant on focus
            Vector3 b      = focusedHome.GetComponent <Renderer>().bounds.max;
            Vector3 offset = c.GetComponent <Camera>().WorldToScreenPoint(b);
            //Debug.Log(offset);

            GUILayout.BeginArea(new Rect(offset.x + 100, Screen.height / 2 - 50, 200, 100));
            Tenant t = focusedHome.GetComponent <Tenant>();
            GUILayout.Button("Name: " + t.TenantName());
            GUILayout.Button("Rent: " + t.cash());
            if (GUILayout.Button("Exit"))
            {
                unfocus();
                currentContext = context.select;
            }
            GUILayout.EndArea();
        }
        else
        {
            // Controls at bottom of main screen
            GUILayout.BeginArea(new Rect(Screen.width / 2 - 150, Screen.height - 50, 300, 100));
            GUILayout.Button("Build : B, Destroy: D, Select: S");
            GUILayout.EndArea();
        }
    }
Exemplo n.º 14
0
 public ActionResult StudentListCourses(int id)
 {
     using (var context = new context())
     {
         Student studentToShow = context.Students.Include("StudentCourses").SingleOrDefault(s => s.StudentId == id);
         return(PartialView("_StudentListCourses", studentToShow));
     };
 }
Exemplo n.º 15
0
 public ActionResult CourseDetails(int id)
 {
     using (var context = new context())
     {
         var presentCourseDetails = context.Courses.Include("CourseStudents").Include("CourseAssignments").SingleOrDefault(c => c.CourseId == id);
         return(PartialView("_CourseDetails", presentCourseDetails));
     }
 }
Exemplo n.º 16
0
 public BrowserForm(context ctx)
 {
     InitializeComponent();
     _widthAdjust  = Width - _html.Width;
     _heightAdjust = Height - _html.Height;
     SetSize(840, 640);
     _html.Set(ctx);
 }
Exemplo n.º 17
0
        public void setTimer(int h, int m, int s)
        {
            var now = DateTime.Now;

            endTime    = now.AddHours(h).AddMinutes(m).AddSeconds(s);
            nowContext = context.TIMER;
            isTimer    = true;
        }
Exemplo n.º 18
0
        public static void toTsxDir(string srcDir, string destDir, bool isInstr)
        {
            var files      = Directory.EnumerateFiles(srcDir, "*.xml", SearchOption.AllDirectories).Select(f => f.ToLower()).Where(f => !f.EndsWith(@"\meta.xml")).ToArray();
            var allLocData = initLocXml();
            var errors     = new List <string>();

            foreach (var fn in files)
            {
                if (fn.IndexOf("novyeslova") >= 0) //missing localization of used words
                {
                    continue;
                }
                var relPath      = fn.Substring(srcDir.Length);
                var destPath     = destDir + relPath.Replace(".xml", ".tsx");
                var destLocPath  = destDir + relPath.Replace(".xml", ".loc.ts");
                var destMetaPath = destDir + relPath.Replace(".xml", ".meta.ts");
                try {
                    //if (destPath != @"d:\rw\data\lm\oldea\english2\grammar\sec03\g02.tsx") continue;
                    var root = XElement.Load(fn);

                    var ctx = new context {
                        isInstr = isInstr, name = Path.GetFileNameWithoutExtension(fn)
                    };

                    //page TSX
                    var toLoc = new Dictionary <string, string>();
                    //string titleLocKey;
                    var s = genPageTSX(root, ctx, toLoc); //, out url, out titleLocKey);
                    lib.AdjustFileDir(destPath); File.WriteAllText(destPath, s);

                    //loc TS
                    if (isInstr)
                    {
                        ctx.url = "/instrs";
                    }
                    if (ctx.needsLoc)
                    {
                        var url     = ctx.url.Substring(1).Replace('/', '-');
                        var locData = allLocData.ContainsKey(url) ? allLocData[url] : null;
                        s = genLocTS(toLoc, locData, ctx.isInstr ? null : allLocData["sitemap"]);
                        File.WriteAllText(destLocPath, s);
                    }
                    if (ctx.needsMeta)
                    {
                        s = genMetaTS(ctx);
                        File.WriteAllText(destMetaPath, s);
                    }
                } catch (Exception exp) {
                    //File.WriteAllText(destPath, exp.Message);
                    errors.Add(destPath + " " + exp.Message);
                }
            }
            //File.WriteAllLines(@"d:\temp\images.txt", images.OrderBy(s => s));
            if (errors.Count > 0)
            {
                throw new Exception(errors.Aggregate((r, i) => r + "\r\n" + i));
            }
        }
Exemplo n.º 19
0
 public BrowserForm(context ctx)
 {
     InitializeComponent();
     _widthAdjust  = Width - html.Width;
     _heightAdjust = Height - html.Height;
     SetSize(840, 640);
     html.set(ctx, this);
     on_go_clicked(null, null);
 }
Exemplo n.º 20
0
        public ActionResult AddOffer(Offer offer)
        {
            context data = new context();

            data.Offers.Add(offer);
            data.SaveChanges();

            return(RedirectToAction("ShowOffersCards"));
        }
Exemplo n.º 21
0
        public ActionResult TreeView()
        {
            var            db         = new context();
            var            val        = db.Categories.Where(x => x.ID.Length > 0).ToList();
            ModelContainer finalModel = new ModelContainer();

            finalModel.cat = val;
            return(View(finalModel));
        }
Exemplo n.º 22
0
        public static void genSiteMap()
        {
            var xml         = XElement.Load(@"D:\rw\design\convert-old-xml2tsx\products.xml");
            var roots       = xml.Elements().SelectMany(e => e.Elements().SelectMany(ell => ell.Elements())).ToArray();
            var sitemapLocs = initLocXml()["sitemap"];
            var oldea       = new List <string>();

            foreach (var root in roots)
            {
                var fn   = root.AttributeValue("url").Replace("/lm/oldea/", null); fn = fn.Substring(0, fn.Length - 1).Replace('/', '-');
                var line = fn.Split(new char[] { '_', '-' })[0];
                oldea.Add(string.Format("lm/oldea/{0}/{1}", line, fn));
                var sitemapDir = @"d:\rw\data\lm\oldea\" + line + "\\";
                var ctx        = new context()
                {
                    name = fn
                };
                // localization
                var toLoc  = new Dictionary <string, string>();
                var titles = root.DescendantsAndSelf().SelectMany(el => el.Attributes()).Where(a => a.Name.LocalName == "title").ToArray();
                foreach (var title in titles)
                {
                    localizeAttr(title, toLoc, ctx, true);
                }
                if (ctx.needsLoc)
                {
                    File.WriteAllText(sitemapDir + ctx.name + ".loc.ts", genLocTS(toLoc, sitemapLocs, null));
                }
                //sitemap
                var locLine = ctx.needsLoc ? string.Format("import ll from './{0}.loc';\r\n", ctx.name) : null;
                //var importLineLoc = "import { IMetaNode } from 'rw-course'; import { $l, toGlobId } from 'rw-lib/loc'; declare const __moduleName: string; const globId = toGlobId(__moduleName); const l = ll[globId];\r\n";
                //var importLineNoLoc = "import { IMetaNode } from 'rw-course';\r\n";
                var importLine = !ctx.needsLoc ?  null : "import { $l, toGlobId } from 'rw-lib/loc'; declare const __moduleName: string; const globId = toGlobId(__moduleName); const l = ll[globId];\r\n";
                //var importLine = ctx.needsLoc ? importLineLoc : importLineNoLoc;
                var importEx   = "import {0} from '{1}.meta';\r\n";
                var exportLine = "export default sitemap;";
                var cnt        = 0;
                var exs        = root.DescendantsAndSelf().Where(el => el.AttributeValue("type") == "ex").Select(el => el.AttributeValue("url")).Where(url => correctSitemaUrl(url)).ToDictionary(url => url, url => "ex$" + cnt++);
                var imports    = exs.Select(kv => string.Format(importEx, kv.Value, kv.Key.Substring(1))).DefaultIfEmpty().Aggregate((r, i) => r + i);
                var sb         = new StringBuilder();
                genSitemapCode(sb, root, exs);
                var code = "const sitemap: DCourse.IMetaNode = " + sb.ToString() + ";\r\n";
                var res  = locLine + importLine + imports + code + exportLine;
                File.WriteAllText(sitemapDir + ctx.name + ".ts", res);
            }
            var allcnt    = 0;
            var oldEADir  = oldea.ToDictionary(url => url, url => "root$" + allcnt++);
            var allImport = "import {0} from '{1}';\r\n";

            allImport = oldEADir.Select(kv => string.Format(allImport, kv.Value, kv.Key)).DefaultIfEmpty().Aggregate((r, i) => r + i);
            var all1 = "const allOldEA = { childs: [" + oldEADir.Values.Aggregate((r, i) => r + ", " + i) + "]};\r\n";
            var all2 = "export default allOldEA;";
            var all  = allImport + all1 + all2;

            File.WriteAllText(@"d:\rw\data\lm\oldea\index.ts", all);
        }
Exemplo n.º 23
0
        public ActionResult DeleteOffer(int id)
        {
            context data  = new context();
            Offer   offer = data.Offers.FirstOrDefault(o => o.ID == id);

            data.Offers.Remove(offer);
            data.SaveChanges();

            return(RedirectToAction("ShowOffersCards"));
        }
Exemplo n.º 24
0
        public ActionResult TeacherShowCourses(int id)
        {
            Teacher listATeacher = new Teacher();

            using (var context = new context())
            {
                listATeacher = context.Teachers.Include("Courses").SingleOrDefault(t => t.TeacherId == id);
            }
            return(PartialView("_TeacherShowCourses", listATeacher));
        }
Exemplo n.º 25
0
        public ActionResult ShowStudent(int id)
        {
            Student studentToShow = new Student();

            using (var context = new context())
            {
                studentToShow = context.Students.SingleOrDefault(s => s.StudentId == id);
            };
            return(PartialView("_ShowStudent", studentToShow));
        }
Exemplo n.º 26
0
        public ActionResult DeletePackage(int id)
        {
            context        data = new context();
            List <Package> list = data.Packages.ToList();

            data.Packages.Remove(data.Packages.FirstOrDefault(pack => pack.ID == id));
            data.SaveChanges();

            return(RedirectToAction("ShowPackageCards"));
        }
Exemplo n.º 27
0
        public ActionResult TeacherList(int id)
        {
            Teacher TeacherToList = new Teacher();

            using (var context = new context())
            {
                TeacherToList = context.Teachers.SingleOrDefault(t => t.TeacherId == id);
            }
            return(PartialView("_TeacherList", TeacherToList));
        }
Exemplo n.º 28
0
        public ActionResult Index()
        {
            var db = new context();
            var p  = new producto {
                cantidad = 1, precio = 10, categoriaId = 1
            };

            db.products.Add(p);
            db.SaveChanges();
            return(View());
        }
Exemplo n.º 29
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var html_context = new context();

            html_context.load_master_stylesheet(Resources.master_css);

            Application.Run(new BrowserForm(html_context));
        }
Exemplo n.º 30
0
        public ActionResult AddCar(Car car)
        {
            context data = new context();

            car.RentDate = DateTime.Today;
            car.period   = 0;
            data.Cars.Add(car);
            data.SaveChanges();

            return(RedirectToAction("ShowCarsCards"));
        }
Exemplo n.º 31
0
 return this.PreFlopAction(context);
Exemplo n.º 32
0
 cpSpatialIndexQuery(space.activeShapes, ref context, bb, new cpSpatialIndexQueryFunc(PointQuery), data);
Exemplo n.º 33
0
 resetAbort(context);
Exemplo n.º 34
0
 return this.BulletsStrategy(context);
Exemplo n.º 35
0
 base.EndHand(context);
Exemplo n.º 36
0
        private void mnuSend_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            sendContext = Stub.context.textData;
            backgroundWorker1.RunWorkerAsync();
            progressForm = new ProgressForm();
            progressForm.cancelBtn.Click += delegate(object send, EventArgs args) { Cancel(); };
            progressForm.Show();

            //String logMessage = String.Empty;
            //try
            //{
            //    MemoryStream stream = new MemoryStream();
            //    reg_editor.Document.SaveDocument(stream, DocumentFormat.Rtf);
            //    stream.Position = 0;
            //    Communicator.UploadContent(context, "application/rtf", stream);
            //    stream.Close();

            //    logMessage = "Сообщение отправлено!";
            //    reg_editor.Text = String.Empty;
            //}
            //catch (Exception ex)
            //{
            //    logMessage = "В процессе отправки произошла ошибка: " + ex.Message;
            //}

            //WriteLog(logMessage);
        }
Exemplo n.º 37
0
		public FileOperation(Context ct){
			this.ct = ct;
			//makeDir();
		}
Exemplo n.º 38
0
        private void mnuSendFile_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            sendContext = Stub.context.fileData;
            backgroundWorker1.RunWorkerAsync();
            progressForm = new ProgressForm();
            progressForm.cancelBtn.Click += delegate(object send, EventArgs args) { Cancel(); };
            progressForm.Show();

            //using (OpenFileDialog dlg = new OpenFileDialog())
            //{
            //    dlg.CheckPathExists = true;
            //    dlg.CheckFileExists = true;
            //    dlg.Multiselect = true;
            //    if (dlg.ShowDialog(this) == DialogResult.OK)
            //    {
            //        foreach (String fName in dlg.FileNames)
            //        {
            //            UploadFile(fName);
            //        }
            //    }
            //}
        }
Exemplo n.º 39
0
this.Sel_By|@Column@|(context);