public async Task <IActionResult> Edit(int id, [Bind("Id,Category")] Category1 category1) { if (id != category1.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category1); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Category1Exists(category1.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category1)); }
public IActionResult Add(string Name, string Description, Category1 Category1, Category2 Category2, Category3 Category3) { int max_id = 0; try { max_id = _db.Items.Max((it) => it.Id); } catch { } Item it = new Item() { Id = max_id + 1, Name = Name, Description = Description, Category1 = Category1, Category2 = Category2, Category3 = Category3 }; _db.Items.Add(it); _db.SaveChanges(); return(Ok()); }
public void Display() { Category1 objCat = new Category1(); objCat.Display(); Utility_Vehicle.Category1 category = new Utility_Vehicle.Category1(); category.Display(); }
public void PostCategory([FromBody] Category1 category) { using (ProductsDBEntities dbContext = new ProductsDBEntities()) { dbContext.Categories.Add(category); dbContext.SaveChanges(); } }
public void PutCategory(int id, [FromBody] Category1 category) { using (ProductsDBEntities dbContext = new ProductsDBEntities()) { var entity = dbContext.Categories.FirstOrDefault(e => e.ID == id); entity.Name = category.Name; dbContext.SaveChanges(); } }
public IActionResult Delete2(int Id, Category1 Parent, String Name, String Description) { _db.Category2.Remove(new Category2 { Id = Id }); _db.SaveChanges(); return(Ok()); }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { Application.Current.MainWindow.Width = SystemParameters.MaximizedPrimaryScreenWidth; Application.Current.MainWindow.Height = SystemParameters.MaximizedPrimaryScreenHeight; // 영상 출력 이미지의 넓이, 높이 지정 Image1.Width = this.Width; Image1.Height = this.Height; // 브랜드 마크 이미지의 넓이 지정 Image2.Width = this.Width; // 구매 버튼 위치 지정 Thickness margin = Buy.Margin; margin.Left = 1100; Buy.Margin = margin; // 카메라 버튼 위치 지정 margin = Capture.Margin; margin.Left = 1200; Capture.Margin = margin; // 카테고리 선택 버튼들 초기화 Category_Change(); Clothes_Change(); // 각 버튼들의 x,y좌표 값을 얻어온다. 반드시 마지막에 실행되야 한다. GeneralTransform generalTransform = Buy.TransformToAncestor(this); btnBuy = generalTransform.Transform(new System.Windows.Point(0, 0)); // 구매 버튼 x,y 좌표 얻기 generalTransform = Capture.TransformToAncestor(this); btnCapture = generalTransform.Transform(new System.Windows.Point(0, 0)); // 캡처 버튼 x,y 좌표 얻기 generalTransform = Category_down.TransformToAncestor(this); btnCategoryDown = generalTransform.Transform(new System.Windows.Point(0, 0)); // 카테고리 다운 버튼 x,y 좌표 얻기 generalTransform = Category_up.TransformToAncestor(this); btnCategoryUp = generalTransform.Transform(new System.Windows.Point(0, 0)); // 카테고리 업 버튼 x,y 좌표 얻기 generalTransform = Category1.TransformToAncestor(this); btnCategory1 = generalTransform.Transform(new System.Windows.Point(0, 0)); // 카테고리1 버튼 x,y 좌표 얻기 generalTransform = Category2.TransformToAncestor(this); btnCategory2 = generalTransform.Transform(new System.Windows.Point(0, 0)); // 카테고리2 버튼 x,y 좌표 얻기 generalTransform = Category3.TransformToAncestor(this); btnCategory3 = generalTransform.Transform(new System.Windows.Point(0, 0)); // 카테고리3 버튼 x,y 좌표 얻기 generalTransform = Clothes_down.TransformToAncestor(this); btnClothesDown = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes 다운 x,y 좌표 얻기 generalTransform = Clothes_up.TransformToAncestor(this); btnClothesUp = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes 업 x,y 좌표 얻기 generalTransform = Clothes1.TransformToAncestor(this); btnClothes1 = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes1 버튼 x,y 좌표 얻기 generalTransform = Clothes2.TransformToAncestor(this); btnClothes2 = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes2 버튼 x,y 좌표 얻기 generalTransform = Clothes3.TransformToAncestor(this); btnClothes3 = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes3 버튼 x,y 좌표 얻기 generalTransform = Clothes4.TransformToAncestor(this); btnClothes4 = generalTransform.Transform(new System.Windows.Point(0, 0)); // Clothes4 버튼 x,y 좌표 얻기 }
public ActionResult Edit([Bind(Include = "Id,Name,Description,brandId")] Category1 category1) { if (ModelState.IsValid) { db.Entry(category1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category1)); }
public IActionResult Edit(int id, string Name, string Description, Category1 Category1, Category2 Category2, Category3 Category3) { _db.Items.Update( new Item() { Id = id, Name = Name, Description = Description, Category1 = Category1, Category2 = Category2, Category3 = Category3 }); _db.SaveChanges(); return(Ok()); }
public ActionResult Create([Bind(Include = "Id,Name,Description,brandId")] Category1 category1) { if (ModelState.IsValid) { db.Category1.Add(category1); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category1)); }
public async Task <IActionResult> Create([Bind("Id,Category")] Category1 category1) { if (ModelState.IsValid) { _context.Add(category1); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category1)); }
public IActionResult Edit2(int Id, Category1 ParentCategory, string Name, string Description) { _db.Category2.Update(new Category2() { Id = Id, ParentCategory = ParentCategory, Name = Name, Description = Description }); _db.SaveChanges(); return(Ok()); }
public IActionResult Edit3(int Id, Category2 PCategory, Category1 GPCategory, String Name, String Description) { _db.Category3.Update(new Category3() { Id = Id, ParentCategory = PCategory, GPCategory = GPCategory, Name = Name, Description = Description }); _db.SaveChanges(); return(Ok()); }
// GET: Category1/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Category1 category1 = db.Category1.Find(id); if (category1 == null) { return(HttpNotFound()); } return(View(category1)); }
public IActionResult Add1(string Name, string Description) { int max_id = 0; try{ max_id = _db.Category1.Max((cat) => cat.Id); } catch { } Category1 cat = new Category1() { Id = max_id + 1, Name = Name, Description = Description }; _db.Category1.Add(cat); _db.SaveChanges(); return(Ok()); }
// GET: Category1/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Category1 category1 = db.Category1.Find(id); if (category1 == null) { return(HttpNotFound()); } category1 = db.Category1.Find(id); db.Category1.Remove(category1); db.SaveChanges(); return(RedirectToAction("Index")); }
public List <Category1> GetCategory() { string cs = ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString.ToString(); List <Category1> items = new List <Category1>(); using (SqlConnection con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand("select * from tblCategory", con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Category1 item = new Category1(); item.Id = Guid.Parse(rdr[0].ToString()); item.Name = rdr[1].ToString(); items.Add(item); } } return(items); }
public IActionResult Add2(Category1 ParentCategory, string Name, string Description) { int max_id = 0; try { max_id = _db.Category2.Max((cat2) => cat2.Id); } catch { } Category2 cat2 = new Category2() { Id = max_id + 1, ParentCategory = ParentCategory, Name = Name, Description = Description }; _db.Category2.Add(cat2); _db.SaveChanges(); return(Ok()); }
public IActionResult Add3(Category2 PCategory, Category1 GPCategory, String Name, String Description) { int max_id = 0; try { max_id = _db.Category3.Max((cat3) => cat3.Id); } catch { } Category3 cat3 = new Category3() { Id = max_id + 1, ParentCategory = PCategory, GPCategory = GPCategory, Name = Name, Description = Description }; _db.Category3.Add(cat3); _db.SaveChanges(); return(Ok()); }
// Si la actividad devuelve un valor, se debe derivar de CodeActivity<TResult> // y devolver el valor desde el método Execute. protected override void Execute(CodeActivityContext executionContext) { //Create the tracing service ITracingService tracingService = executionContext.GetExtension <ITracingService>(); //Create the context IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); Guid idWorkFlowInstance = executionContext.WorkflowInstanceId; Boolean isError = false; try { // GUID of target record (case) Guid gCaseId = context.PrimaryEntityId; Guid gNewCaseId = Guid.Empty; //Obtenemos los valores de los parámetros del caso. //string strCaseTypeCode = CaseTypeCode.Get<string>(executionContext); EntityReference erCaseType = CaseType.Get <EntityReference>(executionContext); EntityReference erCategory1 = Category1.Get <EntityReference>(executionContext); EntityReference erCategory2 = Category2.Get <EntityReference>(executionContext); EntityReference erOriginUser = OriginUser.Get <EntityReference>(executionContext); EntityReference erOriginPDV = OriginPDV.Get <EntityReference>(executionContext); EntityReference erOriginRegion = OriginRegion.Get <EntityReference>(executionContext); OptionSetValue oOriginChannel = OriginChannel.Get <OptionSetValue>(executionContext); OptionSetValue oStatusCode = StatusCode.Get <OptionSetValue>(executionContext); EntityReference erCustomer = Customer.Get <EntityReference>(executionContext); string strTitle = CaseTitle.Get <string>(executionContext); EntityReference erContract = Contract.Get <EntityReference>(executionContext); Boolean? isReincidentCase = ReincidentCase.Get <Boolean>(executionContext); EntityReference erAssociatedCase = AssociatedCase.Get <EntityReference>(executionContext); OptionSetValue oTransactionType = TransactionType.Get <OptionSetValue>(executionContext); Entity eCase = new Entity("incident"); if (erCaseType != null) { eCase.Attributes["amxperu_casetype"] = erCaseType; } if (erCategory1 != null) { eCase.Attributes["ust_category1"] = erCategory1; } if (erCategory2 != null) { eCase.Attributes["ust_category2"] = erCategory2; } //if (erOriginUser != null) // eCase.Attributes["ownerid"] = erOriginUser; if (erOriginPDV != null) { eCase.Attributes["amxperu_originpdv"] = erOriginPDV; } if (erOriginRegion != null) { eCase.Attributes["amxperu_originregion"] = erOriginRegion; } if (oOriginChannel != null) { eCase.Attributes["amxperu_originchannel"] = oOriginChannel; } if (oStatusCode != null) { eCase.Attributes["statuscode"] = oStatusCode; } if (erCustomer != null) { eCase.Attributes["customerid"] = erCustomer; } if (!string.IsNullOrEmpty(strTitle)) { eCase.Attributes["title"] = strTitle; } if (erContract != null) { eCase.Attributes["contractid"] = erContract; } //if (isReincidentCase != null) // eCase.Attributes["amxperu_reincidentcase"] = isReincidentCase; if (erAssociatedCase != null) { eCase.Attributes["ust_associatedcase1"] = erAssociatedCase; } if (oTransactionType != null) { eCase.Attributes["ust_transactiontype"] = oTransactionType; } if (eCase.Attributes.Count > 0) { gNewCaseId = service.Create(eCase); //if (gNewCaseId != Guid.Empty) //{ // //Entity incident = new Entity("incident"); // //incident.Id = gCaseId; // //incident["ust_isretentioncreated"] = true; // //service.Update //} } } catch (FaultException <IOrganizationService> ex) { isError = true; throw new FaultException("IOrganizationServiceExcepcion: " + ex.Message); } catch (FaultException ex) { isError = true; throw new FaultException("FaultException: " + ex.Message); } catch (InvalidWorkflowException ex) { isError = true; throw new InvalidWorkflowException("InvalidWorkflowException: " + ex.Message); } catch (Exception ex) { isError = true; throw new Exception(ex.Message); } finally { if (isError) { //Entity workflowToCancel = new Entity("asyncoperation"); //workflowToCancel.Id = idWorkFlowInstance; //workflowToCancel["statecode"] = new OptionSetValue(3); //workflowToCancel["statuscode"] = new OptionSetValue(32); //service.Update(workflowToCancel); } } }
public IEnumerable <Category2> GetSubCategory([FromBody] Category1 category) { return(db.Category2.Where(x => x.Category1Id == category.Category1Id).OrderBy(x => x.Title)); }
public void ListingSteps() { //populate excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "AddSkill"); //click add new // IWebElement ShareSkills = Common.Driver.FindElement(By.CssSelector("div.ui:nth-child(1) section.nav-secondary:nth-child(2) div.ui.eight.item.menu div.right.item:nth-child(5) > a.ui.basic.green.button")); Thread.Sleep(7000); ShareSkills.Click(); Thread.Sleep(8000); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Category1.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category1")); Category2.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category2")); Tags1.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags1")); Tags1.SendKeys(Keys.Enter); Console.WriteLine("Enter pressed for tag1"); ServiceType.Click(); LocationType.Click(); StartDate.SendKeys("17/10/2019"); EndDate.SendKeys("17/04/2020"); ChooseMon.Click(); StartTimeMon.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTimeMon")); EndTimeMon.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndTimeMon")); SkillTrade.Click(); Credit.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, " Credit")); PlusIcon.Click(); Thread.Sleep(7000); AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); //activate the window, so that next set of action actives n this window Thread.Sleep(5000); autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf"); Thread.Sleep(7000); autoIt.Send("{ENTER}"); Active.Click(); Save.Click(); //verify Thread.Sleep(9000); ManagelistingsMenu.Click(); Thread.Sleep(9000); try { Console.WriteLine("Entered try"); Assert.IsTrue(ActualResult1.Text.Contains("Automation testing")); { Console.WriteLine("Test case 1 PASS : Added Record successfully"); Base.test.Log(LogStatus.Info, "Record added"); } ////Screenshot //String img = Global.GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report"); ////AddScreenCapture(@"E:\Dropbox\VisualStudio\Projects\Beehive\TestReports\ScreenShots\"); //Base.test.Log(LogStatus.Info, "Image example: " + img); //// end test. (Reports) //Base.extent.EndTest(Base.test); //// calling Flush writes everything to the log file (Reports) //Base.extent.Flush(); } catch (Exception e) { Console.WriteLine(e); } }
public void ListingSteps() { //click add new // IWebElement ShareSkills = Common.Driver.FindElement(By.CssSelector("div.ui:nth-child(1) section.nav-secondary:nth-child(2) div.ui.eight.item.menu div.right.item:nth-child(5) > a.ui.basic.green.button")); Thread.Sleep(7000); ShareSkills.Click(); Thread.Sleep(8000); Title.SendKeys("Automation Testing"); Description.SendKeys("Tools used in testing and methods followed in handling tools"); Category1.SendKeys("Programming & Tech"); Category2.SendKeys("QA"); Tags1.SendKeys("Selenium"); Tags1.SendKeys(Keys.Enter); Console.WriteLine("Enter pressed for tag1"); ServiceType.Click(); LocationType.Click(); StartDate.SendKeys("17/10/2019"); EndDate.SendKeys("17/4/2020"); ChooseMon.Click(); StartTimeMon.SendKeys("8.30AM"); EndTimeMon.SendKeys("4.30PM"); SkillTrade.Click(); Credit.SendKeys("5"); Active.Click(); Save.Click(); Thread.Sleep(6000); //verification ManagelistingsMenu.Click(); Thread.Sleep(8000); try { Assert.AreEqual("Automation Testing", ActualResult1.Text); Console.WriteLine("Test case 1 PASS: record added succesfully"); } catch (Exception e) { Console.WriteLine(e); } }
private void lbList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { int a = lbList.SelectedIndex; tbText.Text = ""; tbText.IsReadOnly = false; btSave.IsEnabled = true; StreamReader fs = new StreamReader(lbList.SelectedItem.ToString(), Encoding.Default); if (Category1.Equals("A")) { if (lMetka[a].Equals("A")) { for (int j = 0; !fs.EndOfStream; j++) { tbText.Text += fs.ReadLine(); } Client1.FileReadOpen(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); //Magaz1.Add(DateTime.Now + " Пользователь открыл файл " + lbList.SelectedItem.ToString()); } else { tbText.IsReadOnly = true; btSave.IsEnabled = false; for (int j = 0; !fs.EndOfStream; j++) { tbText.Text += fs.ReadLine(); } Client1.FileReadOpenIsReadonly(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); //Magaz1.Add(DateTime.Now + " Пользователь открыл файл " + lbList.SelectedItem.ToString() + " с ограничением на запись и сохранение"); } } if (Category1.Equals("B")) { if (lMetka[a].CompareTo("B") == -1) { MessageBox.Show("Нет доступа к документу!", "Ok"); Client1.AccessDenied(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); /* Magaz1.Add(DateTime.Now + " Попытка доступа к файлу " + lbList.SelectedItem.ToString()); * Magaz1.Add(DateTime.Now + " Доступ запрещен!!!");*/ } if (lMetka[a].Equals("B")) { for (int j = 0; !fs.EndOfStream; j++) { tbText.Text += fs.ReadLine(); } Client1.FileReadOpen(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); //Magaz1.Add(DateTime.Now + " Пользователь открыл файл " + lbList.SelectedItem.ToString()); } else { tbText.IsReadOnly = true; btSave.IsEnabled = false; for (int j = 0; !fs.EndOfStream; j++) { tbText.Text += fs.ReadLine(); } Client1.FileReadOpenIsReadonly(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); //Magaz1.Add(DateTime.Now + " Пользователь открыл файл " + lbList.SelectedItem.ToString() + " с ограничением на запись и сохранение"); } } if (Category1.Equals("C")) { if (lMetka[a].CompareTo("C") == -1) { MessageBox.Show("Нет доступа к документу!", "Ok"); Client1.AccessDenied(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); /* Magaz1.Add(DateTime.Now + " Попытка доступа к файлу " + lbList.SelectedItem.ToString()); * Magaz1.Add(DateTime.Now + " Доступ запрещен!!!");*/ } if (lMetka[a].Equals("C")) { for (int j = 0; !fs.EndOfStream; j++) { tbText.Text += fs.ReadLine(); } Client1.FileReadOpen(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); //Magaz1.Add(DateTime.Now + " Пользователь открыл файл " + lbList.SelectedItem.ToString()); } else { tbText.IsReadOnly = true; btSave.IsEnabled = false; for (int j = 0; !fs.EndOfStream; j++) { tbText.Text += fs.ReadLine(); } Client1.FileReadOpenIsReadonly(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); //Magaz1.Add(DateTime.Now + " Пользователь открыл файл " + lbList.SelectedItem.ToString() + " с ограничением на запись и сохранение"); } } if (Category1.Equals("D")) { if (lMetka[a].CompareTo("D") == -1) { MessageBox.Show("Нет доступа к документу!", "Ok"); Client1.AccessDenied(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); /*Magaz1.Add(DateTime.Now + " Попытка доступа к файлу " + lbList.SelectedItem.ToString()); * Magaz1.Add(DateTime.Now + " Доступ запрещен!!!");*/ } if (lMetka[a].Equals("D")) { for (int j = 0; !fs.EndOfStream; j++) { tbText.Text += fs.ReadLine(); } Client1.FileReadOpen(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); // Magaz1.Add(DateTime.Now + " Пользователь открыл файл " + lbList.SelectedItem.ToString()); } else { tbText.IsReadOnly = true; btSave.IsEnabled = false; for (int j = 0; !fs.EndOfStream; j++) { tbText.Text += fs.ReadLine(); } Client1.FileReadOpenIsReadonly(Magaz1.ToArray(), lbList.SelectedItem.ToString(), Category1); // Magaz1.Add(DateTime.Now + " Пользователь открыл файл " + lbList.SelectedItem.ToString() + " с ограничением на запись и сохранение"); } } }
public void GivenIClickOnThePopularMakeCategory() { WaitHelpers.TurnOnWait(); Category1.Click(); }