public bool DeleteDetail(Detail detail) { if (detail == null) return false; _unitOfWork.DetailRepository.Delete(detail); _unitOfWork.Save(); return true; }
public Competence(int id, string nom, string desc, int vie, int mana, int init, int force, int magie, int def, int chance) { _id = id; _nom = nom; _description = desc; _detail = new Detail(vie,mana,init,force,magie,def,chance); }
public static Detail Parse(string sqlString) { Detail callableDetail = new Detail(); callableDetail.IsCallable = sqlString.IndexOf("{") == 0 && sqlString.IndexOf("}") == (sqlString.Length - 1) && sqlString.IndexOf("call") > 0; if (!callableDetail.IsCallable) return callableDetail; Match functionMatch = functionNameFinder.Match(sqlString); if ((!functionMatch.Success) || (functionMatch.Groups.Count < 2)) throw new HibernateException("Could not determine function name for callable SQL: " + sqlString); callableDetail.FunctionName = functionMatch.Groups[1].Value; callableDetail.HasReturn = sqlString.IndexOf("call") > 0 && sqlString.IndexOf("?") > 0 && sqlString.IndexOf("=") > 0 && sqlString.IndexOf("?") < sqlString.IndexOf("call") && sqlString.IndexOf("=") < sqlString.IndexOf("call"); return callableDetail; }
private void InternalGetTableData(Detail detail, Dictionary<string, string> row) { try { if (detail.SubDetails != null) { foreach (var sub in detail.SubDetails) { var subdic = new Dictionary<string, string>(); InternalGetTableData(sub, subdic); foreach (var item in subdic) { if (!row.ContainsKey(item.Key)) row.Add(item.Key, item.Value); } } } else { if (!row.ContainsKey(detail.DisplayName.Replace('.', '_'))) row.Add(detail.DisplayName.Replace('.', '_'), detail.Value == null ? "" : detail.Value.ToString()); } } catch (Exception ex) { LocalLoggingService.Error("{0} {1} {2} {3}", MongodbServerConfiguration.ModuleName, "MongodbServer_Table", "InternalGetTableData", ex.Message); throw; } }
public AddLinkForm(DetailsContext context, Detail detail) { InitializeComponent(); _context = context; _detail = detail; LoadData(); BindData(); }
public void TestWithCapitalLetters() { string name = "Boch"; string article = "0 450 905 030"; Detail first = new Detail { Name = name, Article = article }; Detail second = new Detail { Name = name.ToUpper(), Article = article }; Assert.AreEqual(true, new DetailsComparer().Equals(first, second)); }
public void TestTheSameDetails() { string name = "Boch"; string article = "0 450 905 030"; Detail first = new Detail { Name = name, Article = article }; Detail second = new Detail { Name = name, Article = article }; Assert.AreEqual(true, new DetailsComparer().Equals(first, second)); }
//construteur par copie public Competence( int id,string nom,string desc, Detail detail) { _id = id; _nom = nom; _description = desc; _detail = new Detail(); _detail = detail; }
public ObjetRessouce(int id, string nom, int valeur, string desc, EnumTypeObjet to, int vie, int mana, int init, int force, int magie, int def, int chance) { _id = id; _nom = nom; _valeur = valeur; _description = desc; _detail = new Detail(vie,mana,init,force,magie,def,chance); _typeObjet = to; }
public Comparison(ComparisonType t, object controlTarget, string controlXPath, object controlValue, object testTarget, string testXPath, object testValue) { type = t; control = new Detail(controlTarget, controlXPath, controlValue); test = new Detail(testTarget, testXPath, testValue); }
public EditForm(DetailsContext context, Detail detail) { InitializeComponent(); _context = context; _detail = detail; LoadRelatedDetails(); dgvAnalogs.AutoGenerateColumns = false; BindData(); }
public void TestWithExtraSpaces() { string name = "Boch"; string article = "0 450 905 030"; string secondArticle = article.Replace(" ", ""); Detail first = new Detail { Name = name, Article = article }; Detail second = new Detail { Name = name, Article = secondArticle }; Assert.AreEqual(true, new DetailsComparer().Equals(first, second)); }
public ObjetRessouce(int id, string nom, int valeur,string desc, Detail detail, EnumTypeObjet to) { _id = id; _nom = nom; _valeur = valeur; _description = desc; _detail = new Detail(); _detail = detail; _typeObjet = to; }
public void AddDetail(Detail detail) { //если у нас уже содержаться данные в списке, то заменить их if (Details.Any(d=>d.OidKey==detail.OidKey)) { var temp= Details.FirstOrDefault(d => d.OidKey == detail.OidKey); temp.Properties = detail.Properties; } else { Details.Add(detail); } }
private Detail CreateDetailIfNotExists(string name, string article) { var comparer = new DetailsComparer(); var tmpDetail = new Detail { Name = name, Article = article }; var detail = _context.Details.Local.FirstOrDefault(d => comparer.Equals(d, tmpDetail)); if (detail == null) { detail = tmpDetail; _context.Details.Add(detail); _context.SaveChanges(); } return detail; }
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer) { if (dictionary != null) { var detail = new Detail(); detail.NewValue = dictionary.GetValue<string>(RedmineKeys.NEW_VALUE); detail.OldValue = dictionary.GetValue<string>(RedmineKeys.OLD_VALUE); detail.Property = dictionary.GetValue<string>(RedmineKeys.PROPERTY); detail.StatusId = dictionary.GetValue<string>(RedmineKeys.STATUS_ID); return detail; } return null; }
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer) { if (dictionary != null) { var detail = new Detail(); detail.NewValue = dictionary.GetValue<string>("new_value"); detail.OldValue = dictionary.GetValue<string>("old_value"); detail.Property = dictionary.GetValue<string>("property"); detail.StatusId = dictionary.GetValue<string>("name"); return detail; } return null; }
public Node DiscoveryByNode(Node node) { SnmpExpect expect = new SnmpExpect(); List<OidKey> list = BuildOidList(node); foreach (var oid in list) { Detail detail = new Detail { OidKey = oid, Node = node, Properties = expect.SnmpGet(node.RoCommunity, node.Address, oid.Key) }; node.AddDetail(detail); } return node; }
private void addDetailToolStripMenuItem_Click(object sender, EventArgs e) { Detail newDetail = new Detail(); bool res = EditDetail(newDetail); var state = _context.Entry(newDetail).State; if (!res) { bsDetails.CancelEdit(); if (state == EntityState.Unchanged) { RemoveDetail(newDetail); } } else { if (state == EntityState.Added) { _context.Details.Add(newDetail); } } _context.SaveChanges(); }
public void AddContestDetail(int contest_id) { //插入数据库question表的数据 List<CfContestDetail> list_fetch = cf.GetContestDetails(contest_id); int allNum = list_fetch.First().PointTime.Count; Crud<Detail> crud = new Crud<Detail>(); Crud<Question> crud2 = new Crud<Question>(); Question question = new Question(); Detail detail = new Detail(); foreach (var item in list_fetch)//每一个user { detail.ContestId = item.ContestId; detail.Username = item.UserName; detail.AllNum = item.PointTime.Count; detail.ChallengeSuccess = item.ChallengeSucceed; detail.ChallengeFailed = item.ChallengeFailed; detail.Type = "cf"; //detail.ContestName 等待加入 int allpoint=0; question.ContestId = item.ContestId; question.UserName = item.UserName; question.Type = "cf"; int i=1; foreach (var pointTime in item.PointTime)//每一个user的每一题 { int point = pointTime.Item1;//point question.Point = point; string time = pointTime.Item2;//time question.Time = Convert.ToInt32(time);//调试下 question.Num = i; i++; allpoint += point; } } }
Coordinate[] GetCoordinates(BinaryReader binReader, Detail detail) { UInt32 size; Coordinate[] coordinate; switch (detail) { case Detail.Simple: case Detail.Extended: size = binReader.ReadUInt32() / (uint)Marshal.SizeOf(typeof(Coordinate)); coordinate = new Coordinate[size]; FileTools.BinaryToArray<Coordinate>(binReader, coordinate); return coordinate; case Detail.Full: size = binReader.ReadUInt32() / (uint)Marshal.SizeOf(typeof(Extended)); coordinate = new Extended[size]; FileTools.BinaryToArray<Extended>(binReader, (Extended[])coordinate); return coordinate; default: return null; } }
public async Task <SaleDto> PreCreation(Guid userId, SaleForCreationDto saletForCreationDto) { try { Client client = null; if (saletForCreationDto.ClientId.HasValue) { client = await _clientRepository.GetById(saletForCreationDto.ClientId.Value); if (client == null) { throw new KeyNotFoundException($"Client with id: {saletForCreationDto.ClientId} not found."); } } var sale = new Sale() { ClientId = saletForCreationDto.ClientId, Client = client, ClientName = client != null ? client.Name + " " + client.Lastname : saletForCreationDto.ClientName, Date = saletForCreationDto.Date.ToLocalTime(), PaymentType = saletForCreationDto.PaymentType, CreatedBy = userId }; decimal total = 0; foreach (var detailFC in saletForCreationDto.Details) { var product = await _productRepository.GetById(detailFC.ProductId); if (product == null) { throw new KeyNotFoundException($"Product with id: {detailFC.ProductId} not found."); } var price = (await _priceRepository.GetAll()) .OrderByDescending(x => x.DateTime) .FirstOrDefault( x => x.ProductId == detailFC.ProductId && x.DateTime.ToLocalTime() <= saletForCreationDto.Date.ToLocalTime() && x.PriceType == ePriceTypes.SalePrice && !x.IsDeleted ); FeeRule feeRule = null; if (sale.PaymentType == ePaymentTypes.OwnFees) { feeRule = (await _feeRuleRepository.Find(x => x.ProductId == detailFC.ProductId)) .OrderByDescending(x => x.Date).ThenBy(x => x.FeesAmountTo) .FirstOrDefault(x => x.Date <= sale.Date && x.FeesAmountTo >= saletForCreationDto.OwnFees.Quantity); if (feeRule == null) { throw new KeyNotFoundException($"Fee Rule not found."); } decimal percentage = feeRule.Percentage * saletForCreationDto.OwnFees.Quantity / 100; total += price.Value * detailFC.Quantity * (1 + percentage); } else { total += price.Value * detailFC.Quantity; } var detail = new Detail() { SaleId = sale.Id, ProductId = detailFC.ProductId, Product = product, Quantity = detailFC.Quantity, UnitPrice = price.Value, FeeRuleId = feeRule?.Id, CreatedBy = userId }; sale.Details.Add(detail); } Payment payment = null; switch (saletForCreationDto.PaymentType) { case Util.Enums.ePaymentTypes.Cash: var cashDto = (CashForCreationDto)saletForCreationDto.Cash; payment = new Cash(total, cashDto.Discount) { SaleId = sale.Id, CreatedBy = userId }; break; case Util.Enums.ePaymentTypes.OwnFees: var ownFeesDto = (OwnFeesForCreationDto)saletForCreationDto.OwnFees; payment = new OwnFees(ownFeesDto.ExpirationDate, total, ownFeesDto.Quantity, userId) { SaleId = sale.Id, }; break; case Util.Enums.ePaymentTypes.CreditCard: var creditCardDto = (CreditCardForCreationDto)saletForCreationDto.CreditCard; payment = new CreditCard(total, creditCardDto.Discount, creditCardDto.Surcharge) { SaleId = sale.Id, CardType = creditCardDto.CardType, Bank = creditCardDto.Bank, CreatedBy = userId }; break; case Util.Enums.ePaymentTypes.DebitCard: var debitCardDto = (DebitCardForCreationDto)saletForCreationDto.DebitCard; payment = new DebitCard(total, debitCardDto.Discount, debitCardDto.Surcharge) { SaleId = sale.Id, CardType = debitCardDto.CardType, Bank = debitCardDto.Bank, CreatedBy = userId }; break; case Util.Enums.ePaymentTypes.Cheques: var chequesDto = (ChequesPaymentForCreationDto)saletForCreationDto.Cheques; if (chequesDto.ListOfCheques.Sum(x => x.Value) != total) { throw new InvalidOperationException("The sum of cheques list is different of amount."); } payment = new ChequesPayment() { SaleId = sale.Id, Amount = Math.Ceiling(total * 100) / 100, CreatedBy = userId }; foreach (var c in chequesDto.ListOfCheques) { var cheque = new Cheque() { ChequesPaymentId = payment.Id, Bank = c.Bank, Nro = c.Nro, Value = c.Value, CreatedBy = userId }; ((ChequesPayment)payment).ListOfCheques.Add(cheque); } break; default: break; } sale.PaymentId = payment.Id; sale.Payment = payment; var saleDto = _mapper.Map <Sale, SaleDto>(sale); switch (saleDto.PaymentType) { case Util.Enums.ePaymentTypes.Cash: saleDto.Cash = _mapper.Map <Cash, CashDto>((Cash)payment); break; case Util.Enums.ePaymentTypes.OwnFees: OwnFees owF = (OwnFees)payment; saleDto.OwnFees = _mapper.Map <OwnFees, OwnFeesDto>(owF); break; case Util.Enums.ePaymentTypes.CreditCard: saleDto.CreditCard = _mapper.Map <CreditCard, CreditCardDto>((CreditCard)payment); break; case Util.Enums.ePaymentTypes.DebitCard: saleDto.DebitCard = _mapper.Map <DebitCard, DebitCardDto>((DebitCard)payment); break; case Util.Enums.ePaymentTypes.Cheques: saleDto.Cheques = _mapper.Map <ChequesPayment, ChequesPaymentDto>((ChequesPayment)payment); break; default: break; } return(saleDto); } catch (Exception e) { throw e; } }
public static void Main(String[] args) { IDatabase db = DatabaseFactory.CreateDatabase(); Supplier supplier; Detail detail; Shipment shipment; Shipment[] shipments; int i; db.Open("testssd.dbs"); TestSSD root = (TestSSD)db.Root; if (root == null) { root = new TestSSD(); root.supplierName = db.CreateFieldIndex<string, Supplier>("name", IndexType.Unique); root.detailId = db.CreateFieldIndex<string, Detail>("id", IndexType.Unique); root.shipmentSupplier = db.CreateFieldIndex<Supplier, Shipment>("supplier", IndexType.NonUnique); root.shipmentDetail = db.CreateFieldIndex<Detail, Shipment>("detail", IndexType.NonUnique); db.Root = root; } while (true) { try { switch ((int)inputLong("-------------------------------------\n" + "Menu:\n" + "1. Add supplier\n" + "2. Add detail\n" + "3. Add shipment\n" + "4. List of suppliers\n" + "5. List of details\n" + "6. Suppliers of detail\n" + "7. Details shipped by supplier\n" + "8. Exit\n\n>>")) { case 1: supplier = new Supplier(); supplier.name = input("Supplier name: "); supplier.location = input("Supplier location: "); root.supplierName.Put(supplier); db.Commit(); continue; case 2: detail = new Detail(); detail.id = input("Detail id: "); detail.weight = (float)inputDouble("Detail weight: "); root.detailId.Put(detail); db.Commit(); continue; case 3: supplier = root.supplierName[input("Supplier name: ")]; if (supplier == null) { Console.WriteLine("No such supplier!"); break; } detail = root.detailId[input("Detail ID: ")]; if (detail == null) { Console.WriteLine("No such detail!"); break; } shipment = new Shipment(); shipment.quantity = (int)inputLong("Shipment quantity: "); shipment.price = inputLong("Shipment price: "); shipment.detail = detail; shipment.supplier = supplier; root.shipmentSupplier.Put(shipment); root.shipmentDetail.Put(shipment); db.Commit(); continue; case 4: foreach (Supplier s in root.supplierName) { Console.WriteLine("Supplier name: " + s.name + ", supplier.location: " + s.location); } break; case 5: foreach (Detail d in root.detailId) { Console.WriteLine("Detail ID: " + d.id + ", detail.weight: " + d.weight); } break; case 6: detail = root.detailId[input("Detail ID: ")]; if (detail == null) { Console.WriteLine("No such detail!"); break; } shipments = (Shipment[])root.shipmentDetail.Get(new Key(detail), new Key(detail)); for (i = 0; i < shipments.Length; i++) { Console.WriteLine("Suppplier name: " + shipments[i].supplier.name); } break; case 7: supplier = root.supplierName[input("Supplier name: ")]; if (supplier == null) { Console.WriteLine("No such supplier!"); break; } shipments = root.shipmentSupplier.Get(supplier, supplier); for (i = 0; i < shipments.Length; i++) { Console.WriteLine("Detail ID: " + shipments[i].detail.id); } break; case 8: db.Close(); return; } skip("Press ENTER to continue..."); } catch (DatabaseException x) { Console.WriteLine("Error: " + x.Message); skip("Press ENTER to continue..."); } } }
/// <summary> /// 初始化数据 /// </summary> /// <param name="list"></param> /// <param name="i"></param> /// <param name="j"></param> private void init(List <Customs.Entity.Store_in_listInfo> list, int i, int j) { #region 给table赋值 DevExpress.XtraReports.UI.XRTableCell seq = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cseq" + i, false); seq.Text = list[j].G_no.ToString(); DevExpress.XtraReports.UI.XRTableCell cCode = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cCode" + i, false); cCode.Text = list[j].Code_t; //货物名称和规格 DevExpress.XtraReports.UI.XRTableCell cName = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cName" + i, false); cName.Text = list[j].Mg_name + "\n" + list[j].Mg_spec + "\n" + list[j].Pkgs + "件"; //数量 string temp = PublicMethod.RemoveZero(list[j].Qty_2.ToString()) == "0" ? "" : PublicMethod.RemoveZero(list[j].Qty_2.ToString()); DevExpress.XtraReports.UI.XRTableCell cNum = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cNum" + i, false); //cNum.Text = PublicMethod.RemoveZero(list[j].G_qty.ToString())+"\n"+PublicMethod.RemoveZero(list[j].Qty_1.ToString())+"\n"+temp; cNum.Text = PublicMethod.RemoveZero(list[j].Qty_1.ToString()) + "\n" + temp + "\n" + PublicMethod.RemoveZero(list[j].G_qty.ToString()); //单位 DevExpress.XtraReports.UI.XRTableCell cUnit = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cUnit" + i, false); //cUnit.Text =PublicMethod.GetHashValue(ht,list[j].G_unit).ToString() + "\n" + PublicMethod.GetHashValue(ht,list[j].Unit_code1).ToString() + "\n"+PublicMethod.GetHashValue(ht,list[j].Unit_code2).ToString();//list[j].G_unit; cUnit.Text = CommonReport.GetHashValue(ht, list[j].Unit_code1).ToString() + "\n" + CommonReport.GetHashValue(ht, list[j].Unit_code2).ToString() + "\n" + CommonReport.GetHashValue(ht, list[j].G_unit).ToString();//list[j].G_unit; DevExpress.XtraReports.UI.XRTableCell cWeight = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cWeight" + i, false); cWeight.Text = list[j].Gross + "\n" + list[j].Net; //币值 DevExpress.XtraReports.UI.XRTableCell cCoin = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cCoin" + i, false); cCoin.Text = CommonReport.GetCode("118", list[j].Curr_code.ToString(), true); DevExpress.XtraReports.UI.XRTableCell cPrice = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cPrice" + i, false); cPrice.Text = list[j].Unit_price.ToString(); DevExpress.XtraReports.UI.XRTableCell cTotal = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cTotal" + i, false); cTotal.Text = list[j].Trade_ttl.ToString(); #endregion }
/// <summary> /// BeforePrint Event /// ActiveReports raises this event before the section is rendered to a page. /// Use this event to modify the control's values before printing. /// The changes made here do not effect the height of the section. /// </summary> private void Detail_BeforePrint(object sender, EventArgs eArgs) { // Use the name unbound field that we created in DataInitialize // as the caption of the bookmark. Detail.AddBookmark(txtName.Text); }
private Economy() { detail = new Detail(); }
public DetailViewModel(Detail detail) { this.Name = detail.Name; }
public void Add(Detail detail) { _details.Add(detail); }
static void Main(string[] args) { DailyQueueOfCars dailyQueueOfCars = new DailyQueueOfCars(); CarService carService = new CarService(); Car car; DetailsStore detailsStore = new DetailsStore(); int userInput; int userChoice; bool carServiceWorking = true; while (carServiceWorking) { Console.Clear(); carService.DisplayWallet(); Console.WriteLine("Это меню управления вашим автосервисом."); Console.WriteLine("1. Принять следующего клиента"); Console.WriteLine("2. Открыть каталог деталей"); Console.WriteLine("3. Осмотреть склад деталей"); Console.WriteLine("0. Выйти"); userInput = Convert.ToInt32(Console.ReadLine()); switch (userInput) { case 1: car = dailyQueueOfCars.ReturnNextCar(); if (car == null) { Console.Clear(); Console.WriteLine($"На сегодня клиенты закончились. Поздравляем с окончанием рабочего дня! Хотите начать новый день?"); Console.WriteLine("1. Да."); Console.WriteLine("2. Нет. Выйти."); userInput = Convert.ToInt32(Console.ReadLine()); if (userInput == 1) { dailyQueueOfCars = new DailyQueueOfCars(); continue; } else if (userInput == 2) { carServiceWorking = false; continue; } else { Console.Clear(); Console.WriteLine("Неверная команда"); Console.ReadKey(); continue; } } Console.Clear(); Console.WriteLine("Новый клиент"); car.DisplayListDetails(); Console.WriteLine(); Console.WriteLine("1. Выбрать деталь для замены"); Console.WriteLine("2. Отказатся ремонтировать"); userChoice = Convert.ToInt32(Console.ReadLine()); if (userChoice == 1) { carService.DisplayWarehouseDetail(); int DetailNumber = Convert.ToInt32(Console.ReadLine()); Detail detailForRepair = carService.Repair(DetailNumber); int countIncome = car.Repair(detailForRepair); carServiceWorking = carService.TakeIncome(countIncome); } else if (userChoice == 2) { Console.Clear(); carServiceWorking = carService.PayFine(); Console.WriteLine("Шраф 100 рублей"); Console.ReadKey(); } else { Console.Clear(); Console.WriteLine("Неверная команда"); Console.ReadKey(); } break; case 2: detailsStore.Menu(); userChoice = Convert.ToInt32(Console.ReadLine()); Detail detail = detailsStore.SellingDetail(userChoice); if (detail != null) { carService.BuyDetail(detail); } break; case 3: carService.DisplayWarehouseDetail(); Console.ReadKey(); break; case 0: carServiceWorking = false; break; default: Console.Clear(); Console.WriteLine("Неверная команда"); Console.ReadKey(); break; } } }
public void Load(string xmlPath) { this.Path = xmlPath; LoadResult = SkinLoadResult.Fail; try { XmlDocument xdoc = new XmlDocument(); xdoc.Load(xmlPath); WorkingDir = System.IO.Path.GetDirectoryName(xmlPath); var xroot = xdoc["skin"]; this.Name = xroot.Attributes["name"].Value; string cTypeStr = xroot.Attributes["type"].Value; // see if a mapping is defined for this controller type if (!NintendoSpyMapping.TypeMap.ContainsKey(cTypeStr)) { return; } // retrieve the mapping to munia indices var cType = NintendoSpyMapping.TypeMap[cTypeStr]; Controllers.Add(cType); var mapping = NintendoSpyMapping.ControllerMaps[cType]; foreach (XmlNode xnode in xroot) { // read the background if (xnode.Name == "background") { var bg = new NSpyBackground(); bg.Name = xnode.Attributes["name"].Value; bg.ImagePath = System.IO.Path.Combine(WorkingDir, xnode.Attributes["image"].Value); Backgrounds[bg.Name] = bg; } // read the buttons else if (xnode.Name == "button") { var btn = new Button(); btn.Id = mapping.ButtonMap[xnode.Attributes["name"].Value]; btn.ReadConfig(this, xnode); Buttons.Add(btn); } else if (xnode.Name == "rangebutton") { var btn = new RangeButton(); btn.Id = mapping.AxisMap[xnode.Attributes["name"].Value]; btn.ReadConfig(this, xnode); btn.VisibleFrom = double.Parse(xnode.Attributes["from"].Value); btn.VisibleTo = double.Parse(xnode.Attributes["to"].Value); RangeButtons.Add(btn); } // read the triggers else if (xnode.Name == "analog") { var trigg = new Trigger(); trigg.Id = mapping.AxisMap[xnode.Attributes["name"].Value]; trigg.ReadConfig(this, xnode); string direction = xnode.Attributes["direction"].Value.ToLower(); // nspy reverse/inverse is slightly different, mapping below makes rendering identical to SvgSkin trigg.Orientation = direction == "left" || direction == "right" ? TriggerOrientation.Horizontal : TriggerOrientation.Vertical; // our reverse means filling from left-to-right or bottom-to-top trigg.Reverse = direction == "left" || direction == "up"; if (xnode.Attributes["reverse"] != null) { bool rev = bool.Parse(xnode.Attributes["reverse"].Value); // nspy 'reverse' is our inverse, but should be considered as another flip for right-to-left or bottom-to-top trigg.Reverse ^= rev; trigg.Inverse = rev; } Triggers.Add(trigg); } // read the sticks else if (xnode.Name == "stick") { var stick = new Stick(); if (mapping.AxisMap.ContainsKey(xnode.Attributes["xname"].Value)) { stick.HorizontalAxis = mapping.AxisMap[xnode.Attributes["xname"].Value]; } if (mapping.AxisMap.ContainsKey(xnode.Attributes["yname"].Value)) { stick.VerticalAxis = mapping.AxisMap[xnode.Attributes["yname"].Value]; } stick.ReadConfig(this, xnode); stick.XReverse = bool.Parse(xnode.Attributes["xreverse"]?.Value ?? "false"); stick.YReverse = bool.Parse(xnode.Attributes["yreverse"]?.Value ?? "false"); stick.XRange = int.Parse(xnode.Attributes["xrange"].Value); stick.YRange = int.Parse(xnode.Attributes["yrange"].Value); Sticks.Add(stick); } // read the detail items else if (xnode.Name == "detail") { var detail = new Detail(); detail.ReadConfig(this, xnode); detail.Targets = xnode.Attributes["target"].Value.Split(';').ToList(); Details.Add(detail); } } SelectedBackground = Backgrounds.First().Value; LoadResult = SkinLoadResult.Ok; } catch { } }
public IActionResult ChangeSessionTemperature(string parkCode, Detail tempDetail) { HttpContext.Session.SetString("SessionTemperatureKey", tempDetail.newWeatherMeasurement); return(RedirectToAction("Detail", "Home", new { parkCode = parkCode })); }
protected override void Seed(CrmContext db) { var s1 = new Detail { Name = "Крышка под пружинку", VendorCode = "245-004", Quantity = 1000 }; var s2 = new Detail { Name = "Крышка корпуса", VendorCode = "245-003", Quantity = 1000 }; var s3 = new Detail { Name = "Крышка №", VendorCode = "245-004", Quantity = 1000 }; var s4 = new Detail { Name = "Корпус", VendorCode = "245-004", Quantity = 1000 }; var s5 = new Detail { Name = "Диск Верхний", VendorCode = "245-004", Quantity = 7000 }; var s6 = new Detail { Name = "Диск Нижний", VendorCode = "245-004", Quantity = 7000 }; var s7 = new Detail { Name = "Сетка", VendorCode = "245-004", Quantity = 7000 }; var s8 = new Detail { Name = "Шайба О", VendorCode = "245-004", Quantity = 7000 }; var s9 = new Detail { Name = "Шайба Н", VendorCode = "245-004", Quantity = 7000 }; var s10 = new Detail { Name = "Резинка", VendorCode = "245-004", Quantity = 1000 }; db.Details.Add(s1); db.Details.Add(s2); db.Details.Add(s3); db.Details.Add(s4); db.Details.Add(s5); db.Details.Add(s6); db.Details.Add(s7); db.Details.Add(s8); db.Details.Add(s9); db.Details.Add(s10); var p = new Product { Name = "5200-01" }; db.Products.Add(p); var struc1 = new StructureOfTheProduct { Product = p, Detail = s1, Quantity = 1 }; var struc2 = new StructureOfTheProduct { Product = p, Detail = s2, Quantity = 1 }; var struc3 = new StructureOfTheProduct { Product = p, Detail = s3, Quantity = 1 }; var struc4 = new StructureOfTheProduct { Product = p, Detail = s4, Quantity = 1 }; var struc5 = new StructureOfTheProduct { Product = p, Detail = s5, Quantity = 6 }; var struc6 = new StructureOfTheProduct { Product = p, Detail = s6, Quantity = 6 }; var struc7 = new StructureOfTheProduct { Product = p, Detail = s7, Quantity = 6 }; var struc8 = new StructureOfTheProduct { Product = p, Detail = s8, Quantity = 7 }; var struc9 = new StructureOfTheProduct { Product = p, Detail = s9, Quantity = 6 }; var struc10 = new StructureOfTheProduct { Product = p, Detail = s10, Quantity = 1 }; db.StructureOfTheProducts.Add(struc1); db.StructureOfTheProducts.Add(struc2); db.StructureOfTheProducts.Add(struc3); db.StructureOfTheProducts.Add(struc4); db.StructureOfTheProducts.Add(struc5); db.StructureOfTheProducts.Add(struc6); db.StructureOfTheProducts.Add(struc7); db.StructureOfTheProducts.Add(struc8); db.StructureOfTheProducts.Add(struc9); db.StructureOfTheProducts.Add(struc10); db.SaveChanges(); }
public void addPatientDetail(Detail detailType, Object value) { this.currentPatient.addPatientDetail(detailType, value); }
public void InsertDetail(Detail Detail) { db.InsertRecord(DetailTableName, Detail); }
public static MGLevel FromScene(Scene s, Detail detail) { return(new CrashTeamRacingLoader(s, detail)); }
public void Add(DetailDto detail) { Detail result = _mapper.Map <DetailDto, Detail>(detail); _dalFactory.DetailDal.Add(result); }
public override Abaseguros.Finanzas.SIAC.MessageContracts.VoucherInformationResponse GetVoucherValidation( Abaseguros.Finanzas.SIAC.MessageContracts.VoucherInformationRequest request) { MessageContracts.VoucherInformationResponse objVoucherInformationResponse = new MessageContracts.VoucherInformationResponse(); List <BusinessEntities.ErrorObj> lstErrorObjs = null; DataContracts.ErrorCollectionDC lstErrorCollectionDc = new DataContracts.ErrorCollectionDC(); DataContracts.ErrorDC objErrorDc = null; var objHeader = new Header() { AccountingDate = request.AccountingInformation.Header.AccountingDate, Branch = request.AccountingInformation.Header.Branch, BusinessUnit = request.AccountingInformation.Header.BusinessUnit, RegisterCount = request.AccountingInformation.Header.RegisterCount, RecordType = request.AccountingInformation.Header.RecordType, SourceSystemId = request.AccountingInformation.Header.SourceSystemId }; var lstObjDetails = new List <Detail>(); foreach (var detail in request.AccountingInformation.AccountingDetail) { var addDetail = new Detail() { Affiliate = detail.Affiliate, DepId = detail.DepId, DistributionChannel = detail.DistributionChannel, Function = detail.Function, JrnlLnRef = detail.JrnlLnRef, Ledger = detail.Ledger, LineDescription = detail.LineDescription, Location = detail.Location, Mcc = detail.Mcc, MonetaryAmount = detail.MonetaryAmount, OperatingUnit = detail.OperatingUnit, OriginalAmount = detail.OriginalAmount, OriginalCurrency = detail.OriginalCurrency, PoliceYear = detail.PoliceYear, Product = detail.Product, ProjectId = detail.ProjectId, RegisterId = detail.RegisterId, TransactionCode = detail.TransactionCode, Year = detail.Year, AltAccount = detail.AltAccount, PsAccount = detail.PsAccount }; lstObjDetails.Add(addDetail); } var objAccountingInformation = new AccountingInformation() { Detail = lstObjDetails, Header = objHeader }; lstErrorObjs = _objValidacionSiacBL.GetJournalValidation(objAccountingInformation); foreach (BusinessEntities.ErrorObj objError in lstErrorObjs) { objErrorDc = new DataContracts.ErrorDC(); objErrorDc.ProcessId = objError.ProcessId; objErrorDc.ValidationId = objError.ValidationId; objErrorDc.ErrorDescription = objError.ErrorDescription; objErrorDc.RecordId = objError.RecordId; lstErrorCollectionDc.Add(objErrorDc); } objVoucherInformationResponse.Error = lstErrorCollectionDc; return(objVoucherInformationResponse); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as PaymentReconciliation; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (Request != null) { dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopy(); } if (OutcomeElement != null) { dest.OutcomeElement = (Code <Hl7.Fhir.Model.RemittanceOutcome>)OutcomeElement.DeepCopy(); } if (DispositionElement != null) { dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopy(); } if (Ruleset != null) { dest.Ruleset = (Hl7.Fhir.Model.Coding)Ruleset.DeepCopy(); } if (OriginalRuleset != null) { dest.OriginalRuleset = (Hl7.Fhir.Model.Coding)OriginalRuleset.DeepCopy(); } if (CreatedElement != null) { dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopy(); } if (Period != null) { dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy(); } if (Organization != null) { dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopy(); } if (RequestProvider != null) { dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)RequestProvider.DeepCopy(); } if (RequestOrganization != null) { dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)RequestOrganization.DeepCopy(); } if (Detail != null) { dest.Detail = new List <Hl7.Fhir.Model.PaymentReconciliation.DetailsComponent>(Detail.DeepCopy()); } if (Form != null) { dest.Form = (Hl7.Fhir.Model.Coding)Form.DeepCopy(); } if (Total != null) { dest.Total = (Hl7.Fhir.Model.Money)Total.DeepCopy(); } if (Note != null) { dest.Note = new List <Hl7.Fhir.Model.PaymentReconciliation.NotesComponent>(Note.DeepCopy()); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as PaymentReconciliation; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.FinancialResourceStatusCodes>)StatusElement.DeepCopy(); } if (Period != null) { dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy(); } if (CreatedElement != null) { dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopy(); } if (PaymentIssuer != null) { dest.PaymentIssuer = (Hl7.Fhir.Model.ResourceReference)PaymentIssuer.DeepCopy(); } if (Request != null) { dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopy(); } if (Requestor != null) { dest.Requestor = (Hl7.Fhir.Model.ResourceReference)Requestor.DeepCopy(); } if (OutcomeElement != null) { dest.OutcomeElement = (Code <Hl7.Fhir.Model.ClaimProcessingCodes>)OutcomeElement.DeepCopy(); } if (DispositionElement != null) { dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopy(); } if (PaymentDateElement != null) { dest.PaymentDateElement = (Hl7.Fhir.Model.Date)PaymentDateElement.DeepCopy(); } if (PaymentAmount != null) { dest.PaymentAmount = (Hl7.Fhir.Model.Money)PaymentAmount.DeepCopy(); } if (PaymentIdentifier != null) { dest.PaymentIdentifier = (Hl7.Fhir.Model.Identifier)PaymentIdentifier.DeepCopy(); } if (Detail != null) { dest.Detail = new List <Hl7.Fhir.Model.PaymentReconciliation.DetailsComponent>(Detail.DeepCopy()); } if (FormCode != null) { dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)FormCode.DeepCopy(); } if (ProcessNote != null) { dest.ProcessNote = new List <Hl7.Fhir.Model.PaymentReconciliation.NotesComponent>(ProcessNote.DeepCopy()); } return(dest); }
/// <seealso cref="CommonTM.setHourMinSecondPrecision(int, int, float)"> /// </seealso> /// <throws> DataTypeException if the value is incorrectly formatted. If validation is enabled, this </throws> /// <summary> exception should be thrown at setValue(), but if not, detailed parsing may be deferred until /// this method is called. /// </summary> public virtual void setHourMinSecondPrecision(int hr, int min, float sec) { Detail.setHourMinSecondPrecision(hr, min, sec); }
public EditDetailViewModel(Detail detail) { DetailId = detail.DetailId; Name = detail.Name; }
private static async Task WriteDetail(XmlWriter writer, bool parentIsVisible, Detail detail) { await writer.WriteStartElementAsync(null, XmlTagDetail, null); var showDetail = parentIsVisible & detail.DisplayByDefault; await writer.WriteAttributeStringAsync(null, XmlAttributeShowDetail, null, showDetail.ToString()); if (detail is Failure) { await writer.WriteStartElementAsync(null, XmlTagFailure, null); await writer.WriteStartElementAsync(null, XmlTagException, null); var failure = detail as Failure; await writer.WriteElementStringAsync(null, XmlTagName, null, detail.Name); await writer.WriteElementStringAsync(null, XmlTagType, null, failure.Type.ToString()); await writer.WriteElementStringAsync(null, XmlTagValue, null, failure.Value.ToString()); // Value should contain stack trace for Exceptions await writer.WriteEndElementAsync(); // /Exception await writer.WriteEndElementAsync(); // /Failure } else if (detail.Formatter != null) { await writer.WriteElementStringAsync(null, XmlTagName, null, detail.Name); await writer.WriteElementStringAsync(null, XmlTagValue, null, detail.Formatter(detail.Value)); var mismatch = detail as Mismatch; if (mismatch != null) { await WriteFailureMismatch(writer, mismatch.Name, mismatch.Formatter(mismatch.Value), mismatch.Formatter(mismatch.Actual)); } } else if (detail.Format != null) { await writer.WriteElementStringAsync(null, XmlTagName, null, detail.Name); await writer.WriteElementStringAsync(null, XmlTagValue, null, string.Format(detail.Format, detail.Value)); var mismatch = detail as Mismatch; if (mismatch != null) { await WriteFailureMismatch(writer, mismatch.Name, string.Format(detail.Format, mismatch.Value), string.Format(detail.Format, mismatch.Actual)); } } else { await writer.WriteElementStringAsync(null, XmlTagName, null, detail.Name); await writer.WriteElementStringAsync(null, XmlTagValue, null, $"{detail.Value}"); var mismatch = detail as Mismatch; if (mismatch != null) { await WriteFailureMismatch(writer, mismatch.Name, $"{mismatch.Value}", mismatch.Actual?.ToString()); } } await writer.WriteEndElementAsync(); // /Detail }
/// <seealso cref="CommonTM.setHourMinutePrecision(int, int)"> /// </seealso> /// <throws> DataTypeException if the value is incorrectly formatted. If validation is enabled, this </throws> /// <summary> exception should be thrown at setValue(), but if not, detailed parsing may be deferred until /// this method is called. /// </summary> public virtual void setHourMinutePrecision(int hr, int min) { Detail.setHourMinutePrecision(hr, min); }
public void InsertDetail(Detail detail) { _context.Details.Add(detail); _context.SaveChanges(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { cs.DBCommand dbc = new cs.DBCommand(); //取得基本信息 //if (Request.QueryString["RequestID"] == null) //{ // ErrorHandle("Data Error."); return; //} if (Request.QueryString["RequestID"] != null && Request.QueryString["Type"] != null) { string ID = Request.QueryString["RequestID"].ToString(); string Type = Request.QueryString["Type"].ToString(); System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^\d*$"); if (reg1.IsMatch(ID)) { string sql1 = "select * from V_Eflow_ETravel where RequestID=" + ID + " and [Type]='" + Type + "' order by Step,FlowID"; DataTable dt1 = new DataTable(); dt1 = dbc.GetData("eReimbursement", sql1); if (dt1 != null && dt1.Rows.Count > 0) { //取得明细信息 if (Type == "T") { string sql = "select * from ETraveleDetail where [No]=" + ID + " order by [Tocity],[AccountCode]"; DataTable dtDetail = dbc.GetData("eReimbursement", sql); List<Detail> list = new List<Detail>(); List<DetailAll> listall = new List<DetailAll>(); DataTable dtall = new DataTable(); dtall.Columns.Add("Tocity", typeof(String)); for (int i = 0; i < 11; i++) { dtall.Columns.Add("P" + i.ToString(), typeof(Decimal)); dtall.Columns.Add("C" + i.ToString(), typeof(Decimal)); } for (int i = 0; i < dtDetail.Rows.Count; i++) { if (dtDetail.Rows[i]["AccountCode"].ToString() == "62012023")//Air Ticket - Int'l - Row 1 { bool exi = false; bool exicity = false; foreach (Detail detail in list) { if (detail.Tocity == dtDetail.Rows[i]["Tocity"].ToString() && detail.Row == "0") { detail.Pamount += dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detail.Camount += dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); exi = true; break; } } if (!exi) { Detail detailnew = new Detail(); detailnew.Tocity = dtDetail.Rows[i]["Tocity"].ToString(); detailnew.Row = "0"; detailnew.Cur = dtDetail.Rows[i]["Cur"].ToString(); detailnew.Pamount = dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detailnew.Camount = dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); list.Add(detailnew); } for (int j = 0; j < dtall.Rows.Count; j++) { if (dtDetail.Rows[i]["Tocity"].ToString() == dtall.Rows[j]["Tocity"].ToString()) { exicity = true; break; } } if (!exicity) { DataRow dr = dtall.NewRow(); dr["Tocity"] = dtDetail.Rows[i]["Tocity"].ToString(); dtall.Rows.Add(dr); } } else if (dtDetail.Rows[i]["AccountCode"].ToString() == "62012011" || dtDetail.Rows[i]["AccountCode"].ToString() == "62012021")//Hotel Bill row 2 { bool exi = false; bool exicity = false; foreach (Detail detail in list) { if (detail.Tocity == dtDetail.Rows[i]["Tocity"].ToString() && detail.Row == "2") { detail.Pamount += dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detail.Camount += dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); exi = true; break; } } if (!exi) { Detail detailnew = new Detail(); detailnew.Tocity = dtDetail.Rows[i]["Tocity"].ToString(); detailnew.Row = "2"; detailnew.Cur = dtDetail.Rows[i]["Cur"].ToString(); detailnew.Pamount = dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detailnew.Camount = dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); list.Add(detailnew); } for (int j = 0; j < dtall.Rows.Count; j++) { if (dtDetail.Rows[i]["Tocity"].ToString() == dtall.Rows[j]["Tocity"].ToString()) { exicity = true; break; } } if (!exicity) { DataRow dr = dtall.NewRow(); dr["Tocity"] = dtDetail.Rows[i]["Tocity"].ToString(); dtall.Rows.Add(dr); } } else if (dtDetail.Rows[i]["AccountCode"].ToString() == "62010901" || dtDetail.Rows[i]["AccountCode"].ToString() == "62010910" || dtDetail.Rows[i]["AccountCode"].ToString() == "62010920")//Enter row 4 { bool exi = false; bool exicity = false; foreach (Detail detail in list) { if (detail.Tocity == dtDetail.Rows[i]["Tocity"].ToString() && detail.Row == "4") { detail.Pamount += dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detail.Camount += dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); exi = true; break; } } if (!exi) { Detail detailnew = new Detail(); detailnew.Tocity = dtDetail.Rows[i]["Tocity"].ToString(); detailnew.Row = "4"; detailnew.Cur = dtDetail.Rows[i]["Cur"].ToString(); detailnew.Pamount = dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detailnew.Camount = dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); list.Add(detailnew); } for (int j = 0; j < dtall.Rows.Count; j++) { if (dtDetail.Rows[i]["Tocity"].ToString() == dtall.Rows[j]["Tocity"].ToString()) { exicity = true; break; } } if (!exicity) { DataRow dr = dtall.NewRow(); dr["Tocity"] = dtDetail.Rows[i]["Tocity"].ToString(); dtall.Rows.Add(dr); } } else if (dtDetail.Rows[i]["AccountCode"].ToString() == "62011901" || dtDetail.Rows[i]["AccountCode"].ToString() == "62011910" || dtDetail.Rows[i]["AccountCode"].ToString() == "62011920" || dtDetail.Rows[i]["AccountCode"].ToString() == "62011930" || dtDetail.Rows[i]["AccountCode"].ToString() == "62011940" || dtDetail.Rows[i]["AccountCode"].ToString() == "62012013")//Car row 5 { bool exi = false; bool exicity = false; foreach (Detail detail in list) { if (detail.Tocity == dtDetail.Rows[i]["Tocity"].ToString() && detail.Row == "5") { detail.Pamount += dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detail.Camount += dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); exi = true; break; } } if (!exi) { Detail detailnew = new Detail(); detailnew.Tocity = dtDetail.Rows[i]["Tocity"].ToString(); detailnew.Row = "5"; detailnew.Cur = dtDetail.Rows[i]["Cur"].ToString(); detailnew.Pamount = dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detailnew.Camount = dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); list.Add(detailnew); } for (int j = 0; j < dtall.Rows.Count; j++) { if (dtDetail.Rows[i]["Tocity"].ToString() == dtall.Rows[j]["Tocity"].ToString()) { exicity = true; break; } } if (!exicity) { DataRow dr = dtall.NewRow(); dr["Tocity"] = dtDetail.Rows[i]["Tocity"].ToString(); dtall.Rows.Add(dr); } } else if (dtDetail.Rows[i]["AccountCode"].ToString() == "62010501" || dtDetail.Rows[i]["AccountCode"].ToString() == "62010510" || dtDetail.Rows[i]["AccountCode"].ToString() == "62010520" || dtDetail.Rows[i]["AccountCode"].ToString() == "62010530" || dtDetail.Rows[i]["AccountCode"].ToString() == "62010540" || dtDetail.Rows[i]["AccountCode"].ToString() == "62010550" || dtDetail.Rows[i]["AccountCode"].ToString() == "62010560")//Commu row 6 { bool exi = false; bool exicity = false; foreach (Detail detail in list) { if (detail.Tocity == dtDetail.Rows[i]["Tocity"].ToString() && detail.Row == "6") { detail.Pamount += dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detail.Camount += dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); exi = true; break; } } if (!exi) { Detail detailnew = new Detail(); detailnew.Tocity = dtDetail.Rows[i]["Tocity"].ToString(); detailnew.Row = "6"; detailnew.Cur = dtDetail.Rows[i]["Cur"].ToString(); detailnew.Pamount = dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detailnew.Camount = dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); list.Add(detailnew); } for (int j = 0; j < dtall.Rows.Count; j++) { if (dtDetail.Rows[i]["Tocity"].ToString() == dtall.Rows[j]["Tocity"].ToString()) { exicity = true; break; } } if (!exicity) { DataRow dr = dtall.NewRow(); dr["Tocity"] = dtDetail.Rows[i]["Tocity"].ToString(); dtall.Rows.Add(dr); } } else if (dtDetail.Rows[i]["AccountCode"].ToString() == "62012012")//Local row 7 { bool exi = false; bool exicity = false; foreach (Detail detail in list) { if (detail.Tocity == dtDetail.Rows[i]["Tocity"].ToString() && detail.Row == "7") { detail.Pamount += dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detail.Camount += dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); exi = true; break; } } if (!exi) { Detail detailnew = new Detail(); detailnew.Tocity = dtDetail.Rows[i]["Tocity"].ToString(); detailnew.Row = "7"; detailnew.Cur = dtDetail.Rows[i]["Cur"].ToString(); detailnew.Pamount = dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detailnew.Camount = dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); list.Add(detailnew); } for (int j = 0; j < dtall.Rows.Count; j++) { if (dtDetail.Rows[i]["Tocity"].ToString() == dtall.Rows[j]["Tocity"].ToString()) { exicity = true; break; } } if (!exicity) { DataRow dr = dtall.NewRow(); dr["Tocity"] = dtDetail.Rows[i]["Tocity"].ToString(); dtall.Rows.Add(dr); } } else if (dtDetail.Rows[i]["AccountCode"].ToString() == "62012022")//Oversea row 8 { bool exi = false; bool exicity = false; foreach (Detail detail in list) { if (detail.Tocity == dtDetail.Rows[i]["Tocity"].ToString() && detail.Row == "8") { detail.Pamount += dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detail.Camount += dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); exi = true; break; } } if (!exi) { Detail detailnew = new Detail(); detailnew.Tocity = dtDetail.Rows[i]["Tocity"].ToString(); detailnew.Row = "8"; detailnew.Cur = dtDetail.Rows[i]["Cur"].ToString(); detailnew.Pamount = dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detailnew.Camount = dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); list.Add(detailnew); } for (int j = 0; j < dtall.Rows.Count; j++) { if (dtDetail.Rows[i]["Tocity"].ToString() == dtall.Rows[j]["Tocity"].ToString()) { exicity = true; break; } } if (!exicity) { DataRow dr = dtall.NewRow(); dr["Tocity"] = dtDetail.Rows[i]["Tocity"].ToString(); dtall.Rows.Add(dr); } } else if (dtDetail.Rows[i]["AccountCode"].ToString() == "62020630")//Airport row 9 { bool exi = false; bool exicity = false; foreach (Detail detail in list) { if (detail.Tocity == dtDetail.Rows[i]["Tocity"].ToString() && detail.Row == "9") { detail.Pamount += dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detail.Camount += dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); exi = true; break; } } if (!exi) { Detail detailnew = new Detail(); detailnew.Tocity = dtDetail.Rows[i]["Tocity"].ToString(); detailnew.Row = "9"; detailnew.Cur = dtDetail.Rows[i]["Cur"].ToString(); detailnew.Pamount = dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detailnew.Camount = dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); list.Add(detailnew); } for (int j = 0; j < dtall.Rows.Count; j++) { if (dtDetail.Rows[i]["Tocity"].ToString() == dtall.Rows[j]["Tocity"].ToString()) { exicity = true; break; } } if (!exicity) { DataRow dr = dtall.NewRow(); dr["Tocity"] = dtDetail.Rows[i]["Tocity"].ToString(); dtall.Rows.Add(dr); } } else //else if (dtDetail.Rows[i]["AccountCode"].ToString() == "62012014" || dtDetail.Rows[i]["AccountCode"].ToString() == "62012024")//Others row 10 { bool exi = false; bool exicity = false; foreach (Detail detail in list) { if (detail.Tocity == dtDetail.Rows[i]["Tocity"].ToString() && detail.Row == "10") { detail.Pamount += dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detail.Camount += dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); exi = true; break; } } if (!exi) { Detail detailnew = new Detail(); detailnew.Tocity = dtDetail.Rows[i]["Tocity"].ToString(); detailnew.Row = "10"; detailnew.Cur = dtDetail.Rows[i]["Cur"].ToString(); detailnew.Pamount = dtDetail.Rows[i]["Pamount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Pamount"].ToString()); detailnew.Camount = dtDetail.Rows[i]["Camount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Camount"].ToString()); list.Add(detailnew); } for (int j = 0; j < dtall.Rows.Count; j++) { if (dtDetail.Rows[i]["Tocity"].ToString() == dtall.Rows[j]["Tocity"].ToString()) { exicity = true; break; } } if (!exicity) { DataRow dr = dtall.NewRow(); dr["Tocity"] = dtDetail.Rows[i]["Tocity"].ToString(); dtall.Rows.Add(dr); } } } string sq = ""; foreach (Detail detail in list) { for (int i = 0; i < dtall.Rows.Count; i++) { if (detail.Tocity == dtall.Rows[i]["Tocity"].ToString()) { dtall.Rows[i]["P" + detail.Row] = detail.Pamount; dtall.Rows[i]["C" + detail.Row] = detail.Camount; } } } //组成3*i的Datatable DataTable dtnew = new DataTable(); dtnew.Columns.Add("Tocity", typeof(String)); dtnew.Columns.Add("Pamount", typeof(String));//P0,P1,...,P10 dtnew.Columns.Add("Camount", typeof(String));//C0,C1,...,C10 for (int i = 0; i < dtall.Rows.Count; i++) { DataRow dr = dtnew.NewRow(); dr["Tocity"] = dtall.Rows[i]["Tocity"].ToString(); string Pamount = ""; Pamount += (string.IsNullOrEmpty(dtall.Rows[i]["P0"].ToString()) ? "0" : dtall.Rows[i]["P0"].ToString()) + ","; Pamount += (string.IsNullOrEmpty(dtall.Rows[i]["P1"].ToString()) ? "0" : dtall.Rows[i]["P1"].ToString()) + ","; Pamount += (string.IsNullOrEmpty(dtall.Rows[i]["P2"].ToString()) ? "0" : dtall.Rows[i]["P2"].ToString()) + ","; Pamount += (string.IsNullOrEmpty(dtall.Rows[i]["P3"].ToString()) ? "0" : dtall.Rows[i]["P3"].ToString()) + ","; Pamount += (string.IsNullOrEmpty(dtall.Rows[i]["P4"].ToString()) ? "0" : dtall.Rows[i]["P4"].ToString()) + ","; Pamount += (string.IsNullOrEmpty(dtall.Rows[i]["P5"].ToString()) ? "0" : dtall.Rows[i]["P5"].ToString()) + ","; Pamount += (string.IsNullOrEmpty(dtall.Rows[i]["P6"].ToString()) ? "0" : dtall.Rows[i]["P6"].ToString()) + ","; Pamount += (string.IsNullOrEmpty(dtall.Rows[i]["P7"].ToString()) ? "0" : dtall.Rows[i]["P7"].ToString()) + ","; Pamount += (string.IsNullOrEmpty(dtall.Rows[i]["P8"].ToString()) ? "0" : dtall.Rows[i]["P8"].ToString()) + ","; Pamount += (string.IsNullOrEmpty(dtall.Rows[i]["P9"].ToString()) ? "0" : dtall.Rows[i]["P9"].ToString()) + ","; Pamount += string.IsNullOrEmpty(dtall.Rows[i]["P10"].ToString()) ? "0" : dtall.Rows[i]["P10"].ToString(); dr["Pamount"] = Pamount; string Camount = ""; Camount += (string.IsNullOrEmpty(dtall.Rows[i]["C0"].ToString()) ? "0" : dtall.Rows[i]["C0"].ToString()) + ","; Camount += (string.IsNullOrEmpty(dtall.Rows[i]["C1"].ToString()) ? "0" : dtall.Rows[i]["C1"].ToString()) + ","; Camount += (string.IsNullOrEmpty(dtall.Rows[i]["C2"].ToString()) ? "0" : dtall.Rows[i]["C2"].ToString()) + ","; Camount += (string.IsNullOrEmpty(dtall.Rows[i]["C3"].ToString()) ? "0" : dtall.Rows[i]["C3"].ToString()) + ","; Camount += (string.IsNullOrEmpty(dtall.Rows[i]["C4"].ToString()) ? "0" : dtall.Rows[i]["C4"].ToString()) + ","; Camount += (string.IsNullOrEmpty(dtall.Rows[i]["C5"].ToString()) ? "0" : dtall.Rows[i]["C5"].ToString()) + ","; Camount += (string.IsNullOrEmpty(dtall.Rows[i]["C6"].ToString()) ? "0" : dtall.Rows[i]["C6"].ToString()) + ","; Camount += (string.IsNullOrEmpty(dtall.Rows[i]["C7"].ToString()) ? "0" : dtall.Rows[i]["C7"].ToString()) + ","; Camount += (string.IsNullOrEmpty(dtall.Rows[i]["C8"].ToString()) ? "0" : dtall.Rows[i]["C8"].ToString()) + ","; Camount += (string.IsNullOrEmpty(dtall.Rows[i]["C9"].ToString()) ? "0" : dtall.Rows[i]["C9"].ToString()) + ","; Camount += string.IsNullOrEmpty(dtall.Rows[i]["C10"].ToString()) ? "0" : dtall.Rows[i]["C10"].ToString(); dr["Camount"] = Camount; dtnew.Rows.Add(dr); } // DataTable dt = new DataTable(); dt.Columns.Add("Row", typeof(Int32)); for (int i = 0; i < 4; i++) { dt.Columns.Add("Station" + i.ToString(), typeof(String)); dt.Columns.Add("Station" + i.ToString() + "_P", typeof(String)); dt.Columns.Add("Station" + i.ToString() + "_C", typeof(String)); } for (int i = 0; i < dtnew.Rows.Count / 4 + (dtnew.Rows.Count % 4 == 0 ? 0 : 1); i++) { int index = 0; DataRow dr = dt.NewRow(); dr["Row"] = i; for (int j = 0 + i * 4; j < (dtnew.Rows.Count <= (i + 1) * 4 ? dtnew.Rows.Count : (i + 1) * 4); j++) { dr["Station" + index.ToString()] = dtnew.Rows[j]["Tocity"].ToString(); dr["Station" + index.ToString() + "_P"] = dtnew.Rows[j]["Pamount"].ToString(); dr["Station" + index.ToString() + "_C"] = dtnew.Rows[j]["Camount"].ToString(); index++; } dt.Rows.Add(dr); } for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["Station0"].ToString() == "") { dt.Rows[i]["Station0_P"] = "0,0,0,0,0,0,0,0,0,0,0"; dt.Rows[i]["Station0_C"] = "0,0,0,0,0,0,0,0,0,0,0"; } if (dt.Rows[i]["Station1"].ToString() == "") { dt.Rows[i]["Station1_P"] = "0,0,0,0,0,0,0,0,0,0,0"; dt.Rows[i]["Station1_C"] = "0,0,0,0,0,0,0,0,0,0,0"; } if (dt.Rows[i]["Station2"].ToString() == "") { dt.Rows[i]["Station2_P"] = "0,0,0,0,0,0,0,0,0,0,0"; dt.Rows[i]["Station2_C"] = "0,0,0,0,0,0,0,0,0,0,0"; } if (dt.Rows[i]["Station3"].ToString() == "") { dt.Rows[i]["Station3_P"] = "0,0,0,0,0,0,0,0,0,0,0"; dt.Rows[i]["Station3_C"] = "0,0,0,0,0,0,0,0,0,0,0"; } } //获取审批流程 DataTable dtFlow = new DataTable(); dtFlow.Columns.Add("Row",typeof(String)); dtFlow.Columns.Add("SubmitPerson", typeof(String)); dtFlow.Columns.Add("SubmitDate", typeof(String)); for (int i = 0; i < 5; i++) { dtFlow.Columns.Add("Approver" + i.ToString()); dtFlow.Columns.Add("Approver" + i.ToString() + "_Date"); } if (dt1.Rows[0]["Step"].ToString() == "0")//草稿 { DataRow dr = dtFlow.NewRow(); dr[0] = "0"; dr[1] = "Submitted by:"; dtFlow.Rows.Add(dr); } else//已正式申请 { for (int i = 0; i < dt1.Rows.Count; i++) { if (dt1.Rows[i]["Active"].ToString() == "2") { for (int j = dt1.Rows.Count - 1; j > i; j--) { dt1.Rows.RemoveAt(j); } break; } } for (int i = 0; i < dt1.Rows.Count / 5 + (dt1.Rows.Count % 5 == 0 ? 0 : 1); i++) { int index = 0; DataRow dr = dtFlow.NewRow(); dr["Row"] = i; if (i == 0)//只在第一行显示一次提单人Submitted by { dr["SubmitPerson"] = "Submitted by:\n" + dt1.Rows[0]["CreadedBy"].ToString(); dr["SubmitDate"] = dt1.Rows[0]["CreadedDate"].ToString() == "" ? "" : Convert.ToDateTime(dt1.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd"); } for (int j = 0 + i * 5; j < ((i + 1) * 5 > dt1.Rows.Count ? dt1.Rows.Count : (i + 1) * 5); j++)// { if (dt1.Rows[j]["Status"].ToString()=="1") { string msg1 = ""; if (dt1.Rows[j]["FlowFn"].ToString().ToLower() == "verifier") { msg1 = ". To Be Verify:"; } else if (dt1.Rows[j]["FlowFn"].ToString().ToLower() == "issuer") { msg1 = ". To Be Issue:"; } else { msg1 = ". Waiting for Approval:"; } dr["Approver" + index.ToString()] = (j + 1).ToString() +msg1+ "\n" + dt1.Rows[j]["Approver"].ToString(); //dr["Approver" + index.ToString() + "_Date"] = dt1.Rows[j]["ApproveDate"].ToString() == "" ? "Pending" : Convert.ToDateTime(dt1.Rows[j]["ApproveDate"].ToString()).ToString("yyyy/MM/dd"); } else if (dt1.Rows[j]["Status"].ToString() == "2") { string msg1 = ""; if (dt1.Rows[j]["FlowFn"].ToString().ToLower() == "verifier") { msg1 = ". Verified by:"; } else if (dt1.Rows[j]["FlowFn"].ToString().ToLower() == "issuer") { msg1 = ". Issued by:"; } else { msg1 = ". Approved by:"; } if (dt1.Rows[j]["Active"].ToString() == "2") { dr["Approver" + index.ToString()] = (j + 1).ToString() +msg1+ "\n" + dt1.Rows[j]["Approver"].ToString(); dr["Approver" + index.ToString() + "_Date"] = dt1.Rows[j]["ApproveDate"].ToString() == "" ? "" : ("(Complete)" + Convert.ToDateTime(dt1.Rows[j]["ApproveDate"].ToString()).ToString("yyyy/MM/dd")); } else { dr["Approver" + index.ToString()] = (j + 1).ToString() +msg1+ "\n" + dt1.Rows[j]["Approver"].ToString(); dr["Approver" + index.ToString() + "_Date"] = dt1.Rows[j]["ApproveDate"].ToString() == "" ? "" : Convert.ToDateTime(dt1.Rows[j]["ApproveDate"].ToString()).ToString("yyyy/MM/dd"); } } else { dr["Approver" + index.ToString()] = (j + 1).ToString() + ". Rejected by:\n" + dt1.Rows[j]["Approver"].ToString(); dr["Approver" + index.ToString() + "_Date"] = dt1.Rows[j]["ApproveDate"].ToString() == "" ? "" : ("(Complete)" + Convert.ToDateTime(dt1.Rows[j]["ApproveDate"].ToString()).ToString("yyyy/MM/dd")); } index++; } dtFlow.Rows.Add(dr); } } ReportViewer1.ProcessingMode = ProcessingMode.Local; //控制导出格式 RenderingExtension[] resut = ReportViewer1.LocalReport.ListRenderingExtensions(); foreach (RenderingExtension item in ReportViewer1.LocalReport.ListRenderingExtensions()) { // item 具有Visable属性,但是这个属性是只读属性,不能修改,所以通过反射进行了修改 if (item.Name.ToUpper() == "PDF") { // 显示excel2003格式导出按钮 FieldInfo fi = item.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic); fi.SetValue(item, true); } else { FieldInfo fi = item.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic); fi.SetValue(item, false); } } ReportViewer1.LocalReport.ReportPath = MapPath("~/rdlc/ReportT.rdlc"); ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource rds = new ReportDataSource("DataSet1", dt); ReportViewer1.LocalReport.DataSources.Add(rds); ReportDataSource rds2 = new ReportDataSource("DataSet2", dtFlow); ReportViewer1.LocalReport.DataSources.Add(rds2); ReportParameter rpCur = new ReportParameter("Currency", dt1.Rows[0]["Cur"].ToString()); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rpCur }); ReportParameter rp = new ReportParameter("Person", dt1.Rows[0]["Person"].ToString()); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); string budget = dt1.Rows[0]["Budget"].ToString() == "1" ? "Budget" : "UnBudget"; ReportParameter rpBudget = new ReportParameter("Budget", budget); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rpBudget }); string bb = ""; if (dt1.Rows[0]["Bdate"].ToString() != "") { bb += Convert.ToDateTime(dt1.Rows[0]["Bdate"].ToString()).ToString("yyyy/MM/dd"); } if (dt1.Rows[0]["Edate"].ToString() != "") { bb += " - " + Convert.ToDateTime(dt1.Rows[0]["Edate"].ToString()).ToString("yyyy/MM/dd"); } ReportParameter rpTravelPeriod = new ReportParameter("Period", bb); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rpTravelPeriod }); ReportViewer1.LocalReport.Refresh(); } else if (Type == "G") { string aName = ""; if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") { aName = "ADes"; } else { aName = "SAccountName"; } string sql = "select [AName]=t2." + aName + ",CONVERT(varchar, Tdate, 111) as Tdate1,t1.ID,t1.Type,t1.Amount,t1.TSation,t1.Fcity,t1.Tcity,t1.Ecompany,t1.Eperson,CONVERT(varchar, t1.EffectTime, 111) as ET,t1.Months,t1.AccountDes from (select * from EeommonDetail where [No]='" + ID + "') t1 left join AccoundCode t2 on t2.SAccountCode=t1.AccountCode order by [Type],[AccountCode]"; DataTable dtDetail = new DataTable(); dtDetail = dbc.GetData("eReimbursement", sql); DataTable dt = new DataTable(); dt.Columns.Add("AName",typeof(String)); dt.Columns.Add("Tdate1", typeof(String)); dt.Columns.Add("ID", typeof(String)); dt.Columns.Add("Type", typeof(String)); dt.Columns.Add("Amount", typeof(String)); dt.Columns.Add("TSation", typeof(String)); dt.Columns.Add("Fcity", typeof(String)); dt.Columns.Add("Tcity", typeof(String)); dt.Columns.Add("Ecompany", typeof(String)); dt.Columns.Add("Eperson", typeof(String)); dt.Columns.Add("Months", typeof(String)); dt.Columns.Add("AccountDes", typeof(String)); dt.Columns.Add("Mark", typeof(String)); //int ECount = 0; int TCount = 0; int CCount = 0; int OCount = 0; decimal total = 0; for (int i = 0; i < dtDetail.Rows.Count; i++) { total += dtDetail.Rows[i]["Amount"].ToString() == "" ? 0 : Convert.ToDecimal(dtDetail.Rows[i]["Amount"].ToString()); //添加分类标题行 if (dtDetail.Rows[i]["Type"].ToString() == "E") { if (i == 0 || (dtDetail.Rows[i - 1]["Type"].ToString() != "E")) { DataRow dr = dt.NewRow(); dr["ID"] = "E1"; dr["AName"] = "Entertainment:"; dr["Amount"] = "0"; dr["Mark"] = "-1"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["ID"] = "E2"; dr["AName"] = "Expense Type"; dr["Tdate1"] = "Date"; dr["Type"] = ""; dr["Amount"] = "0"; dr["TSation"] = "Collection Station"; dr["Fcity"] = ""; dr["Tcity"] = ""; dr["Ecompany"] = "Customer"; dr["Eperson"] = "Guest"; dr["Months"] = ""; dr["AccountDes"] = "Remark"; dr["Mark"] = "-1"; dt.Rows.Add(dr); } } else if (dtDetail.Rows[i]["Type"].ToString() == "T") { if (i == 0 || (dtDetail.Rows[i - 1]["Type"].ToString() != "T")) { DataRow dr = dt.NewRow(); dr["ID"] = "T1"; dr["AName"] = "Transportation:"; dr["Amount"] = "0"; dr["Mark"] = "-1"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["ID"] = "T2"; dr["AName"] = "Expense Type"; dr["Tdate1"] = "Date"; dr["Type"] = ""; dr["Amount"] = "0"; dr["TSation"] = "Collection Station"; dr["Fcity"] = ""; dr["Tcity"] = ""; dr["Ecompany"] = "From"; dr["Eperson"] = "To"; dr["Months"] = ""; dr["AccountDes"] = "Remark"; dt.Rows.Add(dr); } } else if (dtDetail.Rows[i]["Type"].ToString() == "C") { if (i == 0 || (dtDetail.Rows[i - 1]["Type"].ToString() != "C")) { DataRow dr = dt.NewRow(); dr["ID"] = "C1"; dr["AName"] = "Communication:"; dr["Amount"] = "0"; dr["Mark"] = "-1"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["ID"] = "C2"; dr["AName"] = "Expense Type"; dr["Tdate1"] = "Period"; dr["Type"] = ""; dr["Amount"] = "0"; dr["TSation"] = "Collection Station"; dr["Fcity"] = ""; dr["Tcity"] = ""; dr["Ecompany"] = ""; dr["Eperson"] = ""; dr["Months"] = ""; dr["AccountDes"] = "Remark"; dr["Mark"] = "-1"; dt.Rows.Add(dr); } } else { if (i == 0 || (dtDetail.Rows[i - 1]["Type"].ToString() != "O")) { DataRow dr = dt.NewRow(); dr["ID"] = "O1"; dr["AName"] = "Others:"; dr["Amount"] = "0"; dr["Mark"] = "-1"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["ID"] = "O2"; dr["AName"] = "Expense Type"; dr["Tdate1"] = "Date"; dr["Type"] = ""; dr["Amount"] = "0"; dr["TSation"] = "Collection Station"; dr["Fcity"] = ""; dr["Tcity"] = ""; dr["Ecompany"] = ""; dr["Eperson"] = ""; dr["Months"] = ""; dr["AccountDes"] = "Remark"; dt.Rows.Add(dr); } } DataRow drdetail = dt.NewRow(); drdetail["AName"] = dtDetail.Rows[i]["AName"].ToString(); if (dtDetail.Rows[i]["Type"].ToString() == "C") { drdetail["Tdate1"] = dtDetail.Rows[i]["ET"].ToString(); } else { drdetail["Tdate1"] = dtDetail.Rows[i]["Tdate1"].ToString(); } drdetail["ID"] = dtDetail.Rows[i]["ID"].ToString(); drdetail["Type"] = dtDetail.Rows[i]["Type"].ToString(); drdetail["Amount"] = dtDetail.Rows[i]["Amount"].ToString(); drdetail["TSation"] = dtDetail.Rows[i]["TSation"].ToString(); drdetail["Fcity"] = dtDetail.Rows[i]["Fcity"].ToString(); drdetail["Tcity"] = dtDetail.Rows[i]["Tcity"].ToString(); drdetail["Ecompany"] = dtDetail.Rows[i]["Ecompany"].ToString(); drdetail["Eperson"] = dtDetail.Rows[i]["Eperson"].ToString(); drdetail["Months"] = dtDetail.Rows[i]["Months"].ToString(); drdetail["AccountDes"] = dtDetail.Rows[i]["AccountDes"].ToString(); dt.Rows.Add(drdetail); //if (dtDetail.Rows[i]["Type"].ToString() == "E") //{ // ECount++; //} //else if (dtDetail.Rows[i]["Type"].ToString() == "T") //{ // TCount++; //} //else if (dtDetail.Rows[i]["Type"].ToString() == "C") //{ // CCount++; //} //else //{ // OCount++; //} } //获取审批流程 DataTable dtFlow = new DataTable(); dtFlow.Columns.Add("Row", typeof(String)); dtFlow.Columns.Add("SubmitPerson", typeof(String)); dtFlow.Columns.Add("SubmitDate", typeof(String)); for (int i = 0; i < 6; i++) { dtFlow.Columns.Add("Approver" + i.ToString()); dtFlow.Columns.Add("Approver" + i.ToString() + "_Date"); } if (dt1.Rows[0]["Step"].ToString() == "0")//草稿 { DataRow dr = dtFlow.NewRow(); dr[0] = "0"; dr[1] = "Submitted by:"; dtFlow.Rows.Add(dr); } else//已正式申请 { for (int i = 0; i < dt1.Rows.Count; i++) { if (dt1.Rows[i]["Active"].ToString() == "2") { for (int j = dt1.Rows.Count - 1; j > i; j--) { dt1.Rows.RemoveAt(j); } break; } } for (int i = 0; i < dt1.Rows.Count / 6 + (dt1.Rows.Count % 6 == 0 ? 0 : 1); i++) { int index = 0; DataRow dr = dtFlow.NewRow(); dr["Row"] = i; if (i == 0)//只在第一行显示一次提单人Submitted by { dr["SubmitPerson"] = "Submitted by:\n" + dt1.Rows[0]["CreadedBy"].ToString(); dr["SubmitDate"] = dt1.Rows[0]["CreadedDate"].ToString() == "" ? "" : Convert.ToDateTime(dt1.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd"); } for (int j = 0 + i * 6; j < ((i + 1) * 6 > dt1.Rows.Count ? dt1.Rows.Count : (i + 1) * 6); j++)// { if (dt1.Rows[j]["Status"].ToString() == "1") { string msg1 = ""; if (dt1.Rows[j]["FlowFn"].ToString().ToLower() == "verifier") { msg1 = ". To Be Verify:"; } else if (dt1.Rows[j]["FlowFn"].ToString().ToLower() == "issuer") { msg1 = ". To Be Issue:"; } else { msg1 = ". Waiting for Approval:"; } dr["Approver" + index.ToString()] = (j + 1).ToString() +msg1+ "\n" + dt1.Rows[j]["Approver"].ToString(); //dr["Approver" + index.ToString() + "_Date"] = dt1.Rows[j]["ApproveDate"].ToString() == "" ? "Pending" : Convert.ToDateTime(dt1.Rows[j]["ApproveDate"].ToString()).ToString("yyyy/MM/dd"); } else if (dt1.Rows[j]["Status"].ToString() == "2") { string msg1 = ""; if (dt1.Rows[j]["FlowFn"].ToString().ToLower() == "verifier") { msg1 = ". Verified by:"; } else if (dt1.Rows[j]["FlowFn"].ToString().ToLower() == "issuer") { msg1 = ". Issued by:"; } else { msg1 = ". Approved by:"; } if (dt1.Rows[j]["Active"].ToString() == "2") { dr["Approver" + index.ToString()] = (j + 1).ToString() +msg1+ "\n" + dt1.Rows[j]["Approver"].ToString(); dr["Approver" + index.ToString() + "_Date"] = dt1.Rows[j]["ApproveDate"].ToString() == "" ? "" : ("(Complete)" + Convert.ToDateTime(dt1.Rows[j]["ApproveDate"].ToString()).ToString("yyyy/MM/dd")); } else { dr["Approver" + index.ToString()] = (j + 1).ToString() +msg1+ "\n" + dt1.Rows[j]["Approver"].ToString(); dr["Approver" + index.ToString() + "_Date"] = dt1.Rows[j]["ApproveDate"].ToString() == "" ? "" : Convert.ToDateTime(dt1.Rows[j]["ApproveDate"].ToString()).ToString("yyyy/MM/dd"); } } else { dr["Approver" + index.ToString()] = (j + 1).ToString() + ". Rejected by:\n" + dt1.Rows[j]["Approver"].ToString(); dr["Approver" + index.ToString() + "_Date"] = dt1.Rows[j]["ApproveDate"].ToString() == "" ? "" : ("(Complete)" + Convert.ToDateTime(dt1.Rows[j]["ApproveDate"].ToString()).ToString("yyyy/MM/dd")); } index++; } dtFlow.Rows.Add(dr); } } ReportViewer1.ProcessingMode = ProcessingMode.Local; //控制导出格式 RenderingExtension[] resut = ReportViewer1.LocalReport.ListRenderingExtensions(); foreach (RenderingExtension item in ReportViewer1.LocalReport.ListRenderingExtensions()) { // item 具有Visable属性,但是这个属性是只读属性,不能修改,所以通过反射进行了修改 if (item.Name.ToUpper() == "PDF") { // 显示excel2003格式导出按钮 FieldInfo fi = item.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic); fi.SetValue(item, true); } else { FieldInfo fi = item.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic); fi.SetValue(item, false); } } ReportViewer1.LocalReport.ReportPath = MapPath("~/rdlc/ReportG1.rdlc"); ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource rds = new ReportDataSource("DataSet1", dt); ReportViewer1.LocalReport.DataSources.Add(rds); ReportDataSource rds2 = new ReportDataSource("DataSet2", dtFlow); ReportViewer1.LocalReport.DataSources.Add(rds2); ReportParameter rpCur = new ReportParameter("Currency", dt1.Rows[0]["Cur"].ToString()); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rpCur }); ReportParameter rp = new ReportParameter("Person", dt1.Rows[0]["Person"].ToString()); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); ReportParameter rpMonth = new ReportParameter("Month", dt1.Rows[0]["Month"].ToString()); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rpMonth }); ReportParameter rpSum = new ReportParameter("Sum", total.ToString()); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rpSum }); ReportParameter rpRows = new ReportParameter("Rows", dt.Rows.Count.ToString()); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rpRows }); ReportParameter rpDepartment = new ReportParameter("Department", dt1.Rows[0]["Department"].ToString() + " @ " + dt1.Rows[0]["Station"].ToString()); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rpDepartment }); string budget = dt1.Rows[0]["Budget"].ToString() == "1" ? "Budget" : "UnBudget"; ReportParameter rpBudget = new ReportParameter("Budget", budget); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rpBudget }); ReportViewer1.LocalReport.Refresh(); } } } } } }
private List<List<Link>> GetRoutes(List<Link> route, Detail start, Detail end, int depth) { List<List<Link>> routeList = new List<List<Link>>(); List<Link> linkList = start.RelatedWith.ToList(); foreach (var link in linkList) { if (route.Count(x => x.From == link.To) == 0) { if (link.To == end || !link.Trust) { List<Link> clone = new List<Link>(route) { link }; routeList.Add(clone); } else { if (route.Count() < depth) { List<Link> clone = new List<Link>(route) { link }; routeList.AddRange(GetRoutes(clone, link.To, end, depth)); } } } } return routeList; }
/// <summary> /// Обработка нажатия клавиш [Enter] и [Up] в DataGrid поиска сущностей /// </summary> private void SearchDataGrid_OnPreviewKeyUp(object senderIsDataGrid, KeyEventArgs eventArgs) { const int startOfListIndex = 0; // DataGrid поиска сущности var searchDataGrid = senderIsDataGrid as DataGrid; if (searchDataGrid == null) { return; } // Grid-обёртка DataGrid и TextBox поиска var searchWrapperGrid = VisualTreeHelper.GetParent(searchDataGrid) as Grid; if (searchWrapperGrid == null) { return; } // TextBox поиска/добавления var searchTextBox = searchWrapperGrid.Children.OfType <TextBox>().FirstOrDefault(); if (searchTextBox == null) { return; } // Если фокус ввода на первой записи DataGrid и нажата [Up] - перевод клавиатурного фокуса ввода к TextBox if (startOfListIndex == searchDataGrid.SelectedIndex && eventArgs.Key == Key.Up) { searchTextBox.Focus(); } // Если записей не 0 и нажат [Enter] - заносим текст объекта в TextBox и переводим фокус к след. контролу else if (searchDataGrid.Items.Count > 0 && eventArgs.Key == Key.Enter) { // Выбранная строка (объект) DataGrid поиска сущности var rawSelectedItem = searchDataGrid.SelectedItem; if (rawSelectedItem == null) { return; } string displayed; var selectedItemType = rawSelectedItem.GetType(); if (selectedItemType == typeof(Product)) // Если тип найденой сущности: [Изделие] { _selectedProduct = (Product)rawSelectedItem; displayed = _selectedProduct.DisplayCodeString; } else if (selectedItemType == typeof(Detail)) // Если тип найденой сущности: [Деталь] { _selectedDetail = (Detail)rawSelectedItem; displayed = _selectedDetail.CodeDetail.ToString(); } else { displayed = rawSelectedItem.ToString(); } // Вывод выбраного значения в TextBox поиска/добавления searchTextBox.Text = displayed; // Перевод фокуса ввода на нижележащий визуальный элемент после [DataGrid] поиска сущности var request = new TraversalRequest(FocusNavigationDirection.Down) { Wrapped = false }; eventArgs.Handled = true; if (searchDataGrid.MoveFocus(request)) { searchDataGrid.Visibility = Visibility.Collapsed; } } }
private void LoadCrashTeamRacingScene(Scene s, Detail detail) { List <VertexPositionColorTexture> monolist = new List <VertexPositionColorTexture>(); List <CTRFramework.Vertex> vts = new List <Vertex>(); switch (detail) { case Detail.Low: { Console.WriteLine("doin low"); foreach (QuadBlock qb in s.quads) { monolist.Clear(); vts = qb.GetVertexListq(s.verts, -1); if (vts != null) { foreach (Vertex cv in vts) { monolist.Add(DataConverter.ToVptc(cv, cv.uv)); } TextureLayout t = qb.texlow; string texTag = t.Tag(); foreach (QuadFlags fl in (QuadFlags[])Enum.GetValues(typeof(QuadFlags))) { if (qb.quadFlags.HasFlag(fl)) { Push(flagq, fl.ToString(), monolist, "flag"); } } if (qb.isWater) { Push(waterq, "water", monolist); continue; } if (qb.quadFlags.HasFlag(QuadFlags.InvisibleTriggers)) { Push(flagq, "invis", monolist); continue; } if (ContentVault.alphalist.Contains(texTag)) { Push(alphaq, texTag, monolist); } else { Push(normalq, texTag, monolist); } } } break; } case Detail.Med: { Console.WriteLine("doin med"); foreach (QuadBlock qb in s.quads) { for (int j = 0; j < 4; j++) { monolist.Clear(); vts = qb.GetVertexListq(s.verts, j); if (vts != null) { foreach (Vertex cv in vts) { monolist.Add(DataConverter.ToVptc(cv, cv.uv)); } bool isAnimated = false; string texTag = "test"; if (qb.ptrTexMid[j] != UIntPtr.Zero) { isAnimated = qb.tex[j].isAnimated; if (texTag != "00000000") { texTag = qb.tex[j].midlods[2].Tag(); } } foreach (QuadFlags fl in (QuadFlags[])Enum.GetValues(typeof(QuadFlags))) { if (qb.quadFlags.HasFlag(fl)) { Push(flagq, fl.ToString(), monolist, "flag"); } } if (qb.isWater) { Push(waterq, "water", monolist); continue; } if (qb.quadFlags.HasFlag(QuadFlags.InvisibleTriggers)) { Push(flagq, "invis", monolist); continue; } Push((isAnimated ? animatedq : (ContentVault.alphalist.Contains(texTag) ? alphaq : normalq)), texTag, monolist); if (isAnimated) { animatedq[texTag].ScrollingEnabled = true; } } } } break; } } Seal(); }
private void RemoveDetail(Detail detail) { _context.Links.RemoveRange(detail.RelatedWith); _context.Details.Remove(detail); }
/// <summary> /// Обработка нажатия мышки на строку DataGrid поиска сущностей /// </summary> private void SearchDataGrid_OnPreviewMouseDown(object senderIsDataGrid, MouseButtonEventArgs eventArgs) { // DataGrid поиска сущности var searchDataGrid = senderIsDataGrid as DataGrid; if (searchDataGrid == null) { return; } // Grid-обёртка DataGrid и TextBox поиска var searchWrapperGrid = VisualTreeHelper.GetParent(searchDataGrid) as Grid; if (searchWrapperGrid == null) { return; } // TextBox поиска/добавления var searchTextBox = searchWrapperGrid.Children.OfType <TextBox>().FirstOrDefault(); if (searchTextBox == null) { return; } // Выбранная строка (объект) DataGrid поиска сущности var rawSelectedItem = searchDataGrid.SelectedItem; if (rawSelectedItem == null) { return; } string displayed; var selectedItemType = rawSelectedItem.GetType(); if (selectedItemType == typeof(Product)) // Если тип найденой сущности: [Изделие] { _selectedProduct = (Product)rawSelectedItem; displayed = _selectedProduct.DisplayCodeString; } else if (selectedItemType == typeof(Detail)) // Если тип найденой сущности: [Деталь] { _selectedDetail = (Detail)rawSelectedItem; displayed = _selectedDetail.CodeDetail.ToString(); } else { displayed = rawSelectedItem.ToString(); } // Вывод выбраного значения в TextBox поиска/добавления searchTextBox.Text = displayed; // Перевод фокуса ввода на нижележащий визуальный элемент после [DataGrid] поиска сущности var request = new TraversalRequest(FocusNavigationDirection.Down) { Wrapped = false }; eventArgs.Handled = true; if (searchDataGrid.MoveFocus(request)) { searchDataGrid.Visibility = Visibility.Collapsed; } }
private bool EditDetail(Detail detail) { using (var editForm = new EditForm(_context, detail)) { var res = editForm.ShowDialog(); if (res == DialogResult.OK) { return true; } var entry = _context.Entry(detail); if (entry.State == EntityState.Modified) { entry.CurrentValues.SetValues(entry.OriginalValues); bsDetails.CancelEdit(); } } return false; }
public static bool Get(StateObject state, int length) { byte[] packet = new byte[length]; Array.Copy(state.buffer, 0, packet, 0, length); if (length < Constants.VALUE.LENGTH_TOTAL || state.buffer[0] != Constants.VALUE.STX || state.buffer[length - 1] != Constants.VALUE.ETX) { return(true); } byte[] cut = new byte[length - 4]; Array.Copy(packet, 1, cut, 0, length - 4); byte[] crc_result = BitConverter.GetBytes(Convertion.Crc16.CalcCRC(cut)); if (Server.DebugLevel > 2) { Server.print(2, "Receive Data - " + Convertion.ByteArrayToHexString(packet)); } if (packet[length - 3] != crc_result[1] && packet[length - 2] != crc_result[0]) { if (Server.DebugLevel > 2) { Server.print(2, "CRC eRROR"); } return(true); } byte[] unit_type = new byte[0], unit_placeid = new byte[0], unit_deviceid = new byte[0]; byte[] unit_ins = new byte[0], unit_ml = new byte[0]; string units_type = "", units_placeid = "", units_deviceid = "", units_ins = "", units_ml = ""; try { unit_type = Convertion.ArraySortCopy(packet, Constants.INDEX.Type, Constants.LENGTH.Type); unit_placeid = Convertion.ArraySortCopy(packet, Constants.INDEX.PlaceID, Constants.LENGTH.PlaceID); unit_deviceid = Convertion.ArraySortCopy(packet, Constants.INDEX.DeviceID, Constants.LENGTH.DeviceID); unit_ins = Convertion.ArraySortCopy(packet, Constants.INDEX.INS, Constants.LENGTH.INS); unit_ml = Convertion.ArraySortCopy(packet, Constants.INDEX.ML, Constants.LENGTH.ML); units_type = Convertion.ReverseArrayBitConvertInt(unit_type).ToString(); units_placeid = Encoding.ASCII.GetString(unit_placeid); units_deviceid = Convertion.ReverseArrayBitConvertInt(unit_deviceid).ToString(); units_ins = Encoding.ASCII.GetString(unit_ins); units_ml = Convertion.ReverseArrayBitConvertInt(unit_ml).ToString(); } catch (Exception) { if (Server.DebugLevel > 2) { Server.print(2, Detail.get(state, Detail.TYPE.Addr) + " - Unrecognized Packets"); } return(true); } if (Server.DebugLevel > 2) { Convertion.Temp_PacketPrintHeader(packet); Server.print(2, "CRC oK"); } if (units_ins != "a1" && !state.thru) { if (Server.DebugLevel > 2) { Server.print(2, Detail.get(state, Detail.TYPE.Addr) + " - proceed without approval."); } return(false); } string[] data = new string[] { units_placeid, units_deviceid, Detail.get(state, Detail.TYPE.Addr), units_ins }; Database.Charger.Record.LeaveDataRaw(false, data, packet, false); switch (units_ins) { case "a1": state.thru = true; Detail.set(state, Detail.TYPE.Type, units_type); Detail.set(state, Detail.TYPE.PlaceID, units_placeid); Detail.set(state, Detail.TYPE.DeviceID, units_deviceid); Server.print(0, Detail.get(state, Detail.TYPE.Addr) + " is vertify success - " + units_placeid + ", " + units_deviceid); data = new string[] { "1a" }; DataSend.Get(state, data); Database.Charger.Session.Join(state); return(true); default: return(true); } }
public static void Main(String[] args) { IDatabase db = DatabaseFactory.CreateDatabase(); Supplier supplier; Detail detail; Order order; Order[] orders; Projection<Detail,Order> d2o = new Projection<Detail,Order>("orders"); Projection<Supplier,Order> s2o = new Projection<Supplier,Order>("orders"); int i; db.Open("testsod.dbs"); TestSOD root = (TestSOD)db.Root; if (root == null) { root = new TestSOD(); root.supplierName = db.CreateFieldIndex<string, Supplier>("name", IndexType.Unique); root.detailId = db.CreateFieldIndex<string, Detail>("id", IndexType.Unique); db.Root = root; } while (true) { try { switch ((int)inputLong("-------------------------------------\n" + "Menu:\n" + "1. Add supplier\n" + "2. Add detail\n" + "3. Add Order\n" + "4. List of suppliers\n" + "5. List of details\n" + "6. Suppliers of detail\n" + "7. Details shipped by supplier\n" + "8. Orders for detail of supplier\n" + "9. Exit\n\n>>")) { case 1: supplier = new Supplier(); supplier.name = input("Supplier name: "); supplier.location = input("Supplier location: "); supplier.orders = db.CreateRelation<Order,Supplier>(supplier); root.supplierName.Put(supplier); db.Commit(); continue; case 2: detail = new Detail(); detail.id = input("Detail id: "); detail.weight = (float)inputDouble("Detail weight: "); detail.orders = db.CreateRelation<Order,Detail>(detail); root.detailId.Put(detail); db.Commit(); continue; case 3: supplier = root.supplierName[input("Supplier name: ")]; if (supplier == null) { Console.WriteLine("No such supplier!"); break; } detail = root.detailId[input("Detail ID: ")]; if (detail == null) { Console.WriteLine("No such detail!"); break; } order = new Order(); order.quantity = (int)inputLong("Order quantity: "); order.price = inputLong("Order price: "); order.detail = detail.orders; order.supplier = supplier.orders; detail.orders.Add(order); supplier.orders.Add(order); db.Commit(); continue; case 4: foreach (Supplier s in root.supplierName) { Console.WriteLine("Supplier name: " + s.name + ", supplier.location: " + s.location); } break; case 5: foreach (Detail d in root.detailId) { Console.WriteLine("Detail ID: " + d.id + ", detail.weight: " + d.weight); } break; case 6: detail = (Detail)root.detailId[input("Detail ID: ")]; if (detail == null) { Console.WriteLine("No such detail!"); break; } foreach (Order o in detail.orders) { supplier = (Supplier)o.supplier.Owner; Console.WriteLine("Suppplier name: " + supplier.name); } break; case 7: supplier = root.supplierName[input("Supplier name: ")]; if (supplier == null) { Console.WriteLine("No such supplier!"); break; } foreach (Order o in supplier.orders) { detail = (Detail)o.detail.Owner; Console.WriteLine("Detail ID: " + detail.id); } break; case 8: d2o.Reset(); d2o.Project(root.detailId.StartsWith(input("Detail ID prefix: "))); s2o.Reset(); s2o.Project(root.supplierName.StartsWith(input("Supplier name prefix: "))); s2o.Join(d2o); orders = s2o.ToArray(); Array.Sort(orders, 0, orders.Length, Order.quantityComparer); for (i = 0; i < orders.Length; i++) { order = orders[i]; supplier = order.supplier.Owner; detail = order.detail.Owner; Console.WriteLine("Detail ID: " + detail.id + ", supplier name: " + supplier.name + ", quantity: " + order.quantity); } break; case 9: db.Close(); return; } skip("Press ENTER to continue..."); } catch (DatabaseException x) { Console.WriteLine("Error: " + x.Message); skip("Press ENTER to continue..."); } } }
public string ToObj(List <Vertex> v, Detail detail, ref int a, ref int b) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("g {0}\r\n", (quadFlags.HasFlag(QuadFlags.InvisibleTriggers) ? "invisible" : "visible")); sb.AppendFormat("o piece_{0}\r\n\r\n", id.ToString("X4")); switch (detail) { case Detail.Low: { List <Vertex> list = GetVertexListq(v, -1); foreach (Vertex vt in list) { sb.AppendLine(vt.ToString()); sb.AppendLine("vt " + vt.uv.X / 255f + " " + vt.uv.Y / -255f); } sb.AppendLine("\r\nusemtl " + (ptrTexLow != UIntPtr.Zero ? texlow.Tag() : "default")); if (objSaveQuads) { sb.Append(OBJ.ASCIIQuad("f", a, b)); } else { sb.Append(OBJ.ASCIIFace("f", a, b, 1, 3, 2, 1, 3, 2)); sb.Append(OBJ.ASCIIFace("f", a, b, 2, 3, 4, 2, 3, 4)); } a += 4; b += 4; break; } case Detail.Med: { for (int i = 0; i < 4; i++) { List <Vertex> list = GetVertexListq(v, i); //this normally shouldn't be null if (list != null) { foreach (Vertex vt in list) { sb.AppendLine(vt.ToString()); sb.AppendLine("vt " + vt.uv.X / 255f + " " + vt.uv.Y / -255f); } sb.AppendLine("\r\nusemtl " + (ptrTexMid[i] != UIntPtr.Zero ? tex[i].midlods[2].Tag() : "default")); if (objSaveQuads) { sb.Append(OBJ.ASCIIQuad("f", a, b)); } else { sb.Append(OBJ.ASCIIFace("f", a, b, 1, 3, 2, 1, 3, 2)); sb.Append(OBJ.ASCIIFace("f", a, b, 2, 3, 4, 2, 3, 4)); } sb.AppendLine(); b += 4; a += 4; } else { Helpers.Panic(this, PanicType.Error, $"something's wrong with quadblock {id} at {pos.ToString("X8")}, happens in secret2_4p and temple2_4p"); } } break; } } return(sb.ToString()); }
public bool AddDetail(Detail detail) { _unitOfWork.DetailRepository.Add(detail); _unitOfWork.Save(); return true; }
public CrashTeamRacingLoader(Scene s, Detail detail) { LoadCrashTeamRacingScene(s, detail); }
public bool EditDetail(Detail detail) { _unitOfWork.DetailRepository.Edit(detail); _unitOfWork.Save(); return true; }
//private SoundManager soundManager; private void Awake() { rectTransform = GetComponent <RectTransform>(); canvasGroup = GetComponent <CanvasGroup>(); detail = GetComponent <Detail>(); }
public static void Main(string[] args) { string name; Supplier supplier; Detail detail; Supplier[] suppliers; Detail[] details; Order order; Storage db = StorageFactory.Instance.CreateStorage(); db.Open("testlist.dbs"); Root root = (Root) db.GetRoot(); if (root == null) { root = new Root(); root.details = db.CreateFieldIndex(typeof(Detail), "name", true); root.suppliers = db.CreateFieldIndex(typeof(Supplier), "name", true); db.SetRoot(root); } while (true) { Console.Out.WriteLine("------------------------------------------"); Console.Out.WriteLine("1. Add supplier"); Console.Out.WriteLine("2. Add detail"); Console.Out.WriteLine("3. Add order"); Console.Out.WriteLine("4. Search suppliers"); Console.Out.WriteLine("5. Search details"); Console.Out.WriteLine("6. Suppliers of detail"); Console.Out.WriteLine("7. Deails shipped by supplier"); Console.Out.WriteLine("8. Exit"); string str = input("> "); int cmd; try { cmd = Convert.ToInt32(str, 10); } catch (System.FormatException) { Console.Out.WriteLine("Invalid command"); continue; } switch (cmd) { case 1: supplier = new Supplier(); supplier.name = input("Supplier name: "); supplier.address = input("Supplier address: "); supplier.orders = db.CreateLink(); root.suppliers.Put(supplier); break; case 2: detail = new Detail(); detail.name = input("Detail name: "); detail.weight = inputReal("Detail weight: "); detail.color = input("Detail color: "); detail.orders = db.CreateLink(); root.details.Put(detail); break; case 3: order = new Order(); name = input("Supplier name: "); order.supplier = (Supplier) root.suppliers.Get(new Key(name)); if (order.supplier == null) { Console.Out.WriteLine("No such supplier"); continue; } name = input("Detail name: "); order.detail = (Detail) root.details.Get(new Key(name)); if (order.detail == null) { Console.Out.WriteLine("No such detail"); continue; } order.quantity = inputInt("Quantity: "); order.price = inputInt("Price: "); order.detail.orders.Add(order); order.supplier.orders.Add(order); order.detail.Store(); order.supplier.Store(); break; case 4: name = input("Supplier name prefix: "); suppliers = (Supplier[]) root.suppliers.Get(new Key(name), new Key(name + (char) 255, false)); if (suppliers.Length == 0) { Console.Out.WriteLine("No such suppliers found"); } else { for (int i = 0; i < suppliers.Length; i++) { Console.Out.WriteLine(suppliers[i].name + '\t' + suppliers[i].address); } } continue; case 5: name = input("Detail name prefix: "); details = (Detail[]) root.details.Get(new Key(name), new Key(name + (char) 255, false)); if (details.Length == 0) { Console.Out.WriteLine("No such details found"); } else { for (int i = 0; i < details.Length; i++) { Console.Out.WriteLine(details[i].name + '\t' + details[i].weight + '\t' + details[i].color); } } continue; case 6: name = input("Detail name: "); detail = (Detail) root.details.Get(new Key(name)); if (detail == null) { Console.Out.WriteLine("No such detail"); } else { for (int i = detail.orders.Size; --i >= 0; ) { Console.Out.WriteLine(((Order) detail.orders.Get(i)).supplier.name); } } continue; case 7: name = input("Supplier name: "); supplier = (Supplier) root.suppliers.Get(new Key(name)); if (supplier == null) { Console.Out.WriteLine("No such supplier"); } else { for (int i = supplier.orders.Size; --i >= 0; ) { Console.Out.WriteLine(((Order) supplier.orders.Get(i)).detail.name); } } continue; case 8: db.Close(); Console.Out.WriteLine("End of session"); return; default: Console.Out.WriteLine("Invalid command"); break; } db.Commit(); } }
public static void Get(StateObject state, string[] data) // [0] : ins { byte[] stx = new byte[1] { Constants.VALUE.STX }; byte[] send_time = new byte[7]; byte[] seq = new byte[2]; byte[] type = new byte[1] { 0x06 }; byte[] placeid = new byte[8] { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 }; byte[] deviceid = new byte[2] { 0x00, 0x01 }; byte[] ins = new byte[2]; byte[] ml = new byte[2]; byte[] VD = null; byte[] crc = new byte[2]; byte[] etx = new byte[1] { Constants.VALUE.ETX }; type = Convertion.IntToByteArray(Convert.ToInt32(Detail.get(state, Detail.TYPE.Type)), 1); placeid = Encoding.ASCII.GetBytes(Detail.get(state, Detail.TYPE.PlaceID)); deviceid = Convertion.IntToByteArray(Convert.ToInt32(Detail.get(state, Detail.TYPE.DeviceID)), 2); int a = 0; var n = DateTime.Now.ToString("yyyyMMddHHmmss"); foreach (var bcd in Convertion.StringToHex(n)) { send_time[a++] = bcd; } ins = Encoding.ASCII.GetBytes(data[0]); switch (data[0]) { case "1a": VD = new byte[2] { Constants.VALUE.ACK, 0x00 }; break; } if (VD != null) { ml[0] = (byte)(0x000000ff & (VD.Length >> 8)); ml[1] = (byte)(0x000000ff & (VD.Length)); } byte[][] combineData_Temp = new byte[][] { stx, send_time, seq, type, placeid, deviceid, ins, ml, VD, crc, etx }; byte[] packet = Convertion.Combine(combineData_Temp); byte[] array = new byte[packet.Length - 4]; Array.Copy(packet, 1, array, 0, packet.Length - 4); crc = BitConverter.GetBytes(Convertion.Crc16.CalcCRC(array)); packet[packet.Length - 3] = crc[1]; packet[packet.Length - 2] = crc[0]; Server.Send(state.workSocket, packet); data = new string[] { Detail.get(state, Detail.TYPE.PlaceID), Detail.get(state, Detail.TYPE.DeviceID), Detail.get(state, Detail.TYPE.Addr), data[0] }; Database.Charger.Record.LeaveDataRaw(true, data, packet, false); }