private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"],Session.SessionID); lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID); ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations(); lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupVariation.List(Convert.ToInt32(lblGroupID.Text),"VariationType",SortOption.Ascending)).DefaultView; lstItem.DataBind(); clsProductGroupVariation.CommitAndDispose(); Data.Unit clsUnit = new Data.Unit(); cboUnit.DataTextField = "UnitName"; cboUnit.DataValueField = "UnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(SortField: "UnitName").DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsUnit.CommitAndDispose(); ProductGroup clsProductGroup = new ProductGroup(); ProductGroupDetails clsProductGroupDetails = clsProductGroup.Details(Convert.ToInt32(lblGroupID.Text)); cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductGroupDetails.UnitDetails.UnitID.ToString())); txtProductPrice.Text = clsProductGroupDetails.Price.ToString("#,##0.#0"); txtPurchasePrice.Text = clsProductGroupDetails.PurchasePrice.ToString("#,##0.#0"); chkIncludeInSubtotalDiscount.Checked = clsProductGroupDetails.IncludeInSubtotalDiscount; txtVAT.Text = clsProductGroupDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsProductGroupDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsProductGroupDetails.LocalTax.ToString("#,##0.#0"); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); ContactGroups clsContactGroup = new ContactGroups(); cboGroup.DataTextField = "ContactGroupName"; cboGroup.DataValueField = "ContactGroupID"; cboGroup.DataSource = clsContactGroup.ListAsDataTable(ContactGroupCategory.SUPPLIER).DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = ((int) ContactGroupCategory.SUPPLIER) - 1; //cboGroup.Items.Count - 1; Department clsDepartment = new Department(clsContactGroup.Connection, clsContactGroup.Transaction); cboDepartment.DataTextField = "DepartmentName"; cboDepartment.DataValueField = "DepartmentID"; cboDepartment.DataSource = clsDepartment.ListAsDataTable().DefaultView; cboDepartment.DataBind(); cboDepartment.SelectedIndex = 0; Positions clsPosition = new Positions(clsContactGroup.Connection, clsContactGroup.Transaction); cboPosition.DataTextField = "PositionName"; cboPosition.DataValueField = "PositionID"; cboPosition.DataSource = clsPosition.ListAsDataTable("PositionName", SortOption.Ascending, 0).DefaultView; cboPosition.DataBind(); cboPosition.SelectedIndex = 0; clsContactGroup.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); Contacts clsContact = new Contacts(); cboContactCode.DataTextField = "ContactCode"; cboContactCode.DataValueField = "ContactCode"; cboContactCode.DataSource = clsContact.ListAsDataTable("ContactCode",SortOption.Ascending); cboContactCode.DataBind(); cboContactCode.Items.Add( new ListItem("All Codes","0")); cboContactCode.SelectedIndex = cboContactCode.Items.Count - 1; cboContactName.DataTextField = "ContactName"; cboContactName.DataValueField = "ContactName"; cboContactName.DataSource = clsContact.ListAsDataTable("ContactName",SortOption.Ascending); cboContactName.DataBind(); cboContactName.Items.Add( new ListItem("All Contacts","0")); cboContactName.SelectedIndex = cboContactName.Items.Count - 1; clsContact.CommitAndDispose(); ContactGroups clsContactGroup = new ContactGroups(); cboGroup.DataTextField = "ContactGroupName"; cboGroup.DataValueField = "ContactGroupID"; cboGroup.DataSource = clsDataClass.DataReaderToDataTable(clsContactGroup.List("ContactGroupName",SortOption.Ascending)); cboGroup.DataBind(); cboGroup.Items.Add( new ListItem("All Contact Groups","0")); cboGroup.SelectedIndex = cboGroup.Items.Count - 1; clsContactGroup.CommitAndDispose(); cboDeleted.SelectedIndex = cboDeleted.Items.Count - 1; }
private void LoadOptions() { ProductGroup clsProductGroup = new ProductGroup(); DataClass clsDataClass = new DataClass(); cboGroup.DataTextField = "ProductGroupName"; cboGroup.DataValueField = "ProductGroupID"; cboGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName").DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.Count - 1; Data.Unit clsUnit = new Data.Unit(); cboProductSubGroupUnit.DataTextField = "UnitName"; cboProductSubGroupUnit.DataValueField = "UnitID"; cboProductSubGroupUnit.DataSource = clsUnit.ListAsDataTable(SortField: "UnitName").DefaultView; cboProductSubGroupUnit.DataBind(); cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.Count - 1; clsUnit.CommitAndDispose(); if (cboGroup.Items.Count != 0) { Int32 BaseUnitID= clsProductGroup.Details(Convert.ToInt32(cboGroup.SelectedItem.Value)).UnitDetails.UnitID; cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf( cboProductSubGroupUnit.Items.FindByValue(BaseUnitID.ToString())); } clsProductGroup.CommitAndDispose(); }
string GetSegueIdFor(DataClass type) { switch (type) { case DataClass.Location: return LocationSegueId; case DataClass.Motion: return MotionSegueId; case DataClass.Notifications: case DataClass.Calendars: case DataClass.Reminders: case DataClass.Contacts: case DataClass.Photos: case DataClass.Video: case DataClass.Microphone: case DataClass.Bluetooth: case DataClass.Facebook: case DataClass.Twitter: case DataClass.SinaWeibo: case DataClass.TencentWeibo: case DataClass.Advertising: return DefaultSegueId; default: throw new NotImplementedException (); } }
public void SetUp() { this.Data = new DataClass(); this.Data.Data = 10; this.WasValueChangedCalled = false; this.Level = new PropertyLevel(typeof(DataClass), "Data", 150, this.ValueChanged); this.Level.RegisterPropertyChanged(this.Data); }
internal DataClass method_0(string string_1, BigEndianReader dofusReader_0) { DataClass class2 = new DataClass { Name = this.string_0 }; //Class17 class3 = default(Class17); foreach (Class17 class3 in this.list_0) { class2.Fields.Add(class3.string_0, RuntimeHelpers.GetObjectValue(class3.delegate0_0.Invoke(string_1, dofusReader_0))); } return class2; }
public void SetUp() { this.Data = new DataClass { Value = 1 }; this.Path = new OneLevelPropertyPath("Value", typeof(DataClass)); this.Path.BeginInit(); this.Path.Root = this.Data; this.Path.EndInit(); }
private void LoadOptions() { AccountCategories clsAccountCategory = new AccountCategories(); DataClass clsDataClass = new DataClass(); cboAccountCategory.DataTextField = "AccountCategoryName"; cboAccountCategory.DataValueField = "AccountCategoryID"; cboAccountCategory.DataSource = clsDataClass.DataReaderToDataTable(clsAccountCategory.List("AccountCategoryName",SortOption.Ascending)).DefaultView; cboAccountCategory.DataBind(); cboAccountCategory.SelectedIndex = cboAccountCategory.Items.Count - 1; clsAccountCategory.CommitAndDispose(); }
private void LoadOptions() { AccountClassifications clsAccountClassification = new AccountClassifications(); DataClass clsDataClass = new DataClass(); cboAccountClassification.DataTextField = "AccountClassificationName"; cboAccountClassification.DataValueField = "AccountClassificationID"; cboAccountClassification.DataSource = clsAccountClassification.ListAsDataTable().DefaultView; cboAccountClassification.DataBind(); cboAccountClassification.SelectedIndex = 1; clsAccountClassification.CommitAndDispose(); }
public void SetUp() { this.Data = new DataClass(); this.Data.DataList.Add(1); this.Data.DataList.Add(2); this.Data.DataList.Add(3); this.Data.DataList.Add(4); this.WasValueChangedCalled = false; this.Level = new IndexerLevel(typeof(DataClass), "0", 150, this.ValueChanged); this.Level.RegisterPropertyChanged(this.Data); }
public void sellStock(int amount, DataClass sellDetails) { if (possesion.Count > 0) { balance = balance * sellDetails.closingPrice / possesion.Last().closingPrice; Console.WriteLine("Current balance " + balance.ToString()); possesion.RemoveAt(0); OnStockSold(new TradeEventArgs(balance, sellDetails)); } }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblProductGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"],Session.SessionID); ProductGroupVariations clsVariation = new ProductGroupVariations(); cboVariationType.DataTextField = "VariationType"; cboVariationType.DataValueField = "VariationID"; cboVariationType.DataSource = clsDataClass.DataReaderToDataTable(clsVariation.AvailableVariations(Convert.ToInt32(lblProductGroupID.Text), "VariationType",SortOption.Ascending)).DefaultView; cboVariationType.DataBind(); cboVariationType.SelectedIndex = cboVariationType.Items.Count - 1; clsVariation.CommitAndDispose(); }
public void buyStock(int amount, DataClass buyDetails) { if(possesion.Count > 0) { return; } DataClass purchase = buyDetails; possesion.Add(buyDetails); balance = balance * 0.99; OnStockBought(new TradeEventArgs(balance, buyDetails)); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblProductGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"],Session.SessionID); ProductGroupCharges clsCharge = new ProductGroupCharges(); cboChargeType.DataTextField = "ChargeType"; cboChargeType.DataValueField = "ChargeTypeID"; cboChargeType.DataSource = clsDataClass.DataReaderToDataTable(clsCharge.AvailableCharges(Convert.ToInt64(lblProductGroupID.Text), "ChargeType",SortOption.Ascending)).DefaultView; cboChargeType.DataBind(); cboChargeType.SelectedIndex = cboChargeType.Items.Count - 1; clsCharge.CommitAndDispose(); cboChargeType_SelectedIndexChanged(null, null); }
private void LoadList() { ProductGroupCharges clsProductGroupCharge = new ProductGroupCharges(); DataClass clsDataClass = new DataClass(); if (Request.QueryString["Search"]==null) { PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupCharge.List(Convert.ToInt64(lblGroupID.Text),"ChargeType",SortOption.Ascending)).DefaultView; } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID); PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupCharge.Search(Convert.ToInt64(lblGroupID.Text),SearchKey, "ChargeType", SortOption.Ascending)).DefaultView; } clsProductGroupCharge.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]) ; PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i=0; i < PageData.PageCount;i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true;} else { cboCurrentPage.Items[i].Selected = false;} } lblDataCount.Text = " of " + " " + PageData.PageCount; }
public void Initialize() { mockContext = new Mock<ICalculationDataContext>(); mockContext .Setup(context => context.CostCodeValid(It.IsAny<string>())) .Returns(true); entry = new DataClass { EndDate = DateTime.Now.AddDays(1), Money = 0, StartDate = DateTime.Now, CostCode = string.Empty, UserName = string.Empty, Options = StringSplitOptions.RemoveEmptyEntries, StringValue = string.Empty }; }
private void LoadOptions() { PromoType clsPromoType= new PromoType(); DataClass clsDataClass = new DataClass(); cboPromoType.DataTextField = "PromoTypeCode"; cboPromoType.DataValueField = "PromoTypeID"; cboPromoType.DataSource = clsPromoType.ListAsDataTable().DefaultView; cboPromoType.DataBind(); cboPromoType.SelectedIndex = cboPromoType.Items.Count - 1; clsPromoType.CommitAndDispose(); txtStartDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); txtStartTime.Text = "00:00"; txtEndDate.Text = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd"); txtEndTime.Text = "23:59"; }
public ExtendedPickerPage() { InitializeComponent (); BindingContext = this; myPicker = new ExtendedPicker (){DisplayProperty = "FirstName"}; myPicker.SetBinding(ExtendedPicker.ItemsSourceProperty,new Binding("MyDataList",BindingMode.TwoWay)); myPicker.SetBinding(ExtendedPicker.SelectedItemProperty,new Binding("TheChosenOne",BindingMode.TwoWay)); myStackLayout.Children.Add (new Label{ Text = "Code Created:" }); myStackLayout.Children.Add (myPicker); TheChosenOne = new DataClass(){ FirstName = "Jet", LastName = "Li" }; MyDataList = new ObservableCollection<object> () { new DataClass(){FirstName="Jack",LastName="Doe"}, TheChosenOne, new DataClass(){FirstName="Matt",LastName="Bar"}, new DataClass(){FirstName="Mic",LastName="Jaggery"}, new DataClass(){FirstName="Michael",LastName="Jackon"} }; }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblSubGroupID.Text = Common.Decrypt((string)Request.QueryString["subgroupid"],Session.SessionID); lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID); ProductSubGroupVariations clsProductSubGroupVariation = new ProductSubGroupVariations(); lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsProductSubGroupVariation.List(Convert.ToInt32(lblSubGroupID.Text),"VariationType",SortOption.Ascending)).DefaultView; lstItem.DataBind(); clsProductSubGroupVariation.CommitAndDispose(); Data.Unit clsUnit = new Data.Unit(); cboUnit.DataTextField = "UnitName"; cboUnit.DataValueField = "UnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(SortField:"UnitName").DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsUnit.CommitAndDispose(); }
public void SetupFixture() { DataClass dataObject = new DataClass(); dataObject.String1 = "blabla1"; dataObject.Int1 = 123; _context.AddType("Math", typeof(Math)); _context.Set("Data", dataObject); _context.AddType("DataClass", typeof(DataClass)); _context.Set("Func", new Converter<int, int>(Func)); _context.AddFunction("Max", typeof(Math), "Max"); _context.AddFunction("fmt", typeof(String), "Format"); _context.Set("Value10", 10, typeof(int)); _context.Set("NullableValue5", 5, typeof(int?)); _context.Set("NullableValueNull", null, typeof(int?)); _context.Set("MyArray", new int[] { 1, 2, 4, 8, 16 }); _context.Set("MyArray2", new int[,] { { 1, 2 }, { 2, 4 }, { 4, 8 }, { 8, 16 }, { 16, 32 } }); _parser.DefaultContext = _context; }
public void DeepCloneFixture() { var testObj = new TestClass(10, new List<string>{"fff",null,"vvv"}, new KeyValuePair<string,int>("key1",25)); var data = new DataClass() { IntField = 5, ArrayField = new[] { 1, 2, 3 }, Private = "privateff", StringField = "strfield" }; var cloneObj = testObj.DeepCopyByJSON(); cloneObj.Should().Equal(testObj).Should().Not.Be.SameAs(testObj); var list = new List<object> { 1, 2, testObj, data }; var list2 = new List<int> { 1,2,3,4}; var list3 = new List<TestClass> { testObj, null, cloneObj }; var clone = list.DeepCopyListByJSON(); var clone2 = list2.DeepCopyByJSON(); var clone3 = list3.DeepCopyByJSON(); for (int index = 0; index < list.Count; index++) { list[index].Should().Equal(clone[index]); if (list[index]!=null && !list[index].GetType().IsValueType) list[index].Should().Not.Be.SameAs(clone[index]); } }
IEnumerator Parse(string url) { WWW www = new WWW(prefix + url); yield return www; if (string.IsNullOrEmpty(www.error)) { this.status = url; if (url == simpleUrl) { DataClass unpackData = new DataClass(); using (MemoryStream mem = new MemoryStream(www.bytes)) { Unpacker unpacker = Unpacker.Create(mem); unpackData.UnpackFromMessage(unpacker); } unpackData.Dump(); // MessagePackSerializer<DataClass> mps = MessagePackSerializer.Create<DataClass>(); // DataClass ret = mps.UnpackSingleObject(www.bytes); // // ret.Dump(); } if (url == testUrl) { MessagePackSerializer<BaseClass> mps = MessagePackSerializer.Create<BaseClass>(); BaseClass ret = mps.UnpackSingleObject(www.bytes); ret.Dump(); } } else { this.status = www.error; } }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); Contacts clsContact = new Contacts(); cboContactCode.DataTextField = "ContactName"; cboContactCode.DataValueField = "ContactID"; cboContactCode.DataSource = clsContact.AgentsAsDataTable(null, 0, "ContactCode",SortOption.Ascending); cboContactCode.DataBind(); cboContactCode.Items.Add(new ListItem("Summarized", "0")); cboContactCode.SelectedIndex = cboContactCode.Items.Count - 1; cboReportType.Items.Add(new ListItem("Summarized Report", "0")); cboReportType.Items.Add(new ListItem("Summarized With Details", "1")); cboReportType.SelectedIndex = cboReportType.Items.Count - 1; Positions clsPosition = new Positions(clsContact.Connection, clsContact.Transaction); cboPosition.DataTextField = "PositionName"; cboPosition.DataValueField = "PositionID"; cboPosition.DataSource = clsPosition.ListAsDataTable(null, SortOption.Ascending, 0); cboPosition.DataBind(); cboPosition.Items.Add(new ListItem(Positions.DEFAULT_ALL_POSITIONS, "0")); cboPosition.SelectedIndex = cboPosition.Items.Count - 1; Department clsDepartment = new Department(clsContact.Connection, clsContact.Transaction); cboDepartment.DataTextField = "DepartmentName"; cboDepartment.DataValueField = "DepartmentID"; cboDepartment.DataSource = clsDepartment.ListAsDataTable(); cboDepartment.DataBind(); cboDepartment.Items.Add(new ListItem(Department.DEFAULT_ALL_DEPARTMENTS, "0")); cboDepartment.SelectedIndex = cboDepartment.Items.Count - 1; clsContact.CommitAndDispose(); txtStartTransactionDate.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); txtEndTransactionDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); }
public static void TestUseCase() { { var i = 1; var j = Script.Write<int>("{i}", i); Assert.AreEqual(j, 1, "Bridge785 by name"); } { var i = 2; var j = Script.Write<int>("{0}", i); Assert.AreEqual(j, 2, "Bridge785 by index"); } { var i = new DataClass() { Value = 3 }; var j = Script.Write<int>("{0}", i.Value); Assert.AreEqual(j, 3, "Bridge785 by index for DataClass property"); } { var i = new DataClass() { Value = 4 }; var j = Script.Write<int>("{0}", i); Assert.AreEqual(j, i, "Bridge785 by index for DataClass"); } { var i = new DataClass() { Value = 5 }; var j = Script.Write<int>("{0}", i.GetSomething(55).Value); Assert.AreEqual(j, 55, "Bridge785 by index for DataClass method"); } { var i = new DataStruct() { Value = 6 }; var j = Script.Write<int>("{0}", i.Value); Assert.AreEqual(j, 6, "Bridge785 by index for DataStruct property"); } { var i = new DataStruct() { Value = 7 }; var j = Script.Write<int>("{0}", i.GetSomething(77).Value); Assert.AreEqual(j, 77, "Bridge785 by index for DataStruct method"); } }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); Country clsCountry = new Country(); cboCountry.DataTextField = "CountryName"; cboCountry.DataValueField = "CountryID"; cboCountry.DataSource = clsDataClass.DataReaderToDataTable(clsCountry.List("CountryName",SortOption.Ascending)).DefaultView; cboCountry.DataBind(); cboCountry.SelectedIndex = cboCountry.Items.Count - 1; AccessGroup clsAccessGroup = new AccessGroup(clsCountry.Connection, clsCountry.Transaction); cboGroup.DataTextField = "GroupName"; cboGroup.DataValueField = "GroupID"; cboGroup.DataSource = clsDataClass.DataReaderToDataTable(clsAccessGroup.List("GroupName",SortOption.Ascending)).DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.Count - 1; clsCountry.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); int subgroupid = Convert.ToInt32(Common.Decrypt(Request.QueryString["subgroupid"].ToString(),Session.SessionID)); lblSubGroupID.Text = Convert.ToString(subgroupid); ProductSubGroupUnitsMatrix clsUnitMatrix = new ProductSubGroupUnitsMatrix(); ProductSubGroupUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(subgroupid); if (clsUnitDetails.BottomUnitName == null) { ProductSubGroup clsProductSubGroup = new ProductSubGroup(); ProductSubGroupDetails clsDetails = clsProductSubGroup.Details(subgroupid); clsProductSubGroup.CommitAndDispose(); txtBaseUnit.Text = clsDetails.BaseUnitName; lblBaseUnitID.Text = Convert.ToString(clsDetails.BaseUnitID); } else { txtBaseUnit.Text = clsUnitDetails.BottomUnitName; lblBaseUnitID.Text = Convert.ToString(clsUnitDetails.BottomUnitID); } cboBottomUnit.DataTextField = "UnitName"; cboBottomUnit.DataValueField = "UnitID"; cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(subgroupid,"UnitName",SortOption.Ascending)).DefaultView; cboBottomUnit.DataBind(); if (cboBottomUnit.Items.Contains( new ListItem(txtBaseUnit.Text, lblBaseUnitID.Text))) { cboBottomUnit.Items.RemoveAt( cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text))); } cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1; clsUnitMatrix.CommitAndDispose(); }
private void SetDataSource(ReportDocument Report) { ReportDataset rptds = new ReportDataset(); DateTime PostingDateFrom = DateTime.MinValue; try { PostingDateFrom = Convert.ToDateTime(txtStartDate.Text + " " + txtStartTime.Text); } catch {} DateTime PostingDateTo = DateTime.MinValue; try { PostingDateTo = Convert.ToDateTime(txtEndDate.Text + " " + txtEndTime.Text); } catch {} eSalesFilter clseSalesFilter = new eSalesFilter(); if (lblTask.Text == "esales") { clseSalesFilter.FilterIncludeIneSales = true; clseSalesFilter.IncludeIneSales = true; } DataClass clsDataClass = new DataClass(); System.Data.DataTable dt; string ReportType = cboReportType.SelectedItem.Text; long lngSupplierID = long.Parse(cboSupplier.SelectedValue); switch (ReportType) { case "Posted PO": Data.PO clsPO = new Data.PO(); dt = clsPO.ListAsDataTable(POStatus.Posted, new Data.PODetails(), Constants.C_DATE_MIN_VALUE, Constants.C_DATE_MIN_VALUE, PostingDateFrom, PostingDateTo, SupplierID: lngSupplierID, clseSalesFilter: clseSalesFilter); clsPO.CommitAndDispose(); foreach (System.Data.DataRow dr in dt.Rows) { DataRow drPO = rptds.PO.NewRow(); foreach (DataColumn dc in rptds.PO.Columns) { drPO[dc] = dr[dc.ColumnName]; } rptds.PO.Rows.Add(drPO); } break; case "Posted PO Returns": Data.POReturns clsPOReturns = new Data.POReturns(); dt = clsPOReturns.ListAsDataTable(POReturnStatus.Posted, PostingStartDate: PostingDateFrom, PostingEndDate: PostingDateTo, SupplierID: lngSupplierID, clseSalesFilter: clseSalesFilter); clsPOReturns.CommitAndDispose(); foreach (System.Data.DataRow dr in dt.Rows) { DataRow drPOReturns = rptds.POReturns.NewRow(); foreach (DataColumn dc in rptds.POReturns.Columns) { drPOReturns[dc] = dr[dc.ColumnName]; } rptds.POReturns.Rows.Add(drPOReturns); } break; case "Posted Debit Memo": Data.DebitMemos clsDebitMemos = new Data.DebitMemos(); dt = clsDebitMemos.ListAsDataTable(DebitMemoStatus.Posted, PostingStartDate: PostingDateFrom, PostingEndDate: PostingDateTo, SupplierID: lngSupplierID, clseSalesFilter: clseSalesFilter); clsDebitMemos.CommitAndDispose(); foreach (System.Data.DataRow dr in dt.Rows) { DataRow drDebitMemos = rptds.DebitMemo.NewRow(); foreach (DataColumn dc in rptds.DebitMemo.Columns) { drDebitMemos[dc] = dr[dc.ColumnName]; } rptds.DebitMemo.Rows.Add(drDebitMemos); } break; case "By Vendor": Data.PurchaseAnalysis clsPurchaseAnalysis = new Data.PurchaseAnalysis(); dt = clsPurchaseAnalysis.ByVendor(PostingDateFrom, PostingDateTo); clsPurchaseAnalysis.CommitAndDispose(); foreach (System.Data.DataRow dr in dt.Rows) { DataRow drPAByVendor = rptds.PurchaseAnalysisPerVendor.NewRow(); foreach (DataColumn dc in rptds.PurchaseAnalysisPerVendor.Columns) { drPAByVendor[dc] = dr[dc.ColumnName]; } rptds.PurchaseAnalysisPerVendor.Rows.Add(drPAByVendor); } break; default: break; } Report.SetDataSource(rptds); SetParameters(Report); }
public static void MapComplementaryInformationsWithCoordsMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { MapComplementaryInformationsWithCoordsMessage msg = (MapComplementaryInformationsWithCoordsMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.Map.SubAreaId = msg.subAreaId; account.Map.Data = MapsManager.FromId(msg.mapId); DataClass subArea = GameData.GetDataObject(D2oFileEnum.SubAreas, (int)msg.subAreaId); string mapName = I18N.GetText((int)GameData.GetDataObject(D2oFileEnum.Areas, (int)subArea.Fields["areaId"]).Fields["nameId"]); string subAreaName = I18N.GetText((int)subArea.Fields["nameId"]); account.ModifBar(5, 0, 0, "[" + msg.worldX + ";" + msg.worldY + "]" + " " + mapName + " (" + subAreaName + ")"); account.Map.Entities.Clear(); account.Map.List.Clear(); account.Enable(true); foreach (GameRolePlayActorInformations actor in msg.actors) { account.Map.Entities.Add(new BlueSheep.Core.Fight.Entity(actor.contextualId, actor.disposition.cellId)); if (actor is GameRolePlayGroupMonsterInformations) { GameRolePlayGroupMonsterInformations a = (GameRolePlayGroupMonsterInformations)actor; account.Map.List.Add(new MonsterGroup(a.staticInfos, a.disposition.cellId, a.contextualId)); } } account.Map.StatedElements.Clear(); foreach (var statedElementDofus in msg.statedElements) { if (!(account.Map.StatedElements.ContainsKey(statedElementDofus.elementId))) { account.Map.StatedElements.Add(statedElementDofus.elementId, new BlueSheep.Core.Map.Elements.StatedElement((uint)statedElementDofus.elementCellId, (uint)statedElementDofus.elementId, (uint)statedElementDofus.elementState)); } } account.Map.InteractiveElements.Clear(); account.Map.Doors.Clear(); foreach (var element in msg.interactiveElements) { account.Map.InteractiveElements.Add(element.elementId, new BlueSheep.Core.Map.Elements.InteractiveElement((uint)element.elementId, element.elementTypeId, new List <InteractiveElementSkill>(element.enabledSkills), new List <InteractiveElementSkill>(element.disabledSkills))); InteractiveElement interactiveElement = element; List <int> listDoorSkillId = new List <int>(new[] { 184, 183, 187, 198, 114 }); List <int> listDoorTypeId = new List <int>(new[] { -1, 128, 168, 16 }); if (listDoorTypeId.Contains(interactiveElement.elementTypeId) && (interactiveElement.enabledSkills.Length > 0) && (listDoorSkillId.Contains(interactiveElement.enabledSkills[0].skillId))) { foreach (var layer in ((BlueSheep.Data.D2p.Map)account.Map.Data).Layers) { foreach (var cell in layer.Cells) { foreach (var layerElement in cell.Elements) { if (layerElement is GraphicalElement) { GraphicalElement graphicalElement = (GraphicalElement)layerElement; if ((graphicalElement.Identifier == interactiveElement.elementId) && !(account.Map.Doors.ContainsKey(cell.CellId))) { account.Map.Doors.Add(cell.CellId, new BlueSheep.Core.Map.Elements.InteractiveElement((uint)element.elementId, element.elementTypeId, new List <InteractiveElementSkill>(element.enabledSkills), new List <InteractiveElementSkill>(element.disabledSkills))); } } } } } } } account.Npc.Npcs.Clear(); foreach (GameRolePlayActorInformations a in msg.actors) { if (a is GameRolePlayNpcInformations) { account.Npc.Npcs.Add(a.contextualId, ((GameRolePlayNpcInformations)a).npcId); } } if (account.Path != null) { if (account.Path.Current_Flag == "<Fight>" && account.state != Enums.Status.Fighting && account.Path.Current_Map == account.Map.X.ToString() + "," + account.Map.Y.ToString()) { if (account.Fight.SearchFight() == false) { account.Path.PerformActionsStack(); } } else if (account.Path != null & account.state != Enums.Status.Fighting && account.Path.Current_Map == account.Map.X.ToString() + "," + account.Map.Y.ToString()) { account.Path.PerformActionsStack(); } else if (account.Path != null & account.Path.Current_Map != account.Map.X.ToString() + "," + account.Map.Y.ToString() || account.Map.Id != account.Map.LastMapId) { account.Path.Stop = false; account.Path.ParsePath(); } } }
public string lastName = "";//修改前的名称 protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-3")) { Act = HTTPRequest.GetString("Act"); sClassName = HTTPRequest.GetString("tName").Trim(); SupplierClassID = HTTPRequest.GetInt("classID", 0); lastName = HTTPRequest.GetString("lastName").Trim(); if (SupplierClassID > 0) { //2.获得实体 pi = DataClass.GetSupplierClassInfoModel(SupplierClassID); } if (ispost) { //添加 if (Act.IndexOf("add") > -1) { //3.实体 SupplierClassInfo li = new SupplierClassInfo(); if (sClassName != "") { li.sParentID = SupplierClassID; li.sClassName = sClassName; li.sOrder = HTTPRequest.GetInt("tOrder", 0); li.sAppendTime = DateTime.Now; //4.是否存在 bool hValue = DataClass.ExistsSupplierClassInfo(HTTPRequest.GetString("tName"), SupplierClassID); if (hValue) { AddErrLine("操作失败,该条分类已经存在,请核对后重新添加!"); } else { //5.添加一条数据 int addCount = DataClass.AddSupplierClassInfo(li); if (addCount > 0) { //记录成功操作 Logs.AddEventLog(this.userid, "添加" + sClassName + "供货商分类"); AddMsgLine("操作成功!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } else { AddErrLine("操作失败,请重新添加!"); } } } else { AddErrLine("操作失败,请重新添加!"); } } //修改 if (Act.IndexOf("update") > -1) { if (sClassName != "") { pi.SupplierClassID = SupplierClassID; pi.sClassName = sClassName; pi.sAppendTime = DateTime.Now; //6.更新一条数据 int count = DataClass.UpdateSupplierClassInfo(pi); if (count > 0) { //记录修改操作 Logs.AddEventLog(this.userid, "将" + lastName + "供货商修改为" + sClassName); AddMsgLine("修改成功!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } else { AddErrLine("修改失败!"); } } else { AddErrLine("修改失败!"); } } } } else { AddErrLine("权限不足!"); AddScript("window.parent.HidBox();"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
private void LoadList() { Contacts clsContact = new Contacts(); DataClass clsDataClass = new DataClass(); ContactColumns clsContactColumns = new ContactColumns(); clsContactColumns.ContactID = true; clsContactColumns.ContactCode = true; clsContactColumns.ContactName = true; clsContactColumns.CreditDetails = true; ContactColumns clsSearchColumns = new ContactColumns(); clsSearchColumns.ContactCode = true; clsSearchColumns.ContactName = true; clsSearchColumns.CreditDetails = true; string SortField = "ContactID"; if (Request.QueryString["sortfield"] != null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } System.Data.SqlClient.SortOrder sortoption = System.Data.SqlClient.SortOrder.Ascending; if (Request.QueryString["sortoption"] != null) { sortoption = (System.Data.SqlClient.SortOrder)Enum.Parse(typeof(System.Data.SqlClient.SortOrder), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } string SearchKey = string.Empty; if (Request.QueryString["Search"] != null) { SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); txtSearch.Text = SearchKey; } string strSearch = txtSearch.Text.Trim(); DateTime dteExpiryDateFrom = DateTime.TryParse(txtExpiryDateFrom.Text, out dteExpiryDateFrom) ? dteExpiryDateFrom : DateTime.MinValue; DateTime dteExpiryDateTo = DateTime.TryParse(txtExpiryDateTo.Text, out dteExpiryDateTo) ? dteExpiryDateTo : DateTime.MinValue; CreditCardStatus enumCreditCardStatus = (CreditCardStatus)Enum.Parse(typeof(CreditCardStatus), cboCreditCardStatus.SelectedItem.Value); PageData.DataSource = clsContact.CustomersWithCredits(clsContactColumns, LastNameFrom: txtLastNameFrom.Text, LastNameTo: txtLastNameTo.Text, CustomerCode_CreditCardNo: strSearch, CreditCardExpiryDateFrom: dteExpiryDateFrom, CreditCardExpiryDateTo: dteExpiryDateTo, CreditCardStatus: enumCreditCardStatus, CreditCardTypeID: Int32.Parse(cboCreditType.SelectedItem.Value), CheckCustomersGuarantor: true, SortField: SortField, SortOrder: sortoption).DefaultView; clsContact.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]); PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i = 0; i < PageData.PageCount; i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true; } else { cboCurrentPage.Items[i].Selected = false; } } lblDataCount.Text = " of " + " " + PageData.PageCount; }
public UpdateInformation() { InitializeComponent(); this.DataConnection = new DataClass(); }
void DoSomethingB(DataClass data) { DoSomethingBMap[data.ValueType].Invoke(data); }
public string lastName = ""; //修改前的名称 protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-1-1")) { reformat = HTTPRequest.GetString("reformat"); Act = HTTPRequest.GetString("Act"); FeesSubjectClassID = HTTPRequest.GetInt("FeesSubjectClassID", 0); string cClassName = HTTPRequest.GetString("cClassName").Trim(); int cParentID = HTTPRequest.GetInt("cParentID", 0); int cOrder = HTTPRequest.GetInt("cOrder", 0); int cDirection = HTTPRequest.GetInt("cDirection", 0); string cCode = HTTPRequest.GetString("cCode").Trim(); int cType = HTTPRequest.GetInt("cType", 0); lastName = HTTPRequest.GetString("lastName").Trim(); if (Act == "Edit") { if (FeesSubjectClassID > 0) { FeesSubjectClass = DataClass.GetFeesSubjectClassInfoModel(FeesSubjectClassID); if (FeesSubjectClass != null) { } else { AddErrLine("参数错误,系统没有该科目!"); } } else { AddErrLine("参数错误!"); } } if (ispost) { FeesSubjectClass.cOrder = cOrder; FeesSubjectClass.cDirection = cDirection; FeesSubjectClass.cType = cType; if (Act == "Edit") { // FeesSubjectClass.cParentID = HTTPRequest.GetFormInt("cParentID",0); // reVal = ",\"ReValue\":{\"ParentID\":\"" + FeesSubjectClass.cParentID + "\"}"; if (cCode != FeesSubjectClass.cCode ? !DataClass.ExistsFeesSubjectClassInfoByCode(cCode):true) { if ((cClassName != FeesSubjectClass.cClassName) ? !DataClass.ExistsFeesSubjectClassInfo(cClassName, cParentID):true) { FeesSubjectClass.cCode = cCode; FeesSubjectClass.cClassName = cClassName; DataClass.UpdateFeesSubjectClassInfo(FeesSubjectClass); //记录修改操作 Logs.AddEventLog(this.userid, "将" + lastName + "科目修改为" + cClassName); AddMsgLine("修改成功!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } else { AddErrLine("科目名称:" + cClassName + ",系统已经存在,无法修改!"); } } else { AddErrLine("科目编号:" + cCode + ",系统已经存在,无法修改!"); } } if (Act == "Add") { FeesSubjectClass.cParentID = HTTPRequest.GetFormInt("cParentID", 0); FeesSubjectClass.cAppendTime = DateTime.Now; reVal = ",\"ReValue\":{\"ParentID\":\"" + FeesSubjectClass.cParentID + "\"}"; if (!DataClass.ExistsFeesSubjectClassInfo(cClassName, cParentID)) { if (!DataClass.ExistsFeesSubjectClassInfoByCode(cCode)) { FeesSubjectClass.cCode = cCode; FeesSubjectClass.cClassName = cClassName; DataClass.AddFeesSubjectClassInfo(FeesSubjectClass); //记录成功操作 Logs.AddEventLog(this.userid, "添加" + cClassName + "科目分类"); AddMsgLine("添加成功!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } else { AddErrLine("科目编号:" + cCode + ",系统已经存在,无法添加!"); } } else { AddErrLine("科目名称:" + cClassName + ",系统已经存在,无法添加!"); } } } else { dList = DataClass.GetFeesSubjectClassType(); if (Act == "Add") { if (cParentID > 0) { FeesSubjectClassPaterStr = DataClass.GetFeesSubjectClassPaterStr(cParentID); } } if (Act == "Edit") { if (FeesSubjectClassID > 0) { FeesSubjectClassPaterStr = DataClass.GetFeesSubjectClassPaterStr(FeesSubjectClassID); } } } } else { AddErrLine("权限不足!"); AddScript("window.parent.HidBox();"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } if (reformat == "json") { Response.ClearContent(); Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1); Response.Expires = 0; Response.Charset = "utf-8"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.ContentType = "application/json"; string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"" + reVal + "}}"; Response.Write(Json_Str); Response.End(); } }
public static void Read(string file) { //Declare dictionary list var list = new List <Dictionary <string, object> >(); // Split data.text into lines using LINE_SPLIT_RE characters var lines = Regex.Split(file, LINE_SPLIT_RE); //Split header (element 0) var header = Regex.Split(lines[0], SPLIT_RE); // Loops through lines for (var i = 1; i < lines.Length; i++) { //Split lines according to SPLIT_RE, store in var (usually string array) var values = Regex.Split(lines[i], SPLIT_RE); // Skip to end of loop (continue) if value is 0 length OR first value is empty if (values.Length == 0 || values[0] == "") { continue; } var entry = new Dictionary <string, object>(); // Creates dictionary object // Loops through every value for (var j = 0; j < header.Length && j < values.Length; j++) { // Set local variable value string value = values[j]; // Trim characters value = value.TrimStart(TRIM_CHARS).TrimEnd(TRIM_CHARS).Replace("\\", ""); // Set final value object finalvalue = value; // If-else to attempt to parse value into int or float if (int.TryParse(value, out int n)) { finalvalue = n; } else if (float.TryParse(value, out float f)) { finalvalue = f; } entry[header[j]] = finalvalue; } // Add Dictionary ("entry" variable) to list list.Add(entry); } pointList = list; float r; columnList = new List <string>(list[0].Keys); if (float.TryParse(list[list.Count - 1][columnList[columnList.Count - 1]].ToString(), NumberStyles.Any, CultureInfo.InvariantCulture, out r)) { dataClass = new Regression(pointList); } else { dataClass = new Classification(pointList); } targetFeatures = new List <string>(); for (int i = 0; i < list.Count; i++) { targetFeatures.Add(list[i][columnList[columnList.Count - 1]].ToString()); } // Only keep distinct targetFeatures targetFeatures = targetFeatures.Distinct().ToList(); }
public string Act = ""; //获得操作步骤 protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-2")) { className = HTTPRequest.GetString("className"); classID = HTTPRequest.GetInt("classID", -1); Act = HTTPRequest.GetString("Act"); Caches.ReSet(); //1.获得部门分类详情 pclass = DataClass.GetDepartmentClassDetails(classID); if (ispost) { if (Act.IndexOf("getNode") > -1) { string pid = ""; string pName = ""; string pOrder = ""; string pTime = ""; string pRarentID = ""; string pRarentName = ""; //当选择到节点是统计到该节点及子节点 if (classID > -1) { if (pclass.Rows.Count > 0) { for (int i = 0; i < pclass.Rows.Count; i++) { //2.获得表字段组成字符串 pid += pclass.Rows[i]["DepartmentsClassID"].ToString() + ","; pName += pclass.Rows[i]["dClassName"].ToString() + ","; pOrder += pclass.Rows[i]["dOrder"].ToString() + ","; pTime += pclass.Rows[i]["dAppendTime"].ToString() + ","; pRarentID = pclass.Rows[i]["dParentID"].ToString(); } pid = pid.Substring(0, pid.Length - 1); pName = pName.Substring(0, pName.Length - 1); pOrder = pOrder.Substring(0, pOrder.Length - 1); pTime = pTime.Substring(0, pTime.Length - 1); } sTjson = "cDetails:{'pid':'" + pid + "','pname':'" + pName + "','porder':'" + pOrder + "','ptime':'" + pTime + "','parentID':'" + pRarentID + "'}"; Response.Write("{" + sTjson + "}"); Response.End(); } else { if (pclass.Rows.Count > 0) { //3.将重复的ID去掉 DataView dwv = new DataView(pclass); dwv.Sort = "dParentID"; pclass = dwv.ToTable(true, "dParentID"); DataTable dt = new DataTable(); DataSet ds = new DataSet(); for (int j = 0; j < pclass.Rows.Count; j++) { //4.获得部门上级分类信息 DataTable dtParent = DataClass.getDepartmentClassList(Convert.ToInt32(pclass.Rows[j]["dParentID"].ToString())); dt = dtParent.Copy(); dt.TableName = "td_" + j; ds.Tables.Add(dt); } pParent = ds.Tables[0].Clone(); //创建新表 克隆以有表的架构 object[] objArray = new object[pParent.Columns.Count]; //定义与表列数相同的对象数组 存放表的一行的值 for (int m = 0; m < ds.Tables.Count; m++) { if (ds.Tables[m].Rows.Count > 0) { for (int n = 0; n < ds.Tables[m].Rows.Count; n++) { ds.Tables[m].Rows[n].ItemArray.CopyTo(objArray, 0); //将表的一行的值存放数组中 pParent.Rows.Add(objArray); //将数组的值添加到新表中 } } } //5.整合表以后的字段拼接 for (int i = 0; i < pParent.Rows.Count; i++) { pid += pParent.Rows[i]["DepartmentsClassID"].ToString() + ","; pName += pParent.Rows[i]["dClassName"].ToString() + ","; pOrder += pParent.Rows[i]["dOrder"].ToString() + ","; pTime += pParent.Rows[i]["dAppendTime"].ToString() + ","; pRarentID = pParent.Rows[i]["dParentID"].ToString(); pRarentName += pParent.Rows[i]["parentName"].ToString() + ","; } pid = pid.Substring(0, pid.Length - 1); pName = pName.Substring(0, pName.Length - 1); pOrder = pOrder.Substring(0, pOrder.Length - 1); pTime = pTime.Substring(0, pTime.Length - 1); pRarentName = pRarentName.Substring(0, pRarentName.Length - 1); } sTjson = "cDetails:{'pid':'" + pid + "','pname':'" + pName + "','porder':'" + pOrder + "','ptime':'" + pTime + "','parentID':'" + pRarentID + "','parentName':'" + pRarentName + "'}"; Response.Write("{" + sTjson + "}"); Response.End(); } } if (Act.IndexOf("del") > -1) { string trNode = HTTPRequest.GetString("trNode"); int count = 0; if (trNode != "") { if (trNode.IndexOf(",") > -1) { string[] trNodeBits = trNode.Split(','); for (int i = 0; i < trNodeBits.Length - 1; i++) { //6.删除操作(多个删除) count = DataClass.DeleteDepartmentsClassInfo(Convert.ToInt32(trNodeBits[i].ToString())); } } else { //7.删除操作(单个删除) count = DataClass.DeleteDepartmentsClassInfo(Convert.ToInt32(trNode)); } if (count > 0) { //记录成功操作 Logs.AddEventLog(this.userid, "删除" + trNode + "部门分类"); Response.Write("1"); Response.End(); } else { Response.Write("0"); Response.End(); } } else { Response.Write("-1"); Response.End(); } } } else { if (pclass.Rows.Count > 0) { //8.页面加载时候 DataView dwv = new DataView(pclass); dwv.Sort = "dParentID"; pclass = dwv.ToTable(true, "dParentID"); DataTable dt = new DataTable(); DataSet ds = new DataSet(); for (int j = 0; j < pclass.Rows.Count; j++) { //9.获得上级分类 DataTable dtParent = DataClass.getDepartmentClassList(Convert.ToInt32(pclass.Rows[j]["dParentID"].ToString())); dt = dtParent.Copy(); dt.TableName = "td_" + j; ds.Tables.Add(dt); } pParent = ds.Tables[0].Clone(); //创建新表 克隆以有表的架构 object[] objArray = new object[pParent.Columns.Count]; //定义与表列数相同的对象数组 存放表的一行的值 for (int m = 0; m < ds.Tables.Count; m++) { if (ds.Tables[m].Rows.Count > 0) { for (int n = 0; n < ds.Tables[m].Rows.Count; n++) { ds.Tables[m].Rows[n].ItemArray.CopyTo(objArray, 0); //将表的一行的值存放数组中 pParent.Rows.Add(objArray); //将数组的值添加到新表中 } } } } } } else { AddErrLine("权限不足!"); AddScript("window.parent.HidBox();"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { string strXHTM = this.textBox1.Text.Trim(); string strCPBH = (string)DataClass.GetValue("select cpbh from pdlots with(nolock) where prodno=(select 生产制令号 from 成品条码表_3M where 箱号条码='" + strXHTM + "')"); if (strCPBH == null) { MessageBox.Show("此条码并不存在!"); this.Clear(); return; } this.cpbh = strCPBH; string file1 = "", file2 = "", file3 = ""; //导通检查 switch (this.CheckFiles(this.paths_dt, strXHTM, ref file1)) { case 1: this.checkBox1.Checked = true; break; case 0: MessageBox.Show("导通测试未通过!"); this.Clear(); return; case -1: MessageBox.Show("网络异常,无法访问导通测试目录,请联系电脑工程师!"); this.Clear(); return; } //烧录检查 switch (this.CheckFiles(this.paths_sl, strXHTM, ref file2)) { case 1: this.checkBox2.Checked = true; break; case 0: MessageBox.Show("烧录测试未通过!"); this.Clear(); return; case -1: MessageBox.Show("网络异常,无法访问烧录测试目录,请联系电脑工程师!"); this.Clear(); return; } //高频检查 switch (this.CheckFiles(this.paths_gp, strXHTM, ref file3)) { case 1: this.checkBox3.Checked = true; break; case 0: MessageBox.Show("高频测试未通过!"); this.Clear(); return; case -1: MessageBox.Show("网络异常,无法访问高频测试目录,请联系电脑工程师!"); this.Clear(); return; } //更新数据库 string sql = "update 成品条码表_3M set 测试通过=1,测试时间=getdate(),导通测试文件='" + file1 + "',烧录测试文件='" + file2 + "',高频测试文件='" + file3 + "' where 箱号条码='" + strXHTM + "'"; if (DataClass.Execute(sql)) { CommonClass.PlaySoundOK(); MessageBox.Show("测试通过!"); } else { CommonClass.PlaySoundNG(); MessageBox.Show("保存到数据库失败,请重新尝试或联系系统管理员!"); } this.Clear(); } }
private string fs3(DataClass dataClass1, DataClass dataClass2) { throw new NotImplementedException(); }
/// <summary> /// 绑定数据 /// </summary> private void BindData() { string strPage, strKeyWord, strSql; int intPage, intPageSize, intRsCount; double dbPageCount = 1; strPage = Request.QueryString["page"]; strKeyWord = Request.QueryString["KeyWord"]; //判断页参数是否存在 if (!FunctionClass.CheckStr(strPage, 1)) { strPage = "1"; } //赋值页和页数 intPage = Convert.ToInt32(strPage); intPageSize = 10; //初始化sql语句 strSql = "select * from T_Seo where 1=1"; DataClass myData = new DataClass(); SqlConnection myConn = myData.ConnOpen(); //判断是否有关键词 if (FunctionClass.CheckStr(strKeyWord, 0)) { tbKeyWord.Text = strKeyWord; strSql += " and Title like '%" + strKeyWord.Replace("'", "''") + "%'"; } strSql += " order by ID"; DataSet myDs = myData.GetDataSet(strSql, myConn); //获取总记录数 intRsCount = myDs.Tables[0].Rows.Count; //计算总页数 dbPageCount = Math.Ceiling((double)intRsCount / (double)intPageSize); //如果现有页数大于总页数,那么设定为总页数 if (intPage > dbPageCount) { intPage = Convert.ToInt32(dbPageCount); } if (intPage < 1) { intPage = 1; } //读取数据 for (int i = 0; i < intPageSize; i++) { int intCurrentRow = i + (intPage - 1) * intPageSize; //判断是否已经没有数据 if (intCurrentRow + 1 > intRsCount) { break; } TableRow myTr = new TableRow(); myTr.Attributes.Add("style", "CURSOR: hand"); myTr.Attributes.Add("onMouseOver", "this.style.backgroundColor = '#FFFFFF'"); myTr.Attributes.Add("onmouseout", "this.style.backgroundColor = ''"); myTr.Attributes.Add("bgColor", "#ebf2f9"); TableCell myTc1 = new TableCell(); myTc1.Text = myDs.Tables[0].Rows[intCurrentRow]["ID"].ToString(); TableCell myTc2 = new TableCell(); myTc2.Text = myDs.Tables[0].Rows[intCurrentRow]["PageName"].ToString(); TableCell myTc3 = new TableCell(); myTc3.Text = myDs.Tables[0].Rows[intCurrentRow]["PageNameCalled"].ToString(); TableCell myTc4 = new TableCell(); myTc4.Text = myDs.Tables[0].Rows[intCurrentRow]["Title"].ToString(); myTr.Cells.Add(myTc1); myTr.Cells.Add(myTc2); myTr.Cells.Add(myTc3); myTr.Cells.Add(myTc4); //TableCell myTc9 = new TableCell(); //TextBox myTb = new TextBox(); //myTb.ID = "SID_" + myDs.Tables[0].Rows[intCurrentRow]["ID"].ToString(); //myTb.Width = 40; //myTb.Text = myDs.Tables[0].Rows[intCurrentRow]["SID"].ToString(); //myTb.Attributes.Add("onkeyup", "value=value.replace(/[^\\d]/g,'')"); //myTc9.Controls.Add(myTb); TableCell myTc6 = new TableCell(); myTc6.Width = 60; myTc6.Text = "<a href='seo_mod.aspx?id=" + myDs.Tables[0].Rows[intCurrentRow]["ID"].ToString() + "' style='color:#330099;'>修改</a><!-- <a href='seo.aspx?del=" + myDs.Tables[0].Rows[intCurrentRow]["ID"].ToString() + "' style='color:#330099;' onclick='return confirm(\"是否要删除这条信息?\")'>删除</a>-->"; TableCell myTc7 = new TableCell(); CheckBox myCB = new CheckBox(); myCB.ID = "cbSel_" + myDs.Tables[0].Rows[intCurrentRow]["ID"].ToString(); myCB.ToolTip = myDs.Tables[0].Rows[intCurrentRow]["ID"].ToString(); myTc7.Width = 20; myTc7.Controls.Add(myCB); //myTr.Cells.Add(myTc9); myTr.Cells.Add(myTc6); myTr.Cells.Add(myTc7); tableMain.Rows.Add(myTr); } myDs.Dispose(); myData.ConnClose(myConn); //添加按钮行 TableRow myTrBt = new TableRow(); myTrBt.Attributes.Add("bgColor", "#ebf2f9"); TableCell myTcA = new TableCell(); myTcA.ColumnSpan = 4; //TableCell myTcB = new TableCell(); //Button myTbOrder = new Button(); //myTbOrder.ID = "tbUpdateOrder"; //myTbOrder.Text = "更新排序"; //myTbOrder.Width = 50; //myTbOrder.Click += new EventHandler(myTbOrder_Click); //myTcB.Controls.Add(myTbOrder); TableCell myTcC = new TableCell(); myTcC.ColumnSpan = 2; //Button myTbDel = new Button(); //myTbDel.ID = "tbDelSelected"; //myTbDel.Text = "删除所选"; //myTbDel.OnClientClick = "return confirm('是否删除选中信息?');"; //myTbDel.Width = 60; //myTbDel.Click += new EventHandler(myTbDel_Click); //myTcC.Controls.Add(myTbDel); myTcC.Text = " "; myTrBt.Cells.Add(myTcA); //myTrBt.Cells.Add(myTcB); myTrBt.Cells.Add(myTcC); tableMain.Rows.Add(myTrBt); //添加分页行 TableRow myTrPage = new TableRow(); myTrPage.Attributes.Add("bgColor", "#d7e4f7"); TableCell myTcP = new TableCell(); myTcP.ColumnSpan = 7; myTcP.Text = "<div style='width:50%;text-align:left;float:left;'>总共 <font color=red>" + intRsCount + "</font> 条信息 当前页:<font color=red>" + intPage + "</font>/" + dbPageCount + " 每页显示:<font color=red>" + intPageSize + "</font>条</div>"; myTcP.Text += "<div style='width:50%;text-align:right;float:left;'><a href=\"" + FunctionClass.GetNewURL("page", "1", FunctionClass.PageURL) + "\">首页</a> "; int intPrevPage = intPage < 2 ? 1 : intPage - 1; myTcP.Text += "<a href=\"" + FunctionClass.GetNewURL("page", intPrevPage.ToString(), FunctionClass.PageURL) + "\">上一页</a> "; int intNextPage = intPage >= dbPageCount ? (int)dbPageCount : intPage + 1; myTcP.Text += "<a href=\"" + FunctionClass.GetNewURL("page", intNextPage.ToString(), FunctionClass.PageURL) + "\">下一页</a> "; myTcP.Text += "<a href=\"" + FunctionClass.GetNewURL("page", dbPageCount.ToString(), FunctionClass.PageURL) + "\">尾页</a> "; myTcP.Text += "跳转至<input type=\"text\" name=\"gotoPage\" id=\"gotoPage\" style=\"width:20px;height:18px;\" value=\"" + intPage + "\" onKeyUp=\"value=value.replace(/[^\\d]/g,'')\" />页"; myTcP.Text += " <INPUT style='WIDTH: 20px; HEIGHT: 18px' class=button onclick=\"GotoPage('" + FunctionClass.GetNewURL("page", "", FunctionClass.PageURL) + "','gotoPage')\" value=GO type=button "; myTcP.Text += "name=submitSkip> </div>"; myTrPage.Cells.Add(myTcP); tableMain.Rows.Add(myTrPage); Session["UserViewURL"] = FunctionClass.PageURL; }
static void Main(string[] args) { //#region plain props //ParentDataClass parentDataObj = new ParentDataClass(); //parentDataObj.TheData = new DataClass { MyStringProp = "Hello World" }; //object targetObj = new object(); //OneWayPropertyBindingBase<object, object> binding = new OneWayPropertyBindingBase<object, object>(); //CompositePathGetter pathGetter = // new CompositePathGetter // ( // new BindingPathLink<object>[] // { // new BindingPathLink<object>("TheData"), // new BindingPathLink<object>("MyStringProp"), // }, // "blabla" // ); //pathGetter.TheObj = parentDataObj; //binding.SourcePropertyGetter = pathGetter; //binding.TargetPropertySetter = new APropSetter<object>(targetObj, MyAProperty); //binding.Bind(); //Console.WriteLine(MyAProperty.GetProperty(targetObj)); //parentDataObj.TheData.MyStringProp = "Hi World"; //Console.WriteLine(MyAProperty.GetProperty(targetObj)); //parentDataObj.TheData = new DataClass { MyStringProp = "bye bye" }; //Console.WriteLine(MyAProperty.GetProperty(targetObj)); //parentDataObj.TheData = null; //Console.WriteLine(MyAProperty.GetProperty(targetObj)); //#endregion plain props #region plain and attached props TopLevelObj parentDataObj = new TopLevelObj(); DataClass dataObject = new DataClass{ MyStringProp = "Hello World"}; MyAProperty.SetProperty(parentDataObj, dataObject); object targetObj = new object(); OneWayPropertyBinding<object, object> binding = new OneWayPropertyBinding<object, object>(); CompositePathGetter<object> pathGetter = new CompositePathGetter<object> ( new BindingPathLink<object>[] { new BindingPathLink<object>(MyAProperty), new BindingPathLink<object>("MyStringProp") }, "blabla" ); pathGetter.TheObj = parentDataObj; binding.SourcePropertyGetter = pathGetter; binding.TargetPropertySetter = new APropSetter<object>(targetObj, MyAProperty); binding.Bind(); Console.WriteLine(MyAProperty.GetProperty(targetObj)); dataObject.MyStringProp = "Hi World"; Console.WriteLine(MyAProperty.GetProperty(targetObj)); MyAProperty.SetProperty( parentDataObj, new DataClass { MyStringProp = "bye bye" }); Console.WriteLine(MyAProperty.GetProperty(targetObj)); MyAProperty.ClearAProperty(parentDataObj); Console.WriteLine(MyAProperty.GetProperty(targetObj)); #endregion plain and attached props }
/// <summary> /// 模糊获取行政区或新增一条片区 /// </summary> /// <param name="subAreaName"></param> /// <param name="cityId"></param> /// <param name="_dc"></param> /// <returns></returns> public static SysData_SubArea GetLikeOrInsertArea(string subAreaName, int cityId, DataClass _dc = null) { DataClass dc = new DataClass(_dc); SysData_SubArea subArea = GetAreaByAreaNameByCityId(subAreaName, cityId, _db: dc); if (subArea == null) { subArea = InsertArea(subAreaName, cityId, 0, _db: dc); } dc.Connection_Close(); dc.Dispose(); return subArea; }
public static bool SetKeyValueConfig(int cityId, int webId, string key, string value, DataClass _db = null) { DataClass db = new DataClass(_db); Dat_KeyValueConfig obj = GetKeyValueConfig(cityId, webId, key, db); if (obj != null) { Update(cityId, webId, key, value, db); } else { Insert(cityId, webId, key, value, db); } return(true); }
public static List<SysData_SubArea> GetSubAreaByLikeAndCityId(string subAreaLike, int cityId,int maxCount, DataClass _dc = null) { DataClass db = new DataClass(_dc); List<SysData_SubArea> list = db.DB.SysData_SubArea.Where(p => p.CityId == cityId && (SqlMethods.Like(p.SubAreaName, "%" + subAreaLike + "%") || SqlMethods.Like(subAreaLike, "%" + p.SubAreaName + "%"))).Take(maxCount).ToList(); db.Connection_Close(); db.Dispose(); return list; }
public static Dat_KeyValueConfig GetKeyValueConfig(int cityId, int webId, string key, DataClass _db = null) { DataClass db = new DataClass(_db); string sql = @"select * from Dat_KeyValueConfig with(nolock) where KeyName='{0}' and CityId={1} and WebId={2} "; sql = string.Format(sql, key, cityId, webId); Dat_KeyValueConfig obj = db.DB.ExecuteQuery <Dat_KeyValueConfig>(sql).FirstOrDefault(); return(obj); }
private void LoadList() { WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); DataClass clsDataClass = new DataClass(); Common Common = new Common(); string SortField = "WBranchTransferID"; if (Request.QueryString["sortfield"] != null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } SortOption sortoption = SortOption.Ascending; if (Request.QueryString["sortoption"] != null) { sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } DateTime dteTransferStartDate = DateTime.MinValue; try { if (txtTransferStartDate.Text != string.Empty) { dteTransferStartDate = Convert.ToDateTime(txtTransferStartDate.Text + " " + txtTransferStartTime.Text); } } catch { } DateTime dteTransferEndDate = DateTime.MinValue; try { if (txtTransferEndDate.Text != string.Empty) { dteTransferEndDate = Convert.ToDateTime(txtTransferEndDate.Text + " " + txtTransferEndTime.Text); } } catch { } DateTime dtePostingStartDate = DateTime.MinValue; try { if (txtPostingStartDate.Text != string.Empty) { dtePostingStartDate = Convert.ToDateTime(txtPostingStartDate.Text + " " + txtPostingStartTime.Text); } } catch { } DateTime dtePostingEndDate = DateTime.MinValue; try { if (txtPostingEndDate.Text != string.Empty) { dtePostingEndDate = Convert.ToDateTime(txtPostingEndDate.Text + " " + txtPostingEndTime.Text); } } catch { } WBranchTransferDetails searchKey = new WBranchTransferDetails(); searchKey.WBranchTransferNo = txtSearch.Text; WBranchTransferStatus status = (WBranchTransferStatus)Enum.Parse(typeof(WBranchTransferStatus), cboStatus.SelectedItem.Value); PageData.DataSource = clsWBranchTransfer.ListAsDataTable(0, 0, searchKey, status, dteTransferStartDate, dteTransferEndDate, dtePostingStartDate, dtePostingEndDate, null, null, SortField, sortoption).DefaultView; clsWBranchTransfer.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]); PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i = 0; i < PageData.PageCount; i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true; } else { cboCurrentPage.Items[i].Selected = false; } } lblDataCount.Text = " of " + " " + PageData.PageCount; }
private void LoadList() { StockTypes clsStockType = new StockTypes(); DataClass clsDataClass = new DataClass(); string SortField = "StockTypeID"; if (Request.QueryString["sortfield"] != null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } SortOption sortoption = SortOption.Ascending; if (Request.QueryString["sortoption"] != null) { sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } if (Request.QueryString["Search"] == null) { PageData.DataSource = clsStockType.ListAsDataTable(SortField, sortoption).DefaultView; } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); PageData.DataSource = clsStockType.SearchAsDataTable(SearchKey, SortField, sortoption).DefaultView; } clsStockType.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]); PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i = 0; i < PageData.PageCount; i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true; } else { cboCurrentPage.Items[i].Selected = false; } } lblDataCount.Text = " of " + " " + PageData.PageCount; }
void DoSomethingB <T>(DataClass data) { var array = (T[])data.GetValues(); // do something }
public DataClassWriter(DataClass dataClass, ToolWriter writer) { DataClass = dataClass; Writer = writer; }
void InitValues(DataClass data) { // This takes care of your if s InitMap[data.ValueType].Invoke(data); }
public VMManageColorDebug() { ItemSelectedCommand = new DelegateCommand(OnItemSelected); YellowCollect = new ObservableCollection <ItemsColor>(); OrangeCollect = new ObservableCollection <ItemsColor>(); RedCollect = new ObservableCollection <ItemsColor>(); BlueCollect = new ObservableCollection <ItemsColor>(); GreenCollect = new ObservableCollection <ItemsColor>(); GrayCollect = new ObservableCollection <ItemsColor>(); BrownCollect = new ObservableCollection <ItemsColor>(); BlackAndWhiteCollect = new ObservableCollection <ItemsColor>(); VioletCollect = new ObservableCollection <ItemsColor>(); RecomendCollect = new ObservableCollection <ItemsColor>(); DataClass dc = new DataClass("KontinentDBEntity.db"); DataTable dt = dc.SelectQuery("select * from _colorRGB"); var ss = dt.AsEnumerable().ToList(); foreach (var vari in ss) { if (Convert.ToInt32(vari["nameInRAL"].ToString()) == 1018 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 1028 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 2004 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 3020 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 5005 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 5015 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 6029 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 7016 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 7024 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 7032 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 7035 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 7036 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 9005 || Convert.ToInt32(vari["nameInRAL"].ToString()) == 9016) { SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromRgb( Convert.ToByte(vari["R"].ToString()), Convert.ToByte(vari["G"].ToString()), Convert.ToByte(vari["B"].ToString()))); RecomendCollect.Add(new ItemsColor() { Color = scb, Blue = Convert.ToByte(vari["B"].ToString()), NameColor = vari["noteRAL"].ToString(), Green = Convert.ToByte(vari["G"].ToString()), Red = Convert.ToByte(vari["R"].ToString()), NameColorRAL = "RAL " + vari["nameInRAL"].ToString().Trim() }); continue; } if (Convert.ToInt32(vari["nameInRAL"].ToString()) >= 1000 && Convert.ToInt32(vari["nameInRAL"].ToString()) < 2000) { SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromRgb( Convert.ToByte(vari["R"].ToString()), Convert.ToByte(vari["G"].ToString()), Convert.ToByte(vari["B"].ToString()))); YellowCollect.Add(new ItemsColor() { Color = scb, Blue = Convert.ToByte(vari["B"].ToString()), NameColor = vari["noteRAL"].ToString(), Green = Convert.ToByte(vari["G"].ToString()), Red = Convert.ToByte(vari["R"].ToString()), NameColorRAL = "RAL " + vari["nameInRAL"].ToString().Trim() }); } if (Convert.ToInt32(vari["nameInRAL"].ToString()) >= 2000 && Convert.ToInt32(vari["nameInRAL"].ToString()) < 3000) { SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromRgb( Convert.ToByte(vari["R"].ToString()), Convert.ToByte(vari["G"].ToString()), Convert.ToByte(vari["B"].ToString()))); OrangeCollect.Add(new ItemsColor() { Color = scb, Blue = Convert.ToByte(vari["B"].ToString()), NameColor = vari["noteRAL"].ToString(), Green = Convert.ToByte(vari["G"].ToString()), Red = Convert.ToByte(vari["R"].ToString()), NameColorRAL = "RAL " + vari["nameInRAL"].ToString().Trim() }); } if (Convert.ToInt32(vari["nameInRAL"].ToString()) >= 3000 && Convert.ToInt32(vari["nameInRAL"].ToString()) < 4000) { SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromRgb( Convert.ToByte(vari["R"].ToString()), Convert.ToByte(vari["G"].ToString()), Convert.ToByte(vari["B"].ToString()))); RedCollect.Add(new ItemsColor() { Color = scb, Blue = Convert.ToByte(vari["B"].ToString()), NameColor = vari["noteRAL"].ToString(), Green = Convert.ToByte(vari["G"].ToString()), Red = Convert.ToByte(vari["R"].ToString()), NameColorRAL = "RAL " + vari["nameInRAL"].ToString().Trim() }); } if (Convert.ToInt32(vari["nameInRAL"].ToString()) >= 4000 && Convert.ToInt32(vari["nameInRAL"].ToString()) < 5000) { SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromRgb( Convert.ToByte(vari["R"].ToString()), Convert.ToByte(vari["G"].ToString()), Convert.ToByte(vari["B"].ToString()))); VioletCollect.Add(new ItemsColor() { Color = scb, Blue = Convert.ToByte(vari["B"].ToString()), NameColor = vari["noteRAL"].ToString(), Green = Convert.ToByte(vari["G"].ToString()), Red = Convert.ToByte(vari["R"].ToString()), NameColorRAL = "RAL " + vari["nameInRAL"].ToString().Trim() }); } if (Convert.ToInt32(vari["nameInRAL"].ToString()) >= 5000 && Convert.ToInt32(vari["nameInRAL"].ToString()) < 6000) { SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromRgb( Convert.ToByte(vari["R"].ToString()), Convert.ToByte(vari["G"].ToString()), Convert.ToByte(vari["B"].ToString()))); BlueCollect.Add(new ItemsColor() { Color = scb, Blue = Convert.ToByte(vari["B"].ToString()), NameColor = vari["noteRAL"].ToString(), Green = Convert.ToByte(vari["G"].ToString()), Red = Convert.ToByte(vari["R"].ToString()), NameColorRAL = "RAL " + vari["nameInRAL"].ToString().Trim() }); } if (Convert.ToInt32(vari["nameInRAL"].ToString()) >= 6000 && Convert.ToInt32(vari["nameInRAL"].ToString()) < 7000) { SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromRgb( Convert.ToByte(vari["R"].ToString()), Convert.ToByte(vari["G"].ToString()), Convert.ToByte(vari["B"].ToString()))); GreenCollect.Add(new ItemsColor() { Color = scb, Blue = Convert.ToByte(vari["B"].ToString()), NameColor = vari["noteRAL"].ToString(), Green = Convert.ToByte(vari["G"].ToString()), Red = Convert.ToByte(vari["R"].ToString()), NameColorRAL = "RAL " + vari["nameInRAL"].ToString().Trim() }); } if (Convert.ToInt32(vari["nameInRAL"].ToString()) >= 7000 && Convert.ToInt32(vari["nameInRAL"].ToString()) < 8000) { SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromRgb( Convert.ToByte(vari["R"].ToString()), Convert.ToByte(vari["G"].ToString()), Convert.ToByte(vari["B"].ToString()))); GrayCollect.Add(new ItemsColor() { Color = scb, Blue = Convert.ToByte(vari["B"].ToString()), NameColor = vari["noteRAL"].ToString(), Green = Convert.ToByte(vari["G"].ToString()), Red = Convert.ToByte(vari["R"].ToString()), NameColorRAL = "RAL " + vari["nameInRAL"].ToString().Trim() }); } if (Convert.ToInt32(vari["nameInRAL"].ToString()) >= 8000 && Convert.ToInt32(vari["nameInRAL"].ToString()) < 9000) { SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromRgb( Convert.ToByte(vari["R"].ToString()), Convert.ToByte(vari["G"].ToString()), Convert.ToByte(vari["B"].ToString()))); BrownCollect.Add(new ItemsColor() { Color = scb, Blue = Convert.ToByte(vari["B"].ToString()), NameColor = vari["noteRAL"].ToString(), Green = Convert.ToByte(vari["G"].ToString()), Red = Convert.ToByte(vari["R"].ToString()), NameColorRAL = "RAL " + vari["nameInRAL"].ToString().Trim() }); } if (Convert.ToInt32(vari["nameInRAL"].ToString()) >= 9000) { SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromRgb( Convert.ToByte(vari["R"].ToString()), Convert.ToByte(vari["G"].ToString()), Convert.ToByte(vari["B"].ToString()))); BlackAndWhiteCollect.Add(new ItemsColor() { Color = scb, Blue = Convert.ToByte(vari["B"].ToString()), NameColor = vari["noteRAL"].ToString(), Green = Convert.ToByte(vari["G"].ToString()), Red = Convert.ToByte(vari["R"].ToString()), NameColorRAL = "RAL " + vari["nameInRAL"].ToString().Trim() }); } } }
public static void GameActionFightSpellCastMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { GameActionFightSpellCastMessage msg = (GameActionFightSpellCastMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } if (account.Fight != null) { BFighter fighter = (BFighter)account.Fight.GetFighter(msg.targetId); if (fighter != null && account.Fight.Fighter != null && fighter.Id == account.Fight.Fighter.Id) { int spellLevel = -1; BlueSheep.Common.Types.Spell spell = account.Spells.FirstOrDefault(s => s.Id == msg.spellId); if (spell != null) { spellLevel = spell.Level; } if (spellLevel != -1) { DataClass spellData = GameData.GetDataObject(D2oFileEnum.Spells, msg.spellId); if (spellData != null) { uint spellLevelId = (uint)((ArrayList)spellData.Fields["spellLevels"])[spellLevel - 1]; DataClass spellLevelData = GameData.GetDataObject(D2oFileEnum.SpellLevels, (int)spellLevelId); if (spellLevelData != null) { if ((int)spellLevelData.Fields["minCastInterval"] > 0 && !(account.Fight.LastTurnLaunchBySpell.ContainsKey(msg.spellId))) { account.Fight.LastTurnLaunchBySpell.Add(msg.spellId, (int)spellLevelData.Fields["minCastInterval"]); } if (account.Fight.TotalLaunchBySpell.ContainsKey(msg.spellId)) //Si on a déjà utilisé ce sort ce tour { account.Fight.TotalLaunchBySpell[msg.spellId] += 1; } else { account.Fight.TotalLaunchBySpell.Add(msg.spellId, 1); } if (account.Fight.TotalLaunchByCellBySpell.ContainsKey(msg.spellId)) //Si on a déjà utilisé ce sort ce tour { if (account.Fight.TotalLaunchByCellBySpell[msg.spellId].ContainsKey(msg.destinationCellId)) //Si on a déjà utilisé ce sort sur cette case { account.Fight.TotalLaunchByCellBySpell[msg.spellId][msg.destinationCellId] += 1; } else { account.Fight.TotalLaunchByCellBySpell[msg.spellId].Add(msg.destinationCellId, 1); } } else { Dictionary <int, int> tempdico = new Dictionary <int, int>(); tempdico.Add(msg.destinationCellId, 1); account.Fight.TotalLaunchByCellBySpell.Add(msg.spellId, tempdico); } } } } } } }
/// <summary> /// 获取片区 /// </summary> /// <param name="subAreaName">片区名称</param> /// <param name="cityId">城市id</param> /// <param name="_db"></param> /// <returns></returns> public static SysData_SubArea GetAreaByAreaNameByCityId(string subAreaName, int cityId, DataClass _db = null) { DataClass db = new DataClass(_db); SysData_SubArea subArea = null; string sql = string.Format("select top 1 * from SysData_SubArea with(nolock) where CityId={0} and (SubAreaName like '%{1}%' or '{1}' like '%'+SubAreaName+'%')", cityId, subAreaName); subArea = db.DB.ExecuteQuery<SysData_SubArea>(sql).FirstOrDefault(); //subArea = db.DB.SysData_SubArea.FirstOrDefault(p => p.CityId == cityId && (SqlMethods.Like(p.SubAreaName, "%" + subAreaName + "%") || SqlMethods.Like(subAreaName, "%" + p.SubAreaName + "%"))); db.Connection_Close(); db.Dispose(); return subArea; }
void Setup(PrivacyDetailViewController vc, DataClass type) { IPrivacyManager manager = null; switch (type) { case DataClass.Reminders: manager = new EKEntityPrivacyManager(EKEntityType.Reminder); break; case DataClass.Calendars: manager = new EKEntityPrivacyManager(EKEntityType.Event); break; case DataClass.Facebook: manager = new SocialNetworkPrivacyManager(ACAccountType.Facebook); break; case DataClass.Twitter: manager = new SocialNetworkPrivacyManager(ACAccountType.Twitter); break; case DataClass.SinaWeibo: manager = new SocialNetworkPrivacyManager(ACAccountType.SinaWeibo); break; case DataClass.TencentWeibo: manager = new SocialNetworkPrivacyManager(ACAccountType.TencentWeibo); break; case DataClass.Notifications: manager = new NotificationsPrivacyManager((AppDelegate)UIApplication.SharedApplication.Delegate); break; case DataClass.Contacts: manager = new AddressBookPrivacyManager(); break; case DataClass.Photos: manager = new PhotoPrivacyManager(); break; case DataClass.Video: manager = new VideoCapturePrivacyManager(); break; case DataClass.Microphone: manager = new MicrophonePrivacyManager(); break; case DataClass.Bluetooth: manager = new BluetoothPrivacyManager(); break; case DataClass.Advertising: manager = new AdvertisingPrivacyManager(); break; default: throw new NotImplementedException(); } vc.PrivacyManager = manager; }
/// <summary> /// 插入一条片区 /// </summary> /// <param name="subAreaName"></param> /// <param name="cityId"></param> /// <param name="webId"></param> /// <param name="_db"></param> /// <returns></returns> public static SysData_SubArea InsertArea(string subAreaName, int cityId, int webId, DataClass _db = null) { DataClass db = new DataClass(_db); SysData_SubArea subArea = new SysData_SubArea(); subArea.SubAreaName = subAreaName; subArea.CityId = cityId; subArea.WebId = webId; subArea = Insert(subArea); db.Connection_Close(); db.Dispose(); return subArea; }
public string GetFeesSubjectClassParentStr(int FeesSubjectClassID, string sStr) { return(DataClass.GetFeesSubjectClassParentStr(FeesSubjectClassID, sStr)); }
public static T WriteSummary <T>(this T writerWrapper, DataClass dataClass) where T : IWriterWrapper { return(writerWrapper.WriteSummary(GetUsedWithinText(dataClass.Tool))); }
private void LoadItemData() { ProductPackage clsProductPackage = new ProductPackage(); try { DataClass clsData = new DataClass(); System.Data.DataTable dt = clsData.DataReaderToDataTable(clsProductPackage.List(mDetails.ProductID,"ProductDesc",SortOption.Ascending)); clsProductPackage.CommitAndDispose(); //dt.TableName = "tblProductPackage"; this.dgStyle.MappingName = dt.TableName; dgItems.DataSource = dt; dgItems.Select(0); dgItems.CurrentRowIndex=0; } catch (Exception ex) { clsProductPackage.CommitAndDispose(); MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error); } }
public static T WriteSummary <T>(this T writerWrapper, DataClass dataClass) where T : IWriterWrapper { return(writerWrapper.WriteSummary($"Used within <see cref={dataClass.Tool.GetClassName().DoubleQuote()}/>.")); }
private void LoadItemData() { try { DataClass clsData = new DataClass(); ProductPackage clsProductPackage = new ProductPackage(); System.Data.DataTable dt = clsData.DataReaderToDataTable(clsProductPackage.List(mDetails.ProductID, "ProductDesc", SortOption.Ascending)); clsProductPackage.CommitAndDispose(); lstItems.Items.Clear(); int iImgCtr = 0; foreach (System.Data.DataRow dr in dt.Rows) { if (mboIsPriceInq) lstItems.Items.Add(dr["PackageID"].ToString(), "[" + dr["Price"].ToString() + "]" + Environment.NewLine + dr["Quantity"].ToString() + " " + dr["UnitCode"].ToString() + " - " + dr["ProductDesc"].ToString(), iImgCtr); else lstItems.Items.Add(dr["PackageID"].ToString(), dr["Quantity"].ToString() + " " + dr["UnitCode"].ToString() + " - " + dr["ProductDesc"].ToString(), iImgCtr); if (iImgCtr == 7) iImgCtr = 0; else iImgCtr++; } try { lstItems.Items[0].Selected = true; } catch { } } catch (Exception ex) { MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { using (ExcelPackage xlPackage = new ExcelPackage(new FileInfo(@"C:\Users\Utkarsh Saxena\Downloads\LevelIndicator.xlsx"))) { var myWorksheet = xlPackage.Workbook.Worksheets.First(); //select sheet here var totalRows = myWorksheet.Dimension.End.Row; // var totalColumns = myWorksheet.Dimension.End.Column; var totalColumns = 8; var sb = new StringBuilder(); //this is your data for (int rowNum = 3; rowNum <= totalRows; rowNum++) //select starting row here { var row = myWorksheet.Cells[rowNum, 1, rowNum, totalColumns].Select(c => c.Value == null ? string.Empty : c.Value.ToString()); sb.AppendLine(string.Join(";", row)); } sb = sb.Replace(System.Environment.NewLine, "|"); int count = 0; foreach (char c in sb.ToString()) { if (c.Equals('|')) { count++; } } String final = sb.ToString().Substring(0, sb.Length - 1); String[] modelstrings = final.Split('|'); //model create from here for (int i = 0; i < count; i++) { DataClass dataclass = new DataClass(); // Date; Symbol; Expiry Date; Open; High; Low; Close; Pclose dataclass.date = modelstrings[i].Split(';')[0]; dataclass.Symbol = modelstrings[i].Split(';')[1]; dataclass.Expiry = modelstrings[i].Split(';')[2]; dataclass.Open = modelstrings[i].Split(';')[3]; dataclass.High = modelstrings[i].Split(';')[4]; dataclass.Low = modelstrings[i].Split(';')[5]; dataclass.Close = modelstrings[i].Split(';')[6]; dataclass.Pclose = modelstrings[i].Split(';')[7]; dataClasses.Add(dataclass); } for (int i = 1; i < dataClasses.Count; i++) { dataClasses[i].PVT = npvt(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = fpvt(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = ns1(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = ns2(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = ns3(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = nr1(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = nr2(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = nr3(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = fs1(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = fr1(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = fs2(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = fr2(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = fs3(dataClasses[i - 1], dataClasses[i]); dataClasses[i].PVT = fr3(dataClasses[i - 1], dataClasses[i]); } Console.WriteLine(dataClasses[0].date); } }