text
stringlengths
13
6.01M
using UnityEngine; public class InitCameraFollowToCurrentCarScript : MonoBehaviour { void Start() { foreach (var item in GetComponents<IFollowScript>()) item.SetFollowTarget(SteeringScript.MainInstance.transform); } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using Kadastr.Data.Model; using Kadastr.Data.DB; namespace Kadastr.View.Forms { public partial class GovernanceAdd : DevExpress.XtraEditors.XtraForm { int GovernanceId = 0; public GovernanceAdd(int? Id = null) { InitializeComponent(); if (Id != null) { GovernanceId = (int)Id; } } private void simpleButton1_Click(object sender, EventArgs e) { Governance governance = new Governance { Name = textEdit1.Text, INN = textEdit2.Text, OGRN = textEdit3.Text, Email = textEdit4.Text }; governance.AddressOrganization = (buttonEdit1.Text != null) ? new Address { //Сведения об адресе } : null; if (GovernanceId == 0) { Entity.Insert(governance); } else { governance.Id = GovernanceId; Entity.Update(governance); } } } }
using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.Extensions.Logging; using YH.SAAS.Domain; namespace DemoEF.Domain.Models { public partial class db_lj_orderContext : DbContext { public db_lj_orderContext() { } public db_lj_orderContext(DbContextOptions<db_lj_orderContext> options) : base(options) { } public virtual DbSet<TbAccount> TbAccount { get; set; } public virtual DbSet<TbDecoratorPerson> TbDecoratorPerson { get; set; } public virtual DbSet<TbDecoratorSetting> TbDecoratorSetting { get; set; } public virtual DbSet<TbDecoratorSnapshot> TbDecoratorSnapshot { get; set; } public virtual DbSet<TbFinanceAccount> TbFinanceAccount { get; set; } public virtual DbSet<TbFinanceBill> TbFinanceBill { get; set; } public virtual DbSet<TbFinanceEntity> TbFinanceEntity { get; set; } public virtual DbSet<TbFinanceMonthbill> TbFinanceMonthbill { get; set; } public virtual DbSet<TbOrder> TbOrder { get; set; } public virtual DbSet<TbOrderActive> TbOrderActive { get; set; } public virtual DbSet<TbOrderAssign> TbOrderAssign { get; set; } public virtual DbSet<TbOrderCompleted> TbOrderCompleted { get; set; } public virtual DbSet<TbOrderDecoratorFlow> TbOrderDecoratorFlow { get; set; } public virtual DbSet<TbOrderDispatch> TbOrderDispatch { get; set; } public virtual DbSet<TbOrderFeedback> TbOrderFeedback { get; set; } public virtual DbSet<TbOrderFlow> TbOrderFlow { get; set; } public virtual DbSet<TbOrderLog> TbOrderLog { get; set; } public virtual DbSet<TbOrderMeasurement> TbOrderMeasurement { get; set; } public virtual DbSet<TbOrderOperation> TbOrderOperation { get; set; } public virtual DbSet<TbOrderRefund> TbOrderRefund { get; set; } public virtual DbSet<TbOrderRefundAudit> TbOrderRefundAudit { get; set; } public virtual DbSet<TbOrderServicemeasurement> TbOrderServicemeasurement { get; set; } public virtual DbSet<TbOrderServicesign> TbOrderServicesign { get; set; } public virtual DbSet<TbOrderServicetrack> TbOrderServicetrack { get; set; } public virtual DbSet<TbOrderSign> TbOrderSign { get; set; } public virtual DbSet<TbOrderStruck> TbOrderStruck { get; set; } public virtual DbSet<TbOrderSupervise> TbOrderSupervise { get; set; } public virtual DbSet<TbOrderTrack> TbOrderTrack { get; set; } public virtual DbSet<TbOrderWastage> TbOrderWastage { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { optionsBuilder.UseMySql("Data Source=localhost;port=3306;Initial Catalog=db_lj_order;user id=root;password=Jianglei105;Character Set=utf8;SslMode=None;"); } //var loggerFactory = new LoggerFactory(); //loggerFactory.AddProvider(new EFLoggerProvider()); //optionsBuilder.UseLoggerFactory(loggerFactory); } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<TbAccount>(entity => { entity.HasKey(e => e.UserId); entity.ToTable("tb_account"); entity.Property(e => e.UserId) .HasColumnName("userId") .HasColumnType("bigint(20)"); entity.Property(e => e.Account) .HasColumnName("account") .HasColumnType("varchar(100)"); entity.Property(e => e.AccountConfig) .HasColumnName("account_config") .HasColumnType("varchar(2048)"); entity.Property(e => e.AccountState) .HasColumnName("account_state") .HasColumnType("int(200)"); entity.Property(e => e.Addr) .HasColumnName("addr") .HasColumnType("varchar(1000)"); entity.Property(e => e.CompanyLevel) .HasColumnName("company_level") .HasColumnType("varchar(100)"); entity.Property(e => e.DecoratorLevel) .HasColumnName("decorator_level") .HasColumnType("int(11)") .HasDefaultValueSql("'10'"); entity.Property(e => e.DecoratorReceiveArea) .HasColumnName("decorator_receive_area") .HasColumnType("varchar(1000)"); entity.Property(e => e.DecoratorTags) .HasColumnName("decorator_tags") .HasColumnType("varchar(1000)"); entity.Property(e => e.Email) .HasColumnName("email") .HasColumnType("varchar(200)"); entity.Property(e => e.Name) .HasColumnName("name") .HasColumnType("varchar(100)"); entity.Property(e => e.Oldpwd) .HasColumnName("oldpwd") .HasColumnType("varchar(100)"); entity.Property(e => e.Openid) .HasColumnName("openid") .HasColumnType("varchar(100)"); entity.Property(e => e.Pwd) .HasColumnName("pwd") .HasColumnType("varchar(100)"); entity.Property(e => e.RegistTime) .HasColumnName("regist_time") .HasColumnType("datetime"); entity.Property(e => e.Role) .HasColumnName("role") .HasColumnType("varchar(100)"); entity.Property(e => e.Tels) .HasColumnName("tels") .HasColumnType("varchar(1000)"); }); modelBuilder.Entity<TbDecoratorPerson>(entity => { entity.ToTable("tb_decorator_person"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OppUser) .HasColumnName("opp_user") .HasColumnType("varchar(32)"); entity.Property(e => e.Person) .HasColumnName("person") .HasColumnType("varchar(32)"); entity.Property(e => e.PersonTel) .HasColumnName("person_tel") .HasColumnType("varchar(32)"); entity.Property(e => e.Position) .HasColumnName("position") .HasColumnType("varchar(32)"); }); modelBuilder.Entity<TbDecoratorSetting>(entity => { entity.ToTable("tb_decorator_setting"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.Address) .HasColumnName("address") .HasColumnType("varchar(1024)"); entity.Property(e => e.CompanyLevel) .HasColumnName("company_level") .HasColumnType("varchar(255)"); entity.Property(e => e.DayPolicy) .HasColumnName("day_policy") .HasColumnType("int(11)"); entity.Property(e => e.DecoratorStatus) .HasColumnName("decorator_status") .HasColumnType("int(11)"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(32)"); entity.Property(e => e.Jsontext) .HasColumnName("jsontext") .HasColumnType("text"); entity.Property(e => e.MonthPolicy) .HasColumnName("month_policy") .HasColumnType("int(11)"); entity.Property(e => e.OppUser) .HasColumnName("opp_user") .HasColumnType("varchar(32)"); entity.Property(e => e.OtherJsontext) .HasColumnName("other_jsontext") .HasColumnType("varchar(1024)"); }); modelBuilder.Entity<TbDecoratorSnapshot>(entity => { entity.ToTable("tb_decorator_snapshot"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.AskStarttime) .HasColumnName("ask_starttime") .HasColumnType("datetime"); entity.Property(e => e.AskState) .HasColumnName("ask_state") .HasColumnType("int(11)"); entity.Property(e => e.AssignType) .HasColumnName("assign_type") .HasColumnType("varchar(100)"); entity.Property(e => e.AssignUser) .HasColumnName("assign_user") .HasColumnType("bigint(100)"); entity.Property(e => e.AssignUsername) .HasColumnName("assign_username") .HasColumnType("varchar(100)"); entity.Property(e => e.BuildType) .HasColumnName("build_type") .HasColumnType("varchar(100)"); entity.Property(e => e.Building) .HasColumnName("building") .HasColumnType("varchar(100)"); entity.Property(e => e.City) .HasColumnName("city") .HasColumnType("varchar(100)"); entity.Property(e => e.CurOrderstate) .HasColumnName("cur_orderstate") .HasColumnType("int(11)"); entity.Property(e => e.CustomerAddrArea) .HasColumnName("customer_addr_area") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerAddrCommunity) .HasColumnName("customer_addr_community") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerAddrHourse) .HasColumnName("customer_addr_hourse") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerBudget) .HasColumnName("customer_budget") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerChudanbeizhu) .HasColumnName("customer_chudanbeizhu") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerChudanyuan) .HasColumnName("customer_chudanyuan") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerLevel) .HasColumnName("customer_level") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerMeasurementTime) .HasColumnName("customer_measurement_time") .HasColumnType("datetime"); entity.Property(e => e.CustomerName) .HasColumnName("customer_name") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerOrderNo) .HasColumnName("customer_order_no") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerOrderStatus) .HasColumnName("customer_order_status") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerOrderTags) .HasColumnName("customer_order_tags") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerPrice) .HasColumnName("customer_price") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerRegistTime) .HasColumnName("customer_regist_time") .HasColumnType("varchar(32)"); entity.Property(e => e.CustomerRoomSize) .HasColumnName("customer_room_size") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerRoomType) .HasColumnName("customer_room_type") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerSituation) .HasColumnName("customer_situation") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerTel) .HasColumnName("customer_tel") .HasColumnType("varchar(100)"); entity.Property(e => e.DecorationStyle) .HasColumnName("decoration_style") .HasColumnType("varchar(100)"); entity.Property(e => e.DecorationType) .HasColumnName("decoration_type") .HasColumnType("varchar(100)"); entity.Property(e => e.DecorationWay) .HasColumnName("decoration_way") .HasColumnType("varchar(100)"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(200)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(100)"); entity.Property(e => e.DispatchCount) .HasColumnName("dispatch_count") .HasColumnType("int(11)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(100)"); entity.Property(e => e.Isnew) .HasColumnName("isnew") .HasColumnType("int(11)"); entity.Property(e => e.Isurgent) .HasColumnName("isurgent") .HasColumnType("int(11)"); entity.Property(e => e.LastUpdateTime) .HasColumnName("last_update_time") .HasColumnType("datetime"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("varchar(32)"); entity.Property(e => e.ProjectCost) .HasColumnName("project_cost") .HasColumnType("varchar(100)"); entity.Property(e => e.Province) .HasColumnName("province") .HasColumnType("varchar(100)"); entity.Property(e => e.ReceiveCount) .HasColumnName("receive_count") .HasColumnType("int(11)"); entity.Property(e => e.ReceiveUsername) .HasColumnName("receive_username") .HasColumnType("varchar(100)"); entity.Property(e => e.SignComment) .HasColumnName("sign_comment") .HasColumnType("text"); entity.Property(e => e.SignCompany) .HasColumnName("sign_company") .HasColumnType("bigint(20)"); entity.Property(e => e.SignPrice) .HasColumnName("sign_price") .HasColumnType("varchar(32)"); entity.Property(e => e.SignStartTime) .HasColumnName("sign_start_time") .HasColumnType("datetime"); entity.Property(e => e.SignState) .HasColumnName("sign_state") .HasColumnType("varchar(32)"); entity.Property(e => e.SignTime) .HasColumnName("sign_time") .HasColumnType("datetime"); entity.Property(e => e.TrackAssignTime) .HasColumnName("track_assign_time") .HasColumnType("datetime"); entity.Property(e => e.TrackId) .HasColumnName("track_id") .HasColumnType("bigint(20)"); entity.Property(e => e.TrackUser) .HasColumnName("track_user") .HasColumnType("bigint(20)"); entity.Property(e => e.TrackUsername) .HasColumnName("track_username") .HasColumnType("varchar(100)"); entity.Property(e => e.TypeinComment) .HasColumnName("typein_comment") .HasColumnType("text"); entity.Property(e => e.TypeinState) .HasColumnName("typein_state") .HasColumnType("int(11)"); entity.Property(e => e.TypeinTime) .HasColumnName("typein_time") .HasColumnType("datetime"); entity.Property(e => e.TypeinUser) .HasColumnName("typein_user") .HasColumnType("bigint(20)"); entity.Property(e => e.TypeinUsername) .HasColumnName("typein_username") .HasColumnType("varchar(100)"); }); modelBuilder.Entity<TbFinanceAccount>(entity => { entity.ToTable("tb_finance_account"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AccountPwd) .HasColumnName("account_pwd") .HasColumnType("varchar(32)"); entity.Property(e => e.AccountStatus) .HasColumnName("account_status") .HasColumnType("varchar(32)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(32)"); entity.Property(e => e.Remarks) .HasColumnName("remarks") .HasColumnType("text"); entity.Property(e => e.UpdateTime) .HasColumnName("update_time") .HasColumnType("datetime"); }); modelBuilder.Entity<TbFinanceBill>(entity => { entity.ToTable("tb_finance_bill"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AccountId) .HasColumnName("account_id") .HasColumnType("varchar(32)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.CustomerOrderNo) .HasColumnName("customer_order_no") .HasColumnType("varchar(32)"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("varchar(32)"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(1024)"); entity.Property(e => e.ExtData) .HasColumnName("ext_data") .HasColumnType("varchar(1024)"); entity.Property(e => e.Fk1Str) .HasColumnName("fk1_str") .HasColumnType("varchar(1024)"); entity.Property(e => e.Fk2Str) .HasColumnName("fk2_str") .HasColumnType("varchar(1024)"); entity.Property(e => e.Fk3Str) .HasColumnName("fk3_str") .HasColumnType("varchar(1024)"); entity.Property(e => e.Fk4Str) .HasColumnName("fk4_str") .HasColumnType("varchar(1024)"); entity.Property(e => e.FromBalance) .HasColumnName("from_balance") .HasColumnType("decimal(32,8)"); entity.Property(e => e.FromEntityId) .HasColumnName("from_entity_id") .HasColumnType("bigint(20)"); entity.Property(e => e.FromEntityType) .HasColumnName("from_entity_type") .HasColumnType("int(11)"); entity.Property(e => e.FromTradeMoney) .HasColumnName("from_trade_money") .HasColumnType("decimal(32,8)"); entity.Property(e => e.FromTradeRemarks) .HasColumnName("from_trade_remarks") .HasColumnType("varchar(1024)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("varchar(32)"); entity.Property(e => e.PayType) .HasColumnName("pay_type") .HasColumnType("int(11)"); entity.Property(e => e.ToBalance) .HasColumnName("to_balance") .HasColumnType("decimal(32,8)"); entity.Property(e => e.ToEntityId) .HasColumnName("to_entity_id") .HasColumnType("bigint(20)"); entity.Property(e => e.ToEntityType) .HasColumnName("to_entity_type") .HasColumnType("int(11)"); entity.Property(e => e.ToTradeMoney) .HasColumnName("to_trade_money") .HasColumnType("decimal(32,8)"); entity.Property(e => e.ToTradeRemarks) .HasColumnName("to_trade_remarks") .HasColumnType("varchar(1024)"); entity.Property(e => e.TradeNo) .HasColumnName("trade_no") .HasColumnType("varchar(32)"); entity.Property(e => e.TradeTime) .HasColumnName("trade_time") .HasColumnType("datetime"); entity.Property(e => e.TransRemark) .HasColumnName("trans_remark") .HasColumnType("varchar(1024)"); entity.Property(e => e.TransType) .HasColumnName("trans_type") .HasColumnType("int(11)"); entity.Property(e => e.UserRemarks) .HasColumnName("user_remarks") .HasColumnType("varchar(1024)"); }); modelBuilder.Entity<TbFinanceEntity>(entity => { entity.ToTable("tb_finance_entity"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AccountId) .HasColumnName("account_id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.Balance) .HasColumnName("balance") .HasColumnType("decimal(32,8)"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(32)"); entity.Property(e => e.Dopolicycount) .HasColumnName("dopolicycount") .HasColumnType("int(11)"); entity.Property(e => e.EndPolicytime) .HasColumnName("end_policytime") .HasColumnType("datetime"); entity.Property(e => e.EntityType) .HasColumnName("entity_type") .HasColumnType("int(11)"); entity.Property(e => e.StartPolicytime) .HasColumnName("start_policytime") .HasColumnType("datetime"); entity.Property(e => e.UpdateTime) .HasColumnName("update_time") .HasColumnType("datetime"); }); modelBuilder.Entity<TbFinanceMonthbill>(entity => { entity.ToTable("tb_finance_monthbill"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AccountId) .HasColumnName("account_id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.Balance) .HasColumnName("balance") .HasColumnType("decimal(32,8)"); entity.Property(e => e.Cost) .HasColumnName("cost") .HasColumnType("decimal(32,8)"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(32)"); entity.Property(e => e.Monthdate) .HasColumnName("monthdate") .HasColumnType("date"); entity.Property(e => e.PreviousBalance) .HasColumnName("previous_balance") .HasColumnType("decimal(32,8)"); }); modelBuilder.Entity<TbOrder>(entity => { entity.ToTable("tb_order"); entity.HasIndex(e => e.CustomerOrderNo) .HasName("customer_order_no"); entity.HasIndex(e => e.CustomerTel) .HasName("customer_tel"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AskStarttime) .HasColumnName("ask_starttime") .HasColumnType("datetime"); entity.Property(e => e.AskState) .HasColumnName("ask_state") .HasColumnType("int(11)") .HasDefaultValueSql("'20'"); entity.Property(e => e.CustomerAddrArea) .HasColumnName("customer_addr_area") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerAddrCommunity) .HasColumnName("customer_addr_community") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerAddrHourse) .HasColumnName("customer_addr_hourse") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerBudget) .HasColumnName("customer_budget") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerChudanbeizhu) .HasColumnName("customer_chudanbeizhu") .HasColumnType("text"); entity.Property(e => e.CustomerChudanyuan) .HasColumnName("customer_chudanyuan") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerLevel) .HasColumnName("customer_level") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerMeasurementTime) .HasColumnName("customer_measurement_time") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerName) .HasColumnName("customer_name") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerOrderNo) .HasColumnName("customer_order_no") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerOrderStatus) .HasColumnName("customer_order_status") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerOrderTags) .HasColumnName("customer_order_tags") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerPrice) .HasColumnName("customer_price") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerRegistTime) .HasColumnName("customer_regist_time") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerRoomSize) .HasColumnName("customer_room_size") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerRoomType) .HasColumnName("customer_room_type") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerSituation) .HasColumnName("customer_situation") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerTel) .HasColumnName("customer_tel") .HasColumnType("varchar(100)"); entity.Property(e => e.LastUpdateTime) .HasColumnName("last_update_time") .HasColumnType("datetime"); entity.Property(e => e.ReceiveCount) .HasColumnName("receive_count") .HasColumnType("int(11)"); entity.Property(e => e.ReceiveUsername) .HasColumnName("receive_username") .HasColumnType("varchar(1000)"); entity.Property(e => e.SignComment) .HasColumnName("sign_comment") .HasColumnType("text"); entity.Property(e => e.SignCompany) .HasColumnName("sign_company") .HasColumnType("bigint(20)"); entity.Property(e => e.SignPrice) .HasColumnName("sign_price") .HasColumnType("varchar(100)"); entity.Property(e => e.SignStartTime) .HasColumnName("sign_start_time") .HasColumnType("datetime"); entity.Property(e => e.SignState) .HasColumnName("sign_state") .HasColumnType("int(11)"); entity.Property(e => e.SignTime) .HasColumnName("sign_time") .HasColumnType("datetime"); entity.Property(e => e.TrackAssignTime) .HasColumnName("track_assign_time") .HasColumnType("datetime"); entity.Property(e => e.TrackAssigner) .HasColumnName("track_assigner") .HasColumnType("bigint(20)"); entity.Property(e => e.TrackUser) .HasColumnName("track_user") .HasColumnType("bigint(20)"); entity.Property(e => e.TrackUsername) .HasColumnName("track_username") .HasColumnType("varchar(100)"); entity.Property(e => e.TypeinComment) .HasColumnName("typein_comment") .HasColumnType("text"); entity.Property(e => e.TypeinTime) .HasColumnName("typein_time") .HasColumnType("datetime"); entity.Property(e => e.TypeinUser) .HasColumnName("typein_user") .HasColumnType("bigint(20)"); entity.Property(e => e.TypeinUsername) .HasColumnName("typein_username") .HasColumnType("varchar(100)"); }); modelBuilder.Entity<TbOrderActive>(entity => { entity.ToTable("tb_order_active"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.ActiveReason) .HasColumnName("active_reason") .HasColumnType("varchar(32)"); entity.Property(e => e.ActiveState) .HasColumnName("active_state") .HasColumnType("varchar(32)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); }); modelBuilder.Entity<TbOrderAssign>(entity => { entity.ToTable("tb_order_assign"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AskTime) .HasColumnName("ask_time") .HasColumnType("datetime"); entity.Property(e => e.AssignState) .HasColumnName("assign_state") .HasColumnType("int(11)"); entity.Property(e => e.AssignTime) .HasColumnName("assign_time") .HasColumnType("datetime"); entity.Property(e => e.AssignUser) .HasColumnName("assign_user") .HasColumnType("bigint(20)"); entity.Property(e => e.ChargebackApplyComment) .HasColumnName("chargeback_apply_comment") .HasColumnType("text"); entity.Property(e => e.ChargebackApplyTime) .HasColumnName("chargeback_apply_time") .HasColumnType("datetime"); entity.Property(e => e.ChargebackState) .HasColumnName("chargeback_state") .HasColumnType("int(11)"); entity.Property(e => e.DecoratorTels) .HasColumnName("decorator_tels") .HasColumnType("varchar(200)"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(100)"); entity.Property(e => e.MeasurementComment) .HasColumnName("measurement_comment") .HasColumnType("text"); entity.Property(e => e.MeasurementState) .HasColumnName("measurement_state") .HasColumnType("int(11)"); entity.Property(e => e.MeasurementTime) .HasColumnName("measurement_time") .HasColumnType("datetime"); entity.Property(e => e.OrderId) .HasColumnName("order_id") .HasColumnType("bigint(20)"); entity.Property(e => e.PhoneBridgeCount) .HasColumnName("phone_bridge_count") .HasColumnType("int(11)"); entity.Property(e => e.PhoneBridgeExpireTime) .HasColumnName("phone_bridge_expire_time") .HasColumnType("datetime"); entity.Property(e => e.ReceiveComment) .HasColumnName("receive_comment") .HasColumnType("text"); entity.Property(e => e.ReceiveState) .HasColumnName("receive_state") .HasColumnType("int(11)"); entity.Property(e => e.ReceiveTime) .HasColumnName("receive_time") .HasColumnType("datetime"); entity.Property(e => e.SignState) .HasColumnName("sign_state") .HasColumnType("int(11)"); }); modelBuilder.Entity<TbOrderCompleted>(entity => { entity.ToTable("tb_order_completed"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.CompletedFinishWorktime) .HasColumnName("completed_finish_worktime") .HasColumnType("datetime"); entity.Property(e => e.CompletedPictureurl) .HasColumnName("completed_pictureurl") .HasColumnType("varchar(1024)"); entity.Property(e => e.CompletedStartWorktime) .HasColumnName("completed_start_worktime") .HasColumnType("datetime"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); }); modelBuilder.Entity<TbOrderDecoratorFlow>(entity => { entity.ToTable("tb_order_decorator_flow"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.ActiveId) .HasColumnName("active_id") .HasColumnType("bigint(20)"); entity.Property(e => e.ActiveTime) .HasColumnName("active_time") .HasColumnType("datetime"); entity.Property(e => e.AskTime) .HasColumnName("ask_time") .HasColumnType("datetime"); entity.Property(e => e.AssignState) .HasColumnName("assign_state") .HasColumnType("varchar(32)"); entity.Property(e => e.AssignTime) .HasColumnName("assign_time") .HasColumnType("datetime"); entity.Property(e => e.AssignType) .HasColumnName("assign_type") .HasColumnType("varchar(32)"); entity.Property(e => e.AssignUser) .HasColumnName("assign_user") .HasColumnType("bigint(20)"); entity.Property(e => e.CompleteState) .HasColumnName("complete_state") .HasColumnType("int(11)"); entity.Property(e => e.CompleteTime) .HasColumnName("complete_time") .HasColumnType("datetime"); entity.Property(e => e.CompletedId) .HasColumnName("completed_id") .HasColumnType("bigint(20)"); entity.Property(e => e.CurDecoreatorstate) .HasColumnName("cur_decoreatorstate") .HasColumnType("int(11)"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(32)"); entity.Property(e => e.DesignDirector) .HasColumnName("design_director") .HasColumnType("varchar(32)"); entity.Property(e => e.DesignDirectorBridgetel) .HasColumnName("design_director_bridgetel") .HasColumnType("varchar(255)"); entity.Property(e => e.DesignDirectorTel) .HasColumnName("design_director_tel") .HasColumnType("varchar(255)"); entity.Property(e => e.DesignateState) .HasColumnName("designate_state") .HasColumnType("int(11)"); entity.Property(e => e.Designer) .HasColumnName("designer") .HasColumnType("varchar(1024)"); entity.Property(e => e.DesignerBridgetel) .HasColumnName("designer_bridgetel") .HasColumnType("varchar(255)"); entity.Property(e => e.DesignerTel) .HasColumnName("designer_tel") .HasColumnType("varchar(1024)"); entity.Property(e => e.DispatchId) .HasColumnName("dispatch_id") .HasColumnType("bigint(20)"); entity.Property(e => e.FeedbackId) .HasColumnName("feedback_id") .HasColumnType("bigint(20)"); entity.Property(e => e.FeedbackTime) .HasColumnName("feedback_time") .HasColumnType("datetime"); entity.Property(e => e.MeasurementComment) .HasColumnName("measurement_comment") .HasColumnType("varchar(3048)"); entity.Property(e => e.MeasurementId) .HasColumnName("measurement_id") .HasColumnType("varchar(32)"); entity.Property(e => e.MeasurementNextflowupTime) .HasColumnName("measurement_nextflowup_time") .HasColumnType("datetime"); entity.Property(e => e.MeasurementState) .HasColumnName("measurement_state") .HasColumnType("int(11)"); entity.Property(e => e.MeasurementTime) .HasColumnName("measurement_time") .HasColumnType("datetime"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.PhoneBridgeCount) .HasColumnName("phone_bridge_count") .HasColumnType("int(11)"); entity.Property(e => e.PhoneBridgeExpireTime) .HasColumnName("phone_bridge_expire_time") .HasColumnType("datetime"); entity.Property(e => e.ReceiveComment) .HasColumnName("receive_comment") .HasColumnType("varchar(3048)"); entity.Property(e => e.ReceiveState) .HasColumnName("receive_state") .HasColumnType("int(11)"); entity.Property(e => e.ReceiveTime) .HasColumnName("receive_time") .HasColumnType("datetime"); entity.Property(e => e.RefundId) .HasColumnName("refund_id") .HasColumnType("bigint(20)"); entity.Property(e => e.RefundState) .HasColumnName("refund_state") .HasColumnType("int(11)"); entity.Property(e => e.ServiceBridgetel) .HasColumnName("service_bridgetel") .HasColumnType("varchar(255)"); entity.Property(e => e.ServiceName) .HasColumnName("service_name") .HasColumnType("varchar(32)"); entity.Property(e => e.ServiceTel) .HasColumnName("service_tel") .HasColumnType("varchar(255)"); entity.Property(e => e.SignId) .HasColumnName("sign_id") .HasColumnType("bigint(20)"); entity.Property(e => e.SignState) .HasColumnName("sign_state") .HasColumnType("int(11)"); entity.Property(e => e.SignTime) .HasColumnName("sign_time") .HasColumnType("datetime"); entity.Property(e => e.SnapshotId) .HasColumnName("snapshot_id") .HasColumnType("bigint(20)"); entity.Property(e => e.StartoperationState) .HasColumnName("startoperation_state") .HasColumnType("int(11)"); entity.Property(e => e.StartoperationTime) .HasColumnName("startoperation_time") .HasColumnType("datetime"); entity.Property(e => e.StruckId) .HasColumnName("struck_id") .HasColumnType("bigint(20)"); entity.Property(e => e.StruckNextflowupTime) .HasColumnName("struck_nextflowup_time") .HasColumnType("datetime"); entity.Property(e => e.StruckState) .HasColumnName("struck_state") .HasColumnType("int(11)"); entity.Property(e => e.StruckTime) .HasColumnName("struck_time") .HasColumnType("datetime"); entity.Property(e => e.SuperviseId) .HasColumnName("supervise_id") .HasColumnType("bigint(20)"); entity.Property(e => e.SuperviseState) .HasColumnName("supervise_state") .HasColumnType("int(11)"); entity.Property(e => e.SuperviseTime) .HasColumnName("supervise_time") .HasColumnType("datetime"); entity.Property(e => e.WastageId) .HasColumnName("wastage_id") .HasColumnType("bigint(20)"); entity.Property(e => e.WastageState) .HasColumnName("wastage_state") .HasColumnType("int(11)"); entity.Property(e => e.WastageTime) .HasColumnName("wastage_time") .HasColumnType("datetime"); }); modelBuilder.Entity<TbOrderDispatch>(entity => { entity.ToTable("tb_order_dispatch"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.AskTime) .HasColumnName("ask_time") .HasColumnType("datetime"); entity.Property(e => e.AssignState) .HasColumnName("assign_state") .HasColumnType("varchar(32)"); entity.Property(e => e.AssignTime) .HasColumnName("assign_time") .HasColumnType("datetime"); entity.Property(e => e.AssignUser) .HasColumnName("assign_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(32)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(255)"); entity.Property(e => e.MeasurementTime) .HasColumnName("measurement_time") .HasColumnType("datetime"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(255)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.ReceiveComment) .HasColumnName("receive_comment") .HasColumnType("text"); entity.Property(e => e.ReceiveState) .HasColumnName("receive_state") .HasColumnType("int(11)"); entity.Property(e => e.ReceiveTime) .HasColumnName("receive_time") .HasColumnType("datetime"); entity.Property(e => e.RejectReason) .HasColumnName("reject_reason") .HasColumnType("varchar(1024)"); }); modelBuilder.Entity<TbOrderFeedback>(entity => { entity.ToTable("tb_order_feedback"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.FeedbackRemarks) .HasColumnName("feedback_remarks") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); }); modelBuilder.Entity<TbOrderFlow>(entity => { entity.ToTable("tb_order_flow"); entity.HasIndex(e => e.CustomerOrderNo) .HasName("customer_order_no"); entity.HasIndex(e => e.CustomerTel) .HasName("customer_tel"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AskStarttime) .HasColumnName("ask_starttime") .HasColumnType("datetime"); entity.Property(e => e.AskState) .HasColumnName("ask_state") .HasColumnType("int(11)") .HasDefaultValueSql("'20'"); entity.Property(e => e.AssignCount) .HasColumnName("assign_count") .HasColumnType("int(11)"); entity.Property(e => e.AssignTime) .HasColumnName("assign_time") .HasColumnType("datetime"); entity.Property(e => e.AssignType) .HasColumnName("assign_type") .HasColumnType("int(11)"); entity.Property(e => e.BuildType) .HasColumnName("build_type") .HasColumnType("varchar(32)"); entity.Property(e => e.Building) .HasColumnName("building") .HasColumnType("varchar(32)"); entity.Property(e => e.City) .HasColumnName("city") .HasColumnType("varchar(32)"); entity.Property(e => e.CurOrderstate) .HasColumnName("cur_orderstate") .HasColumnType("int(11)"); entity.Property(e => e.CustomerAddrArea) .HasColumnName("customer_addr_area") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerAddrCommunity) .HasColumnName("customer_addr_community") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerAddrHourse) .HasColumnName("customer_addr_hourse") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerBudget) .HasColumnName("customer_budget") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerChudanbeizhu) .HasColumnName("customer_chudanbeizhu") .HasColumnType("text"); entity.Property(e => e.CustomerChudanyuan) .HasColumnName("customer_chudanyuan") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerLevel) .HasColumnName("customer_level") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerMeasurementTime) .HasColumnName("customer_measurement_time") .HasColumnType("datetime"); entity.Property(e => e.CustomerName) .HasColumnName("customer_name") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerOldmeasurementTime) .HasColumnName("customer_oldmeasurement_time") .HasColumnType("varchar(200)"); entity.Property(e => e.CustomerOrderNo) .HasColumnName("customer_order_no") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerOrderStatus) .HasColumnName("customer_order_status") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerOrderTags) .HasColumnName("customer_order_tags") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerPrice) .HasColumnName("customer_price") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerRegistTime) .HasColumnName("customer_regist_time") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerRoomSize) .HasColumnName("customer_room_size") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerRoomType) .HasColumnName("customer_room_type") .HasColumnType("varchar(100)"); entity.Property(e => e.CustomerSituation) .HasColumnName("customer_situation") .HasColumnType("varchar(1000)"); entity.Property(e => e.CustomerTel) .HasColumnName("customer_tel") .HasColumnType("varchar(100)"); entity.Property(e => e.DecorationStyle) .HasColumnName("decoration_style") .HasColumnType("varchar(32)"); entity.Property(e => e.DecorationType) .HasColumnName("decoration_type") .HasColumnType("varchar(32)"); entity.Property(e => e.DecorationWay) .HasColumnName("decoration_way") .HasColumnType("varchar(32)"); entity.Property(e => e.DispatchCount) .HasColumnName("dispatch_count") .HasColumnType("int(11)"); entity.Property(e => e.Isnew) .HasColumnName("isnew") .HasColumnType("int(11)"); entity.Property(e => e.Isurgent) .HasColumnName("isurgent") .HasColumnType("int(11)"); entity.Property(e => e.LastUpdateTime) .HasColumnName("last_update_time") .HasColumnType("datetime"); entity.Property(e => e.ProjectCost) .HasColumnName("project_cost") .HasColumnType("varchar(32)"); entity.Property(e => e.ProjectOrderstate) .HasColumnName("project_orderstate") .HasColumnType("int(11)"); entity.Property(e => e.Province) .HasColumnName("province") .HasColumnType("varchar(32)"); entity.Property(e => e.ReceiveCount) .HasColumnName("receive_count") .HasColumnType("int(11)"); entity.Property(e => e.ReceiveUsername) .HasColumnName("receive_username") .HasColumnType("varchar(1000)"); entity.Property(e => e.ServiceMeasurementId) .HasColumnName("service_measurement_id") .HasColumnType("bigint(11)"); entity.Property(e => e.ServiceMeasurementState) .HasColumnName("service_measurement_state") .HasColumnType("int(11)"); entity.Property(e => e.ServiceSignId) .HasColumnName("service_sign_id") .HasColumnType("bigint(11)"); entity.Property(e => e.ServiceSignState) .HasColumnName("service_sign_state") .HasColumnType("int(11)"); entity.Property(e => e.SignComment) .HasColumnName("sign_comment") .HasColumnType("text"); entity.Property(e => e.SignCompany) .HasColumnName("sign_company") .HasColumnType("bigint(20)"); entity.Property(e => e.SignPrice) .HasColumnName("sign_price") .HasColumnType("varchar(100)"); entity.Property(e => e.SignStartTime) .HasColumnName("sign_start_time") .HasColumnType("datetime"); entity.Property(e => e.SignState) .HasColumnName("sign_state") .HasColumnType("int(11)"); entity.Property(e => e.SignTime) .HasColumnName("sign_time") .HasColumnType("datetime"); entity.Property(e => e.TrackAssignTime) .HasColumnName("track_assign_time") .HasColumnType("datetime"); entity.Property(e => e.TrackId) .HasColumnName("track_id") .HasColumnType("bigint(20)"); entity.Property(e => e.TrackUser) .HasColumnName("track_user") .HasColumnType("bigint(20)"); entity.Property(e => e.TrackUsername) .HasColumnName("track_username") .HasColumnType("varchar(100)"); entity.Property(e => e.TypeinComment) .HasColumnName("typein_comment") .HasColumnType("text"); entity.Property(e => e.TypeinState) .HasColumnName("typein_state") .HasColumnType("int(11)"); entity.Property(e => e.TypeinTime) .HasColumnName("typein_time") .HasColumnType("datetime"); entity.Property(e => e.TypeinUser) .HasColumnName("typein_user") .HasColumnType("bigint(20)"); entity.Property(e => e.TypeinUsername) .HasColumnName("typein_username") .HasColumnType("varchar(100)"); }); modelBuilder.Entity<TbOrderLog>(entity => { entity.ToTable("tb_order_log"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.Content) .HasColumnName("content") .HasColumnType("text"); entity.Property(e => e.EventCategory) .IsRequired() .HasColumnName("event_category") .HasColumnType("varchar(100)"); entity.Property(e => e.EventType) .IsRequired() .HasColumnName("event_type") .HasColumnType("varchar(100)"); entity.Property(e => e.ExtData) .HasColumnName("ext_data") .HasColumnType("text"); entity.Property(e => e.FlowRemark) .HasColumnName("flow_remark") .HasColumnType("varchar(1000)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(100)"); entity.Property(e => e.OrderAssignId) .HasColumnName("order_assign_id") .HasColumnType("bigint(20)"); entity.Property(e => e.OrderId) .HasColumnName("order_id") .HasColumnType("bigint(20)"); }); modelBuilder.Entity<TbOrderMeasurement>(entity => { entity.ToTable("tb_order_measurement"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.MeasurementAddress) .HasColumnName("measurement_address") .HasColumnType("varchar(32)"); entity.Property(e => e.MeasurementAppointmentTime) .HasColumnName("measurement_appointment_time") .HasColumnType("datetime"); entity.Property(e => e.MeasurementFlowupTime) .HasColumnName("measurement_flowup_time") .HasColumnType("datetime"); entity.Property(e => e.MeasurementIntention) .HasColumnName("measurement_intention") .HasColumnType("varchar(32)"); entity.Property(e => e.MeasurementNextflowupTime) .HasColumnName("measurement_nextflowup_time") .HasColumnType("datetime"); entity.Property(e => e.MeasurementRecordtxt) .HasColumnName("measurement_recordtxt") .HasColumnType("varchar(2048)"); entity.Property(e => e.MeasurementRecordtype) .HasColumnName("measurement_recordtype") .HasColumnType("varchar(32)"); entity.Property(e => e.MeasurementState) .HasColumnName("measurement_state") .HasColumnType("varchar(32)"); entity.Property(e => e.MeasurementTime) .HasColumnName("measurement_time") .HasColumnType("datetime"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); }); modelBuilder.Entity<TbOrderOperation>(entity => { entity.ToTable("tb_order_operation"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.CurData) .HasColumnName("cur_data") .HasColumnType("text"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("varchar(20)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OptRole) .HasColumnName("opt_role") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(32)"); entity.Property(e => e.OrderNo) .HasColumnName("order_no") .HasColumnType("varchar(20)"); entity.Property(e => e.OrginData) .HasColumnName("orgin_data") .HasColumnType("text"); entity.Property(e => e.Remarks) .HasColumnName("remarks") .HasColumnType("varchar(512)"); }); modelBuilder.Entity<TbOrderRefund>(entity => { entity.ToTable("tb_order_refund"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.AuditId) .HasColumnName("audit_id") .HasColumnType("varchar(32)"); entity.Property(e => e.BillId) .HasColumnName("bill_id") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(255)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.Prove) .HasColumnName("prove") .HasColumnType("varchar(32)"); entity.Property(e => e.RefundContent) .HasColumnName("refund_content") .HasColumnType("varchar(32)"); entity.Property(e => e.RefundReason) .HasColumnName("refund_reason") .HasColumnType("varchar(32)"); entity.Property(e => e.RefundStatus) .HasColumnName("refund_status") .HasColumnType("int(11)"); }); modelBuilder.Entity<TbOrderRefundAudit>(entity => { entity.ToTable("tb_order_refund_audit"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AuditPerson) .HasColumnName("audit_person") .HasColumnType("bigint(32)"); entity.Property(e => e.AuditRemark) .HasColumnName("audit_remark") .HasColumnType("varchar(32)"); entity.Property(e => e.AuditResult) .HasColumnName("audit_result") .HasColumnType("int(32)"); entity.Property(e => e.AuditTime) .HasColumnName("audit_time") .HasColumnType("datetime"); entity.Property(e => e.RefundId) .HasColumnName("refund_id") .HasColumnType("varchar(32)"); }); modelBuilder.Entity<TbOrderServicemeasurement>(entity => { entity.ToTable("tb_order_servicemeasurement"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(255)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.ServiceMeasurementRecordtxt) .HasColumnName("service_measurement_recordtxt") .HasColumnType("varchar(32)"); entity.Property(e => e.ServiceMeasurementTime) .HasColumnName("service_measurement_time") .HasColumnType("datetime"); }); modelBuilder.Entity<TbOrderServicesign>(entity => { entity.ToTable("tb_order_servicesign"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorUser) .HasColumnName("decorator_user") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorUsername) .HasColumnName("decorator_username") .HasColumnType("varchar(32)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.ServiceRebateRate) .HasColumnName("service_rebate_rate") .HasColumnType("varchar(32)"); entity.Property(e => e.ServiceSignMoney) .HasColumnName("service_sign_money") .HasColumnType("decimal(32,8)"); entity.Property(e => e.ServiceSignTime) .HasColumnName("service_sign_time") .HasColumnType("datetime"); }); modelBuilder.Entity<TbOrderServicetrack>(entity => { entity.ToTable("tb_order_servicetrack"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.TrackComment) .HasColumnName("track_comment") .HasColumnType("text"); entity.Property(e => e.TrackTime) .HasColumnName("track_time") .HasColumnType("datetime"); entity.Property(e => e.TrackUser) .HasColumnName("track_user") .HasColumnType("bigint(20)"); entity.Property(e => e.TrackUsername) .HasColumnName("track_username") .HasColumnType("varchar(32)"); }); modelBuilder.Entity<TbOrderSign>(entity => { entity.ToTable("tb_order_sign"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.SignAddress) .HasColumnName("sign_address") .HasColumnType("varchar(32)"); entity.Property(e => e.SignBuildType) .HasColumnName("sign_build_type") .HasColumnType("varchar(32)"); entity.Property(e => e.SignContract) .HasColumnName("sign_contract") .HasColumnType("varchar(1024)"); entity.Property(e => e.SignCustomerName) .HasColumnName("sign_customer_name") .HasColumnType("varchar(32)"); entity.Property(e => e.SignCustomerTel) .HasColumnName("sign_customer_tel") .HasColumnType("varchar(32)"); entity.Property(e => e.SignDecorationWay) .HasColumnName("sign_decoration_way") .HasColumnType("varchar(32)"); entity.Property(e => e.SignFinishTime) .HasColumnName("sign_finish_time") .HasColumnType("datetime"); entity.Property(e => e.SignPrice) .HasColumnName("sign_price") .HasColumnType("varchar(32)"); entity.Property(e => e.SignStartTime) .HasColumnName("sign_start_time") .HasColumnType("datetime"); entity.Property(e => e.SignTime) .HasColumnName("sign_time") .HasColumnType("datetime"); }); modelBuilder.Entity<TbOrderStruck>(entity => { entity.ToTable("tb_order_struck"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.StruckFlowupTime) .HasColumnName("struck_flowup_time") .HasColumnType("datetime"); entity.Property(e => e.StruckIntention) .HasColumnName("struck_intention") .HasColumnType("varchar(32)"); entity.Property(e => e.StruckNextflowupTime) .HasColumnName("struck_nextflowup_time") .HasColumnType("datetime"); entity.Property(e => e.StruckProgress) .HasColumnName("struck_progress") .HasColumnType("varchar(32)"); entity.Property(e => e.StruckRecordtxt) .HasColumnName("struck_recordtxt") .HasColumnType("varchar(32)"); entity.Property(e => e.StruckRecordtype) .HasColumnName("struck_recordtype") .HasColumnType("varchar(32)"); entity.Property(e => e.StruckState) .HasColumnName("struck_state") .HasColumnType("varchar(32)"); }); modelBuilder.Entity<TbOrderSupervise>(entity => { entity.ToTable("tb_order_supervise"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.SuperviseContent) .HasColumnName("supervise_content") .HasColumnType("text"); entity.Property(e => e.SuperviseState) .HasColumnName("supervise_state") .HasColumnType("varchar(32)"); }); modelBuilder.Entity<TbOrderTrack>(entity => { entity.ToTable("tb_order_track"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.NextTrackTime) .HasColumnName("next_track_time") .HasColumnType("varchar(1000)"); entity.Property(e => e.OrderId) .HasColumnName("order_id") .HasColumnType("bigint(20)"); entity.Property(e => e.TrackComment) .HasColumnName("track_comment") .HasColumnType("text"); entity.Property(e => e.TrackTime) .HasColumnName("track_time") .HasColumnType("datetime"); entity.Property(e => e.TrackUser) .HasColumnName("track_user") .HasColumnType("bigint(20)"); entity.Property(e => e.TrackUsername) .HasColumnName("track_username") .HasColumnType("varchar(100)"); }); modelBuilder.Entity<TbOrderWastage>(entity => { entity.ToTable("tb_order_wastage"); entity.Property(e => e.Id) .HasColumnName("id") .HasColumnType("bigint(20)"); entity.Property(e => e.AddTime) .HasColumnName("add_time") .HasColumnType("datetime"); entity.Property(e => e.DecoratorFlowId) .HasColumnName("decorator_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.EventType) .HasColumnName("event_type") .HasColumnType("varchar(32)"); entity.Property(e => e.OptUser) .HasColumnName("opt_user") .HasColumnType("bigint(20)"); entity.Property(e => e.OptUsername) .HasColumnName("opt_username") .HasColumnType("varchar(32)"); entity.Property(e => e.OrderFlowId) .HasColumnName("order_flow_id") .HasColumnType("bigint(20)"); entity.Property(e => e.WastageContent) .HasColumnName("wastage_content") .HasColumnType("text"); entity.Property(e => e.WastageLoseReason) .HasColumnName("wastage_lose_reason") .HasColumnType("varchar(32)"); }); } } }
using UnityEngine; namespace ECS.Hybrid.Components{ public class PlayerHitComponent : MonoBehaviour{ public bool isHit = false; } }
using FamilyAccounting.Web.Models; using System.Threading.Tasks; namespace FamilyAccounting.Web.Interfaces { public interface ICardWebService { public Task<CardViewModel> Create(CardViewModel card); public Task<int> Delete(int id); public Task<CardViewModel> Get(int id); public Task<CardViewModel> Update(int id, CardViewModel card); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class SplashScreenManager : MonoBehaviour { float timer; void Start() { timer = 6; } void Update() { timer -= Time.deltaTime; if (timer < 0) { if (PlayerPrefs.GetInt("Autenticato", 0) == 1) Application.LoadLevel("MainMenu"); else Application.LoadLevel("FormUser"); } } }
using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; using System.Threading.Tasks; using TechEval.CommandHandlers.Validators; using TechEval.Commands; using TechEval.Commands.Results; using TechEval.Core; using TechEval.DataContext; namespace TechEval.CommandHandlers { public class CsvFileUploadCommandHandler : FileUploadBase<CsvFileUploadCommand>, ICommandHandler<CsvFileUploadCommand, FileUploadCommandResult> { public CsvFileUploadCommandHandler(Db db, ILogger<CsvFileUploadCommand> logger) : base(db, logger) { Validator = new TransactionCsvValidator(); } override public async Task<CommandResult<FileUploadCommandResult>> Execute(CsvFileUploadCommand command) { return await base.Execute(command); } protected override IEnumerable<TransactionModel> LoadFile(Stream file) { List<string> lines = new List<string>(); try { using (var reader = new StreamReader(file)) { while (!reader.EndOfStream) { lines.Add(reader.ReadLine()); } } } catch (Exception ex) { _logger.LogError(ex, "Failed to load file"); throw; } foreach (var el in lines) { yield return GetTransaction(el); ; } } private TransactionModel GetTransaction(string el) { try { var reg = new Regex("\"([^\"]*)\"", RegexOptions.ECMAScript); var rec = reg.Matches(el); return new TransactionModel { TransactionId = rec[0].Groups[1].Value, Amount = rec[1].Groups[1].Value, CurrencyCode = rec[2].Groups[1].Value, TransactionDate = rec[3].Groups[1].Value, Status = rec[4].Groups[1].Value, }; } catch (Exception ex) { _logger.LogError(ex, "Failed to parse csv file. Unknown format."); throw new FormatUnknownException("Failed to parse csv file. Unknown format.", ex); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Common.Utils; using Common.RSSService; using System.ComponentModel; namespace Common.DataModel { public class ErrorDataModel : BindableObject { #region Singleton static private ErrorDataModel instance = new ErrorDataModel(); static public ErrorDataModel Instance { get {return instance; } } #endregion public WebResult.ErrorCodeList Error { get; private set; } public string ErrorText { get; private set; } private ErrorDataModel() { Error = WebResult.ErrorCodeList.SUCCESS; ErrorText = null; } public bool EvalResponse(AsyncCompletedEventArgs e) { if (e.Error == null) return true; Error = WebResult.ErrorCodeList.INTERNAL_ERROR; ErrorText = e.Error.Message; RaisePropertyChange("Error"); return false; } public bool EvalWebResult(Common.RSSService.WebResult r) { if (r.ErrorCode == WebResult.ErrorCodeList.SUCCESS) return true; Error = r.ErrorCode; ErrorText = "WebService Error"; RaisePropertyChange("Error"); return false; } public bool EvalWebResult(Common.FeedService.WebResult r) { if (r.ErrorCode == Common.FeedService.WebResult.ErrorCodeList.SUCCESS) return true; Error = (WebResult.ErrorCodeList)r.ErrorCode; ErrorText = "WebService Error"; RaisePropertyChange("Error"); return false; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp6 { class Pepsi : ColdDrink { public override string nombre() { return "Pepsi"; } public override float valor() { return 35.5f; } } }
using Conjure.Data; using Example.Shared; using Microsoft.AspNetCore.Components; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; using System.Web; namespace Example.Client.Data { public class ClientWeatherForecastService : IWeatherForecastService { private readonly HttpClient _http; public ClientWeatherForecastService(HttpClient http) { _http = http; } public async Task<FetchResult<WeatherForecast>> GetForecastAsync(FetchOptions options) { //var query = new System.Collections.Specialized.NameValueCollection(); var query = HttpUtility.ParseQueryString(string.Empty); if (options.Sort!= null) query[nameof(options.Sort)] = options.Sort; if (options.Skip.HasValue) query[nameof(options.Skip)] = options.Skip.ToString(); if (options.Take.HasValue) query[nameof(options.Take)] = options.Take.ToString(); var forecasts = await _http.GetJsonAsync<FetchResult<WeatherForecast>>( "api/WeatherForecasts?" + query.ToString()); foreach (var f in forecasts.Items) { f.Summary = "CLT:" + f.Summary; } return forecasts; } } }
using System.Collections.Generic; using Alabo.Industry.Cms.Articles.Domain.Entities; namespace Alabo.Industry.Cms.Articles.Domain.Dto { public class ManualOutput { public long RelationId { get; set; } public string RelationName { get; set; } public List<Article> Article { get; set; } } }
// The MIT License (MIT) // Copyright (c) 2015 Intis Telecom // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Runtime.Serialization; namespace Intis.SDK.Entity { /// <summary> /// Class PhoneBase /// Class for getting data of phone number list /// </summary> [DataContract] public class PhoneBase { /// <summary> /// List ID /// </summary> /// <returns>integer</returns> public Int64 BaseId { get; set; } /// <summary> /// Name of list /// </summary> /// <returns>string</returns> [DataMember(Name = "name")] public string Title { get; set; } /// <summary> /// Number of contacts in list /// </summary> /// <returns>integer</returns> [DataMember(Name = "count")] public int Count { get; set; } /// <summary> /// Number of pages in list /// </summary> /// <returns>integer</returns> [DataMember(Name = "pages")] public int Pages { get; set; } [DataMember(Name = "on_birth")] private int Enabled { get; set; } [DataMember(Name = "day_before")] private int DaysBefore { get; set; } [DataMember(Name = "birth_sender")] private string Originator { get; set; } [DataMember(Name = "time_birth")] private string TimeToSend { get; set; } [DataMember(Name = "local_time")] private int UseLocalTime { get; set; } [DataMember(Name = "birth_text")] private string Template { get; set; } /// <summary> /// Settings of birthday greeting for the list contacts /// </summary> /// <returns>BirthdayGreetingSettings</returns> public BirthdayGreetingSettings BirthdayGreetingSettings{ get{ return new BirthdayGreetingSettings(Enabled, DaysBefore, Originator, TimeToSend, UseLocalTime, Template); } } } }
/** 版本信息模板在安装目录下,可自行修改。 * orderitems.cs * * 功 能: N/A * 类 名: orderitems * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── * V0.01 2018/9/4 10:38:43 N/A 初版 * * Copyright (c) 2012 Maticsoft Corporation. All rights reserved. *┌──────────────────────────────────┐ *│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │ *│ 版权所有:动软卓越(北京)科技有限公司              │ *└──────────────────────────────────┘ */ using System; namespace HPYL.Model { public class orderitems { #region Model /// <summary> /// auto_increment /// </summary> public long Id { get; set; } /// <summary> /// /// </summary> public long OrderId { get; set; } /// <summary> /// /// </summary> public long ShopId { get; set; } /// <summary> /// /// </summary> public long ProductId { get; set; } /// <summary> /// /// </summary> public string SkuId { get; set; } /// <summary> /// /// </summary> public string SKU { get; set; } /// <summary> /// /// </summary> public long Quantity { get; set; } /// <summary> /// /// </summary> public long ReturnQuantity { get; set; } /// <summary> /// /// </summary> public decimal CostPrice { get; set; } /// <summary> /// /// </summary> public decimal SalePrice { get; set; } /// <summary> /// /// </summary> public decimal DiscountAmount { get; set; } /// <summary> /// /// </summary> public decimal RealTotalPrice { get; set; } /// <summary> /// /// </summary> public decimal RefundPrice { get; set; } /// <summary> /// /// </summary> public string ProductName { get; set; } /// <summary> /// /// </summary> public string Color { get; set; } /// <summary> /// /// </summary> public string Size { get; set; } /// <summary> /// /// </summary> public string Version { get; set; } /// <summary> /// /// </summary> public string ThumbnailsUrl { get; set; } /// <summary> /// /// </summary> public decimal CommisRate { get; set; } /// <summary> /// /// </summary> public decimal? EnabledRefundAmount { get; set; } /// <summary> /// /// </summary> public int IsLimitBuy { get; set; } /// <summary> /// /// </summary> public decimal? DistributionRate { get; set; } /// <summary> /// /// </summary> public decimal? EnabledRefundIntegral { get; set; } /// <summary> /// /// </summary> public decimal CouponDiscount { get; set; } /// <summary> /// /// </summary> public decimal FullDiscount { get; set; } #endregion Model } }
using Android.App; using Android.Content; using Android.Views; using Android.Widget; using theCircuitLive; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using CustomRenderer.Droid; [assembly: ExportRenderer(typeof(TestCell), typeof(NativeAndroidCellRenderer))] namespace CustomRenderer.Droid { public class NativeAndroidCellRenderer : ViewCellRenderer { protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, ViewGroup parent, Context context) { var x = (TestCell)item; var view = convertView; if (view == null) { // no view to re-use, create new view = (context as Activity).LayoutInflater.Inflate(CustomRenderer.Droid.Resource.Layout.NativeAndroidCell, null); } view.FindViewById<TextView>(Resource.Id.Text1).Text = x.Name; return view; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Web.Http; namespace WebapiPdfMime.Controllers { public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; } // GET api/values [HttpGet] public HttpResponseMessage PdfGet() { var path = @"C:\Temp\TA.pdf"; HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); var stream = new FileStream(path, FileMode.Open); result.Content = new StreamContent(stream); result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf"); return result; } // GET api/values/5 public string Get(int id) { return "value"; } // POST api/values public void Post([FromBody]string value) { } // PUT api/values/5 public void Put(int id, [FromBody]string value) { } // DELETE api/values/5 public void Delete(int id) { } } }
namespace MovieRating.Data.Extensions { using Entities; using Repositories; using System.Linq; public static class UserExtensions { public static User GetSingleByUsername(this IEntityBaseRepository<User> userRepository,string username) { return userRepository.GetAll().FirstOrDefault(x => x.UserName == username); } } }
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using HtmlAgilityPack; using MuggleTranslator.Common; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace MuggleTranslator.UserControls { /// <summary> /// YoudaoTranslatorUserControl.xaml 的交互逻辑 /// </summary> public partial class YoudaoTranslatorUserControl : UserControl { private YoudaoTranslatorUserControlViewModel _viewModel; public YoudaoTranslatorUserControl() { InitializeComponent(); _viewModel = new YoudaoTranslatorUserControlViewModel(); DataContext = _viewModel; } public async void Translate(string originalText) { _viewModel.Translating = true; _viewModel.Checked = false; var targetText = await Task.Run(() => { var html = $"https://dict.youdao.com/w/{originalText}"; HtmlWeb web = new HtmlWeb(); var rootNode = web.Load(html).DocumentNode; try { var ydTransNode = rootNode.SelectSingleNode("//div[@id='ydTrans']"); if (ydTransNode != null) { return rootNode.SelectSingleNode("//div[@id='fanyiToggle']/div/p[2]")?.InnerText; } else { var sb = new StringBuilder(); // 中 -> 英 时候的排版格式 var liNodes = rootNode.SelectNodes("//div[@id='phrsListTab']/div[contains(@class, 'trans-container')]/ul/li"); if (liNodes != null) { foreach (var liNode in liNodes) { var translationItemText = liNode.InnerText; var ks = translationItemText.Split(new char[] { ' ' }); var kind = ks.Count() >= 1 ? ks[0] : string.Empty; var translation = ks.Count() >= 2 ? ks[1] : string.Empty; sb.AppendLine($"{kind} {translation}"); } } // 英 -> 中 时候的排版格式 else { var pNodes = rootNode.SelectNodes("//div[@id='phrsListTab']/div[contains(@class, 'trans-container')]/ul/p"); foreach (var pNode in pNodes) { var kind = pNode.SelectSingleNode("./span[not(@class='contentTitle')]")?.InnerText; var translation = new StringBuilder(); foreach (var aNode in pNode.SelectNodes("./span[@class='contentTitle']/a")) translation.Append($"{aNode.InnerText?.Trim()};"); sb.AppendLine($"{kind} {translation}"); } } return sb.ToString(); } } catch { return "暂无搜索结果"; } }); _viewModel.TargetText = targetText?.Trim(); content_control.UpdateLayout(); _viewModel.Checked = true; _viewModel.Translating = false; } } public class YoudaoTranslatorUserControlViewModel : ViewModelBase { #region BindingProperty private bool _translating; public bool Translating { get => _translating; set { _translating = value; RaisePropertyChanged(nameof(Translating)); } } private string _targetText; public string TargetText { get => _targetText; set { _targetText = value; RaisePropertyChanged(nameof(TargetText)); } } private bool _checked; public bool Checked { get => _checked; set { _checked = value; RaisePropertyChanged(nameof(Checked)); } } #endregion #region BindingCommand private RelayCommand _copyCommand; public ICommand CopyCommand { get { if (_copyCommand == null) _copyCommand = new RelayCommand(() => Copy()); return _copyCommand; } } private void Copy() { ClipboardHelper.SetText(TargetText); } #endregion } }
using System; using System.Collections.Generic; class SmallShop { static void Main() { string product = Console.ReadLine().ToLower(); string city = Console.ReadLine().ToLower(); double quantity = double.Parse(Console.ReadLine()); string cityProduct = city + product; var choosing = new Dictionary<string, double>() { { "sofiacoffee",0.50}, { "sofiawater",0.80}, { "sofiabeer",1.20}, { "sofiasweets",1.45}, { "sofiapeanuts",1.60}, { "plovdivcoffee",0.40}, { "plovdivwater",0.70}, { "plovdivbeer",1.15}, { "plovdivsweets",1.30}, { "plovdivpeanuts",1.50}, { "varnacoffee",0.45}, { "varnawater",0.70}, { "varnabeer",1.10}, { "varnasweets",1.35}, { "varnapeanuts",1.55}, }; Console.WriteLine(choosing[cityProduct] * quantity); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chloe.Metal.Contracts { public interface IRouteParamsProvider { Dictionary<string, object> Get(); void Set(string key, object value); } }
using System; using System.Linq; namespace _03.ExtractFile { class Program { static void Main() { var path = Console.ReadLine(); var fileInfo = path.Split(@"\", StringSplitOptions.RemoveEmptyEntries).ToArray(); var file = fileInfo[fileInfo.Length - 1]; var splittedFile = file.Split('.'); var fileName = splittedFile[0]; var fileextension = splittedFile[1]; Console.WriteLine($"File name: {fileName}"); Console.WriteLine($"File extension: {fileextension}"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JaggedArraySorter { public abstract class JaggedArrayBubbleSorter { struct JaggedArrayLine { public int parameter; public int[] lineAddress; } public void Sort(int[][] source, bool inIncreasingOrder = true) { if (source == null) throw new ArgumentNullException("source"); JaggedArrayLine[] jaggedArrLines = new JaggedArrayLine[source.Length]; for (int i = 0; i < source.Length; i++) { jaggedArrLines[i].parameter = GetLineParameter(source[i]); jaggedArrLines[i].lineAddress = source[i]; } bool thereWerePermutations = true; for (int i = 0; (i < source.Length - 1) && thereWerePermutations; i++) { thereWerePermutations = false; for (int j = 0; j < source.Length - i - 1; j++) { if ((inIncreasingOrder && jaggedArrLines[j].parameter > jaggedArrLines[j + 1].parameter) || (!inIncreasingOrder && jaggedArrLines[j].parameter < jaggedArrLines[j + 1].parameter)) { Swap(ref jaggedArrLines[j], ref jaggedArrLines[j + 1]); thereWerePermutations = true; } } } for (int i = 0; i < source.Length; i++) source[i] = jaggedArrLines[i].lineAddress; } private static void Swap (ref JaggedArrayLine first, ref JaggedArrayLine second) { JaggedArrayLine temp; temp = first; first = second; second = temp; } public abstract int GetLineParameter(int[] arrayLine); } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Compent.Extensions; using Google; using LightInject; using UBaseline.Core.Extensions; using Uintra.Core.Updater.Sql; using Umbraco.Core.Logging; using Umbraco.Core.Services; using Umbraco.Web.Composing; namespace Uintra.Core.Updater { public class MigrationExecutor { private readonly ILogger _logger; private readonly IMigrationHistoryService _migrationHistoryService; public static readonly Version LastLegacyMigrationVersion = new Version("2.0.0.0"); public MigrationExecutor() { _logger = Current.Factory.EnsureScope(f => f.GetInstance<ILogger>()); _migrationHistoryService = Current.Factory.EnsureScope(f => f.GetInstance<IMigrationHistoryService>()); } public void Run() { var allHistory = _migrationHistoryService.GetAll(); var allSteps = GetAllMigrations().Pipe(GetAllSteps); var missingSteps = GetSteps(allSteps, allHistory, LastLegacyMigrationVersion); var (executionHistory, executionResult) = TryExecuteSteps(missingSteps); if (executionResult.Type is ExecutionResultType.Success) { executionHistory .Pipe(ToMigrationHistory) .Do(_migrationHistoryService.Create); } else { _logger.Error<MigrationExecutor>(executionResult.Exception); var (undoHistory, undoResult) = TryUndoSteps(executionHistory); if (undoResult.Type is ExecutionResultType.Failure) { undoHistory .Pipe(ToMigrationHistory) .Do(_migrationHistoryService.Create); _logger.Error<MigrationExecutor>(undoResult.Exception); } } } private IOrderedEnumerable<IMigration> GetAllMigrations() => Current.Factory.EnsureScope(f => f.GetAllInstances<IMigration>()) .OrderBy(m => m.Version); private static IEnumerable<(string name, Version version)> ToMigrationHistory(Stack<MigrationItem> items) => items .Reverse() .Select(step => (name: StepIdentity(step.Step), version: step.Version)); private static IEnumerable<MigrationItem> GetAllSteps(IOrderedEnumerable<IMigration> migrations) => migrations.SelectMany(migration => migration.Steps.Select(step => new MigrationItem(migration.Version, step))); private static IEnumerable<MigrationItem> GetSteps( IEnumerable<MigrationItem> allSteps, List<MigrationHistory> allHistory, Version lastLegacyMigrationVersion) { var lastHistoryVersion = allHistory .Select(h => Version.Parse(h.Version)) .OrderByDescending(h => h) .FirstOrDefault(); switch (lastHistoryVersion) { case Version version when version <= lastLegacyMigrationVersion: return allSteps.Where(s => s.Version > lastHistoryVersion); case Version _: return GetMissingSteps(allSteps.Where(s => s.Version > lastLegacyMigrationVersion), allHistory); case null: return allSteps; default: return allSteps; } } private static IEnumerable<MigrationItem> GetMissingSteps( IEnumerable<MigrationItem> allSteps, IEnumerable<MigrationHistory> allHistory) => allSteps .Where(migrationItem => !allHistory.Any(historyItem => IsMigrationItemEqualsToHistory(migrationItem, historyItem))); private static bool IsMigrationItemEqualsToHistory(MigrationItem item, MigrationHistory history) => history.Name == StepIdentity(item.Step) && new Version(history.Version) == item.Version; private static (Stack<MigrationItem> executionHistory, ExecutionResult result) TryExecuteSteps( IEnumerable<MigrationItem> steps) { var executionHistory = new Stack<MigrationItem>(); foreach (var step in steps) { executionHistory.Push(step); var stepActionResult = TryExecuteStep(step.Step); if (stepActionResult.Type is ExecutionResultType.Failure) { return (executionHistory, stepActionResult); } } return (executionHistory, ExecutionResult.Success); } private static ExecutionResult TryExecuteStep(IMigrationStep migrationStep) { try { return migrationStep.Execute(); } catch (Exception e) { return ExecutionResult.Failure(e); } } private static (Stack<MigrationItem> undoHistory, ExecutionResult result) TryUndoSteps( Stack<MigrationItem> executionHistory) { var undoHistory = new Stack<MigrationItem>(); while (executionHistory.Any()) { var step = executionHistory.Pop(); undoHistory.Push(step); var stepActionResult = TryUndoStep(step.Step); if (stepActionResult.Type is ExecutionResultType.Failure) { return (executionHistory, stepActionResult); } } return (undoHistory, ExecutionResult.Success); } private static ExecutionResult TryUndoStep(IMigrationStep migrationStep) { try { migrationStep.Undo(); } catch (Exception e) { return ExecutionResult.Failure(e); } return ExecutionResult.Success; } private static string StepIdentity(IMigrationStep step) => step.GetType().Name; } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AlgorithmProblems.Dynamic_Programming { /// <summary> /// We need to find the order in which multiplication between a set of matrix needs to be performed /// </summary> public class MatrixMultiplication { public class MatrixDimensions { public int Row { get; set; } public int Column { get; set; } public MatrixDimensions(int row, int column) { Row = row; Column = column; } } /// <summary> /// We can solve this using dynamic Programming /// /// when we multiply 2 matrix m1 and m2, the total number of operation is r1 * c1* c2 /// /// Since we will be doing a bottoms up approach we need to create a 2-D costMatrix /// costMatrix[i,j] is the least number of operations needed to multiply matrices from i to j in mats array /// So if have an array of matrices to multiply and get the min number of operations we need to do the following /// /// costMatrix[i,j] = min {costMatrix[i,i+k] + costMatrix[i+k+1,j] + mats[i].row*mats[i+k].col*mats[j].col} /// (k=0->j-1) /// /// Also costMatrix will be filled in the upper right portion from the diagonal. /// We need to first fill the elements closer to the diagonals and move up. /// /// the running time here is O(n^3) /// and the space requirement is O(n^2) /// </summary> /// <param name="mats"></param> /// <returns></returns> public int LeastNumOfOperationsInMatrixChainMultiplication(MatrixDimensions[] mats) { int[,] costMatrix = new int[mats.Length, mats.Length]; int[,] backtrackMat = new int[mats.Length, mats.Length]; for (int increment=1; increment<mats.Length; increment++) { for(int index= 0; index<mats.Length;index++) { int i = index; int j = index + increment; if (j<mats.Length) { costMatrix[i, j] = int.MaxValue; for(int k=0; k<j- i; k++) { int currentVal = costMatrix[i, i + k] + costMatrix[i + k + 1, j] + (mats[i].Row * mats[i+k].Column * mats[j].Column); if(currentVal < costMatrix[i, j]) { backtrackMat[i, j] = i + k; costMatrix[i, j] = currentVal; } } } } } Queue<MatrixDimensions> queue = new Queue<MatrixDimensions>(); // We will use the MatrixDimensions class to store the location of the cell in the matrix queue.Enqueue(new MatrixDimensions(0,mats.Length-1)); while(queue.Count!=0) { var location = queue.Dequeue(); int k = backtrackMat[location.Row, location.Column]; int i = location.Row; int j = location.Column; if (k - i == 1) { Console.WriteLine("[{0}, {1}]", i, k); } else if (k - i == 0) { Console.WriteLine("[{0}]", i); } else { queue.Enqueue(new MatrixDimensions(i, k)); } if (j - (k+1) == 1) { Console.WriteLine("[{0}, {1}]", k+1, j); } else if (j - (k + 1) == 0) { Console.WriteLine("[{0}]", k+1); } else { queue.Enqueue(new MatrixDimensions(k + 1, j)); } } return costMatrix[0, mats.Length - 1]; } public static void TestMatrixMultiplication() { MatrixMultiplication matMul = new MatrixMultiplication(); MatrixDimensions[] mats = new MatrixDimensions[] { new MatrixDimensions(1, 2), new MatrixDimensions(2, 3), new MatrixDimensions(3, 4) }; Console.WriteLine("the minimum number of multiplications needed is {0}", matMul.LeastNumOfOperationsInMatrixChainMultiplication(mats)); mats = new MatrixDimensions[] { new MatrixDimensions(10, 30), new MatrixDimensions(30, 5), new MatrixDimensions(5, 60) }; Console.WriteLine("the minimum number of multiplications needed is {0}", matMul.LeastNumOfOperationsInMatrixChainMultiplication(mats)); mats = new MatrixDimensions[] { new MatrixDimensions(40, 20), new MatrixDimensions(20, 30), new MatrixDimensions(30, 10), new MatrixDimensions(10, 30) }; Console.WriteLine("the minimum number of multiplications needed is {0}", matMul.LeastNumOfOperationsInMatrixChainMultiplication(mats)); } } }
using System; namespace Lottery.Repository.Interfaces { public interface ILotteryRecord { int First { get; set; } int Second { get; set; } int Third { get; set; } int Fourth { get; set; } int Fifth { get; set; } int Sixth { get; set; } int Special { get; set; } DateTime Date { get; set; } } }
using UnityEngine; using System.Collections; using ComLib.Unity.Extensions; namespace ComLib.Unity.Scripts { /// <summary> /// Holds a number of audio clips to randomly play in the attached audioSource /// </summary> public class AudioCollection : MonoBehaviour { public AudioClip[] audioClips; public bool useRandomPitch; public Vector2 pitchRange; public AudioSource audioSource; // Use this for initialization void Start() { if (!audioSource) { audioSource = GetComponent<AudioSource>(); } } public void PlayRandomClip() { audioSource.pitch = Random.Range(pitchRange.x, pitchRange.y); audioSource.PlayOneShot(audioClips.GetRandom()); } } }
using System; class GameOfBits { static void Main() { uint num = uint.Parse(Console.ReadLine()); uint newNum = 0; uint nextNum = num; string bitComm = Console.ReadLine(); if (bitComm == "Game Over!") { newNum = num; } else { while (bitComm != "Game Over!") { int resMod = 0; if (bitComm == "Odd") { resMod = 1; } newNum = getNewNum(resMod, nextNum); nextNum = newNum; // Console.WriteLine("{0}",Convert.ToString(newNum,2)); bitComm = Console.ReadLine(); } } int numBitsOne = 0; string NumStr = Convert.ToString(newNum, 2); for (int i = 0; i < NumStr.Length; i++) { if (NumStr[i] == '1') { numBitsOne++; } } Console.WriteLine("{0} -> {1}",newNum,numBitsOne); } private static uint getNewNum(int resMod, uint num) { uint newNum = 0; int numBits = 31; //Console.WriteLine("{0}", Convert.ToString(num, 2)); while (numBits >= 0) { if (((numBits + 1) % 2 == resMod)) { var tmpBit = (num >> numBits) & 1; newNum = newNum << 1; newNum = newNum | tmpBit; } // Console.WriteLine(tmpBit); numBits--; } return newNum; } }
namespace ShoppinCenter { using System; public class Product : IComparable<Product> { public Product(string name, decimal price, string producer) { this.Name = name; this.Price = price; this.Producer = producer; } public string Name { get; set; } public decimal Price { get; set; } public string Producer { get; set; } public int CompareTo(Product other) { var nameCmp = string.Compare(this.Name, other.Name, StringComparison.CurrentCulture); var producerCmp = string.Compare(this.Producer, other.Producer, StringComparison.CurrentCulture); var priceCmp = this.Price.CompareTo(other.Price); if (nameCmp == 0) { if (producerCmp == 0) { return priceCmp; } return producerCmp; } return nameCmp; } public override string ToString() { return $"{{{this.Name};{this.Producer};{$"{this.Price:F2}"}}}"; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using TfsMobile.Contracts; namespace TfsWebClient.Models { public class BuildsVm { public IEnumerable<BuildContract> Builds { get; set; } public BuildsVm(IEnumerable<BuildContract> builds) { Builds = builds; } } }
using System; class AlcoholMarket { static void Main() { double whiskeyPrice = double.Parse(Console.ReadLine()); double beer = double.Parse(Console.ReadLine()); double wine = double.Parse(Console.ReadLine()); double rakia = double.Parse(Console.ReadLine()); double whiskey = double.Parse(Console.ReadLine()); double rakiaPrice = whiskeyPrice * 0.5; double winePrice = rakiaPrice * 0.6; double beerPrice = rakiaPrice * 0.2; double total = whiskey * whiskeyPrice + beer * beerPrice + wine * winePrice + rakia * rakiaPrice; Console.WriteLine("{0:0.00}",total); } }
using Microsoft.ProjectOxford.Emotion; using Microsoft.ProjectOxford.Vision; using System; using System.Collections.Generic; using System.Linq; using System.Text; using Xamarin.Forms; namespace XFComputerVision { public partial class App : Application { internal static VisionServiceClient visionClient; internal static EmotionServiceClient emotionClient; public App () { InitializeComponent(); visionClient = new VisionServiceClient("YOUR-KEY-GOES-HERE", "https://westeurope.api.cognitive.microsoft.com/vision/v1.0"); emotionClient = new EmotionServiceClient("YOUR-KEY-GOES-HERE", "https://westus.api.cognitive.microsoft.com/emotion/v1.0"); MainPage = new XFComputerVision.MainPage(); } protected override void OnStart () { // Handle when your app starts } protected override void OnSleep () { // Handle when your app sleeps } protected override void OnResume () { // Handle when your app resumes } } }
using System; using System.IO; using System.Collections; using System.Collections.Generic; using System.Text; using Bo.Cuyahoga.Extensions.Search; namespace BoLuceneSearchTest { class Program { private const string dirName = "IndexingTest"; private static IList<PersonContent> sampleContent = new List<PersonContent>(); static void Main(string[] args) { if (Directory.Exists(dirName)) { DeleteDir(dirName); } Directory.CreateDirectory(dirName); PrepareSamples(); BuildFullTextIndex(false); Console.WriteLine("Index was built."); while(true) { Console.Write("-> Enter query text (Ctrl+C to quit): "); string qry = Console.ReadLine(); if (String.IsNullOrEmpty(qry)) continue; SearchResultCollection<PersonContent> result = Find(qry); if (result.Count == 0) { Console.WriteLine("No mathches."); } else { Console.WriteLine("{0} mathches found.",result.Count); int i = 1; foreach (PersonContent p in result) { Console.WriteLine("Match {0}", i); Console.WriteLine(p.ToString()); i++; } } } } private static void DeleteDir(string dir) { DirectoryInfo di = new DirectoryInfo(dir); FileInfo[] files = di.GetFiles(); foreach (FileInfo fi in files) { File.Delete(fi.FullName); } Directory.Delete(dir); } private static void BuildFullTextIndex(bool rebuild) { using (IndexBuilderEx<PersonContent> ib = new IndexBuilderEx<PersonContent>(dirName, rebuild)) { foreach (PersonContent p in sampleContent) { ib.AddContent(p); } } } private static void DeleteSampleFromIndex() { using (IndexBuilderEx<PersonContent> ib = new IndexBuilderEx<PersonContent>(dirName, false)) { foreach (PersonContent p in sampleContent) { if (p.FullName == "Mustafa") { ib.DeleteContent(p); Console.WriteLine("Deleted content with name Mustafa"); } } } } private static SearchResultCollection<PersonContent> Find(string qry) { IndexQueryEx<PersonContent> idQry = new IndexQueryEx<PersonContent>(dirName); Hashtable keywordFilter = new Hashtable(); keywordFilter.Add("Keyword", "PersonContent"); return idQry.Find(qry, keywordFilter, 0, 200); } private static void PrepareSamples() { PersonContent p = new PersonContent(); p.Id = Guid.NewGuid().ToString(); p.FullName = "Ali"; p.Notes = "Software developer, özgür family member"; p.Age = 29; p.Keyword = "PersonContent"; sampleContent.Add(p); Console.WriteLine("Sample 1:"); Console.WriteLine(p.ToString()); p = new PersonContent(); p.Id = Guid.NewGuid().ToString(); p.FullName = "Seniha"; p.Notes = "Sales Rep and future mother, özgür family member"; p.Age = 30; p.Keyword = "PersonContent"; sampleContent.Add(p); Console.WriteLine("Sample 2:"); Console.WriteLine(p.ToString()); p = new PersonContent(); p.Id = Guid.NewGuid().ToString(); p.FullName = "Mustafa"; p.Notes = "Department Manager"; p.Age = 43; p.Keyword = "PersonContent"; sampleContent.Add(p); Console.WriteLine("Sample 3:"); Console.WriteLine(p.ToString()); } } }
using UnityEngine; [CreateAssetMenu(fileName = "Float", menuName = "Variable/Float", order = 1)] public class FloatVariable : VariableBase<float> { }
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Threading.Tasks; using AutoMapper; using DAL; using DAL.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Server.HttpSys; using Microsoft.Extensions.Logging; using OpenIddict.Validation; using QuickApp.ViewModels; namespace QuickApp.Controllers { [Authorize(AuthenticationSchemes = OpenIddictValidationDefaults.AuthenticationScheme)] [Route("api/StudentMarketingList")] public class StudentMarketingListController : Controller { private IUnitOfWork _unitOfWork; readonly ILogger _logger; readonly IEmailSender _emailer; public StudentMarketingListController(IUnitOfWork unitOfWork, ILogger<CustomerController> logger, IEmailSender emailer) { _unitOfWork = unitOfWork; _logger = logger; _emailer = emailer; } [HttpGet("throw")] public IEnumerable<MarketingStudentList> Throw() { throw new InvalidOperationException("This is a test exception: " + DateTime.Now); } } }
using AplicacaoDemo.TestesBasicos; using System; using System.Collections.Generic; using System.Text; using Xunit; namespace AplicacaoDemo.Tests.Basicos { public class CalculadoraTests { [Fact] public void Calculadora_Somar_DeveRetornarASomaDosValores() { // Arrange Calculadora calculadora = new Calculadora(); // Act var resultado = calculadora.Somar(2, 2); // Assert Assert.Equal(4, resultado); } [Fact] public void Calculadora_Multiplicar_DeveRetornarOValorDaMultiplicacao() { // Arrange Calculadora calculadora = new Calculadora(); // Act var resultado = calculadora.Multiplicar(5, 5); // Assert Assert.Equal(25, resultado); } [Theory] [InlineData(1,1,2)] [InlineData(3, 3, 6)] [InlineData(5, 5, 10)] [InlineData(10, 10, 20)] [InlineData(100, 100, 200)] public void Calculadora_Somar_DeveRetornarASomaDosValoresCorretos(double v1, double v2, double resultado) { // Arrange Calculadora calculadora = new Calculadora(); // Act var retorno = calculadora.Somar(v1, v2); // Assert Assert.Equal(resultado, retorno); } } }
namespace Cosmos.CPU.IOGroup { public abstract class IOGroup { } }
using UnityEngine; namespace UnityAtoms.BaseAtoms { /// <summary> /// Event of type `Collision2DPair`. Inherits from `AtomEvent&lt;Collision2DPair&gt;`. /// </summary> [EditorIcon("atom-icon-cherry")] [CreateAssetMenu(menuName = "Unity Atoms/Events/Collision2DPair", fileName = "Collision2DPairEvent")] public sealed class Collision2DPairEvent : AtomEvent<Collision2DPair> { } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; using IRAP.Entity.UTS; namespace IRAP.Client.GUI.MDM { public partial class ColorPanel : XtraUserControl { public ColorPanel() { InitializeComponent(); } private static int VERTICAL_SPACINT = 2;//间距 private static int LABEL_HEIGHT = 17;//高度 private static int EDGE_SPACING = 2;//边缘距离 private static int LABEL_WIDTH = 128;//label宽度 private double _horizontalSpacing = 2;//水平间距 /// <summary> /// 每行的个数 /// </summary> [Browsable(true)] public int EachRowNumber { get { return _eachRowNumber; } set { _eachRowNumber = value; } } private int _eachRowNumber = 6; /// <summary> /// 初始化 /// </summary> /// <param name="importErrType"></param> public void InitColorPanel(List<ImportErrorTypes> importErrType) { if (importErrType==null||importErrType.Count == 0) { return; } #region 测试数据 //if (importErrType==null) { // importErrType = new List<ImportErrorTypes> (); //} //importErrType.Add(new ImportErrorTypes() {Ordinal = 2,ErrType="测试11111111111",BGColor= "#CC00FF"}); //importErrType.Add(new ImportErrorTypes() {Ordinal = 3,ErrType="测试222222222",BGColor= "#FFB6C1"}); //importErrType.Add(new ImportErrorTypes() { Ordinal = 4, ErrType = "测试3333333333333", BGColor = "#FFC0CB" }); //importErrType.Add(new ImportErrorTypes() { Ordinal = 5, ErrType = "测试4444444444444444", BGColor = "#DC143C" }); //importErrType.Add(new ImportErrorTypes() { Ordinal = 6, ErrType = "测试5555555555555555", BGColor = "#8B008B" }); //importErrType.Add(new ImportErrorTypes() { Ordinal = 7, ErrType = "测试6666666666666666", BGColor = "#9370DB" }); //importErrType.Add(new ImportErrorTypes() { Ordinal = 8, ErrType = "测试777777777777", BGColor = "#000080" }); //importErrType.Add(new ImportErrorTypes() { Ordinal = 9, ErrType = "测试88", BGColor = "#00BFFF" }); //importErrType.Add(new ImportErrorTypes() { Ordinal = 10, ErrType = "测试9", BGColor = "#3CB371" }); //importErrType.Add(new ImportErrorTypes() { Ordinal = 11, ErrType = "测试10101010101", BGColor = "#228B22" }); //importErrType.Add(new ImportErrorTypes() { Ordinal = 12, ErrType = "测试121212121212121212", BGColor = "#FFFF00" }); #endregion this.Controls.Clear(); _horizontalSpacing = CreateLabelWidth(); var row = Convert.ToInt32(Math.Ceiling((double)importErrType.Count / _eachRowNumber)); foreach (ImportErrorTypes item in importErrType) { var newLabel = CreateColorLabel(item.ErrType, item.BGColor); var index = importErrType.IndexOf(item); int i = Convert.ToInt32(Math.Floor((double)index/_eachRowNumber));//行序号 int j = index % _eachRowNumber;//列序号 newLabel.Location = new Point(Convert.ToInt32(EDGE_SPACING + j * LABEL_WIDTH + j * _horizontalSpacing), Convert.ToInt32(EDGE_SPACING + i * LABEL_HEIGHT + i * VERTICAL_SPACINT)); #region 另一种计算方法 //if (index == 0) { // newLabel.Location = new Point(currentX, currentY); //} else { // if (index / _eachRowNumber == 0) { // currentY += VERTICAL_SPACINT + LABEL_HEIGHT; // currentX = EDGE_SPACING; // } else { // currentX += LABEL_WIDTH + Convert.ToInt32(Math.Floor(_horizontalSpacing)); // } // newLabel.Location = new Point(currentX, currentY); //} #endregion this.Controls.Add(newLabel); } } /// <summary> /// 创建label /// </summary> /// <param name="err">错误信息</param> /// <param name="color">颜色,十六进制</param> /// <returns></returns> private ColorLabel CreateColorLabel(string err,string color) { ColorLabel label = new ColorLabel(); label.Text = err; label.Color = ConvertColorHx16ToRGB(color); label.Size = new System.Drawing.Size(LABEL_WIDTH,LABEL_HEIGHT); //label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) //| System.Windows.Forms.AnchorStyles.Right))); return label; } /// <summary> /// [颜色:16进制转成RGB] /// </summary> /// <param name="strColor">设置16进制颜色 [返回RGB]</param> /// <returns></returns> private static System.Drawing.Color ConvertColorHx16ToRGB(string strHxColor) { try { if (strHxColor.Length == 0) {//如果为空 return System.Drawing.Color.FromArgb(0, 0, 0);//设为黑色 } else {//转换颜色 return System.Drawing.Color.FromArgb(System.Int32.Parse(strHxColor.Substring(1, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(3, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(5, 2), System.Globalization.NumberStyles.AllowHexSpecifier)); } } catch {//设为黑色 return System.Drawing.Color.FromArgb(0, 0, 0); } } /// <summary> /// 计算宽度 /// </summary> /// <returns></returns> private double CreateLabelWidth() { var result = (this.Width-20 - 2 * EDGE_SPACING - LABEL_WIDTH * _eachRowNumber) / (_eachRowNumber-1); return result > 0 ? result : 2; } /// <summary> /// 清除label /// </summary> public void ClearLabel() { this.Controls.Clear(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chapter03_03 { class CPoint2i { public int theX; public int theY; public CPoint2i(int aX, int aY) { theX = aX; theY = aY; } } }
/* * Author: Generated Code * Date Created: 24.02.2011 * Description: Represents a row in the tblTarifeMahnung table */ using System.Data.SqlClient; using System.Data; using System; namespace HTB.Database { public class tblTarifeMahnung : Record { #region Property Declaration private int _tarifeMahnungID; private int _tarifeMahnungKlient; private double _tarifeMahnungSWvon; private double _tarifeMahnungSWbis; private double _tarifeMahnungBetrag; [MappingAttribute(FieldType = MappingAttribute.FIELD_TYPE_ID)] public int TarifeMahnungID { get { return _tarifeMahnungID; } set { _tarifeMahnungID = value; } } public int TarifeMahnungKlient { get { return _tarifeMahnungKlient; } set { _tarifeMahnungKlient = value; } } public double TarifeMahnungSWvon { get { return _tarifeMahnungSWvon; } set { _tarifeMahnungSWvon = value; } } public double TarifeMahnungSWbis { get { return _tarifeMahnungSWbis; } set { _tarifeMahnungSWbis = value; } } public double TarifeMahnungBetrag { get { return _tarifeMahnungBetrag; } set { _tarifeMahnungBetrag = value; } } #endregion } }
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; namespace DPYM { /// <summary> /// 道具接口 /// </summary> public interface ITool { } /// <summary> /// 道具 /// </summary> public class Tool : ITool, IDisposable { /* 属性 */ public virtual EToolType toolType { get { return EToolType.BaseClass; } } /* 接口 */ /// <summary> /// 交互起始 /// </summary> /// <param name="position">传入位置信息</param> public virtual void InteractStart(Vector2 position) { /* 这里先不实现通用逻辑,等具体道具都规划完成后提取通用逻辑*/ } /// <summary> /// 交互持续 /// </summary> /// <param name="position">传入位置信息</param> public virtual void InteractStaying(Vector2 position, Vector2 deltaPosition) { /* 这里先不实现通用逻辑,等具体道具都规划完成后提取通用逻辑*/ } /// <summary> /// 交互完成 /// </summary> public virtual void InteractComplete() { /* 这里先不实现通用逻辑,等具体道具都规划完成后提取通用逻辑*/ } // 激活与反激活 /// <summary> /// 激活该道具(道具配置为当前道具时的操作) /// </summary> public virtual void Activate() { } /// <summary> /// 反激活该道具(道具从当前道具撤销时的操作) /// </summary> public virtual void Deactivate() { } // 处理游戏元素 public virtual void Interact(GameElement ge) { } // 处理老鼠 public virtual void Interact(Mouse mouse) { /* 道具这里采用职责链的方式来实现,但是每个职责链最多有两个节点 */ Interact((GameElement)mouse); } // 处理地图元素 public virtual void Interact(Element mouse) { /* 道具这里采用职责链的方式来实现,但是每个职责链最多有两个节点 */ Interact((GameElement)mouse); } // 释放资源 public virtual void Dispose() { } /* 特性创建 */ protected Tool() { } /* 组件 */ } /// <summary> /// 道具的配置信息: /// 1、道具 /// 2、道具不存在时,但是可以预先配置的一些配置信息,添加道具时会检查的信息 /// </summary> public class ToolInfo : IDisposable { /* 创建 */ public ToolInfo() { } public ToolInfo(Tool tool) { this.tool = tool; } public ToolInfo(Tool tool, bool enable, IToolSwitchMethod switchMethod) { this.tool = tool; this.enable = enable; this.switchMethod = switchMethod; } /* 属性 */ /// <summary> /// 道具 /// </summary> public Tool tool = null; /// <summary> /// 道具是否可用 /// </summary> public bool enable = true; /// <summary> /// 道具切换方法 /// </summary> public IToolSwitchMethod switchMethod = null; /* 接口 */ /// <summary> /// 切换条件判断 /// </summary> /// <returns></returns> public bool CanSwitch() { if (null != tool && enable && null != switchMethod) return switchMethod.Satisfied(); return false; } /// <summary> /// 判断道具是否为给定道具类型 /// </summary> /// <returns></returns> public bool NotToolType(EToolType toolType) { if (null != tool) { return (toolType != tool.toolType); } return true; } /// <summary> /// 获取道具类型 /// </summary> /// <returns></returns> public EToolType GetToolType() { if (null == tool) return EToolType.Unavailable; return (EToolType)Enum.Parse(typeof(EToolType), tool.GetType().Name); } /// <summary> /// 获取显示消息接口 /// </summary> /// <returns></returns> public override string ToString() { /************************************************************* * << Killer, enable, KeyDownSwitchMethod >> ************************************************************* */ return string.Format("<< {0}, {1}, {2} >>", tool, enable?"enable":"disable", switchMethod ); } /// <summary> /// Dispose /// </summary> public void Dispose() { tool.Dispose(); } } /// <summary> /// 道具切换方法 /// </summary> public interface IToolSwitchMethod : ICondition { } /// <summary> /// 键盘按键切换 /// </summary> public class KeyDownSwitchMethod : IToolSwitchMethod { public KeyDownSwitchMethod(KeyCode key) { this.key = key; } public bool Satisfied() { return Input.GetKeyDown(key); } public override string ToString() { /************************************************************* * ( KeyDownSwitchMethod, key = K ) ************************************************************* */ return string.Format("( KeyDownSwitchMethod, key = {0} )", key); } public KeyCode key; } }
using System; using System.Collections.Generic; using VoxelSpace.Tasks; namespace VoxelSpace { /// <summary> /// Produces a stream of VoxelChunks from a given VoxelVolume. /// All chunks not explicitly passed on by Produce() are passed on at the end of the task. /// </summary> public abstract class VoxelChunkProducer : ProducerGameTask<VoxelChunk, VoxelVolume> { // keep track of what chunks we havent sent, so that we can send them before this task wraps up // this means consumers can use the foreach without fear as all chunks will be accounted for HashSet<VoxelChunk> _sentChunks; /// <summary> /// The volume being processed in the pipeline /// </summary> public VoxelVolume Volume => State; bool _completeStarted = false; public VoxelChunkProducer() : base() { _sentChunks = new HashSet<VoxelChunk>(); } protected override bool BeforeProduceItem(VoxelChunk item) { lock (_sentChunks) { if (_completeStarted) { return true; } else { if (_sentChunks.Contains(item)) { return false; } else { _sentChunks.Add(item); return true; } } } } protected override void BeforeComplete() { base.BeforeComplete(); _completeStarted = true; foreach (var chunk in Volume) { if (!_sentChunks.Contains(chunk)) { Produce(chunk); } } } protected override void ExceptionCaught(Exception e) { e.Filter<ObjectDisposedException>()?.Throw(); } /// <summary> /// Monadic bind. /// </summary> /// <returns>A producer that does nothing and just passes the volume's chunks on to the next step in the pipeline. This allows an existing volume to be processed by a pipeline</returns> public static VoxelChunkProducer Bind() { return new BoundProducer(); } class BoundProducer : VoxelChunkProducer { protected override void Process() {} } } /// <summary> /// Consumes VoxelChunks from a given VoxelVolume. /// </summary> public abstract class VoxelChunkConsumer : ConsumerGameTask<VoxelChunk, VoxelVolume> { /// <summary> /// The volume being processed in the pipeline /// </summary> public VoxelVolume Volume => State; public VoxelChunkConsumer() : base() {} protected override void ExceptionCaught(Exception e) { e.Filter<ObjectDisposedException>()?.Throw(); } } /// <summary> /// Intermidiate step in a VoxelChunk pipeline. Chunks go in one end, get some work done, and come out the other. /// </summary> public abstract class VoxelChunkProcessor : VoxelChunkProducer, IProcessorGameTask<VoxelChunk, VoxelVolume> { public IProducerGameTask<VoxelChunk, VoxelVolume> Input { get; private set; } public VoxelChunkProcessor() : base() {} public void Start(IProducerGameTask<VoxelChunk, VoxelVolume> input) { if (!HasStarted) { Input = input; Start(input.State); } } protected override void BeforeStart() { if (Input == null) { // handle error here } } protected override void ExceptionCaught(Exception e) { e.Filter<ObjectDisposedException>()?.Throw(); } } }
#if UNITY_EDITOR using System; using System.Collections; using System.Collections.Generic; using System.Linq; using BP12; using DChild.Gameplay.Objects; using DChild.Gameplay.Objects.Characters.Enemies; using Sirenix.OdinInspector; using UnityEngine; namespace DChildDebug { public class DebugBossSpawner : SingletonBehaviour<DebugBossSpawner> { public DebugBossDatabase database; public Transform spawnPoint; public Transform m_target; public static TypeCache<Boss> m_bossCache; private static Dictionary<Type, Type> m_controllerCache; private static GameObject m_bossInstance; public static int m_bossIndex; public static Transform target => m_instance.m_target; public static void NextBoss() { DestroyBoss(); IterateIndex(1); SpawnBoss(); } public static void PreviousBoss() { DestroyBoss(); IterateIndex(-1); SpawnBoss(); } public static void SpawnBoss(string minionName) { DestroyBoss(); var minionType = m_bossCache.GetType(minionName); m_bossIndex = m_instance.database.GetIndexOfBossType(minionType); SpawnBoss(); } private static void DestroyBoss() { if (m_bossInstance != null) { Destroy(m_bossInstance); Destroy(m_instance.GetComponent<BossAttackDebugger>()); } } private static void IterateIndex(int iteration) => m_bossIndex = (int)Mathf.Repeat(m_bossIndex + iteration, m_instance.database.Count); private static void SpawnBoss() { var spawnPoint = m_instance.spawnPoint; m_bossInstance = Instantiate(m_instance.database.GetBoss(m_bossIndex), spawnPoint.position, Quaternion.identity); var minionSentience = m_bossInstance.GetComponent<ISentientBeing>(); minionSentience.EnableBrain(false); var controller = (BossAttackDebugger)m_instance.gameObject.AddComponent(m_controllerCache[minionSentience.GetType()]); controller.Set(m_bossInstance.GetComponent<Boss>()); } protected override void Awake() { base.Awake(); m_bossCache = new TypeCache<Boss>(); InstantiateControllerCache(); } private static void InstantiateControllerCache() { var controllerGO = new GameObject("Something"); m_controllerCache = new Dictionary<Type, Type>(); var attackDebuggers = Reflection.GetDerivedClasses(typeof(BossAttackDebugger)); for (int i = 0; i < attackDebuggers.Length; i++) { var type = attackDebuggers[i]; var controller = (BossAttackDebugger)controllerGO.AddComponent(type); m_controllerCache.Add(controller.monsterType, type); } Destroy(controllerGO); } } } #endif
using ModelChannelMonitor; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace CHM_Site_V3_RedBox.Models { public class Sites { public int id_site { get; set; } public string site { get; set; } public string info_adicional { get; set; } public List<Plataforma> plataformaList { get; set; } } public class Plataforma { public int id_site { get; set; } public int id_plataforma { get; set; } public int id_tipogravador { get; set; } public string plataforma { get; set; } public string instanciaSql { get; set; } public string usuarioSql { get; set; } public string senhaSql { get; set; } public int ociosidade { get; set; } public DateTime cadastro { get; set; } public Plataforma() { } } public class SiteContext { public int id_site { get; set; } public int id_plataforma { get; set; } public int id_gravador { get; set; } public int id_status { get; set; } public string site { get; set; } public string diferenca { get; set; } public SiteContext() { } } public class PlataformaIdle { public string nome_plataforma { get; set; } public List<Gravador> gravador { get; set; } } public class Gravador { public int serial { get; set; } public List<Ramal> ramal { get; set; } } public class Ramal { public int ramal { get; set; } public Int64 diferenca { get; set; } } public class SiteIdle { public string site { get; set; } public string info_adicional { get; set; } public List<PlataformaIdle> plataforma { get; set; } } public class NewStatus { public string site { get; set; } public int gravador { get; set; } public int canal { get; set; } public string status { get; set; } } }
using System; using Kadastr.View.Forms; using Kadastr.Data; using Kadastr.Data.Model; namespace Kadastr.View { public partial class Building : DevExpress.XtraEditors.XtraForm { delegate void Test (); public Building() { InitializeComponent(); /*using (var db = new AppDBContent()) { var user = new User { FamilyName = "Данилов", FirstName = "Федор", Patronymic = "Алексеевич" }; db.User.Add(user); db.SaveChanges(); }*/ } private void buttonEdit1_Click(object sender, EventArgs e) { AddressForm address = new AddressForm(); address.ShowDialog(); } private void simpleButton3_Click(object sender, EventArgs e) { //Загрузка тестовых данных } } }
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Threading; using UnityEngine; public class PlayerMovement : MonoBehaviour { private Animator anim; private bool playerMoving; private float currentMoveSpeed; private Rigidbody2D playerRigid; private static bool playerExists; private bool playerAttacking; private float attackingTimeCounter; public float moveSpeed; public float diagMoveSpeed; public Vector2 lastMove; public float attackingTime; public string startZone; public GameObject PauseMenu; // /* NAME: Start SYNOPSIS: Gets the players start position and get the things needed for the animations to happen. DESCRIPTION: Gets the collider boxes and rigid body of the player to get the physical area that the player is in. Also, starts the animator function. RETURNS: AUTHOR: Thomas Furletti DATE: 07/08/2020 */ void Start() { anim = GetComponent<Animator>(); playerRigid = GetComponent<Rigidbody2D>(); if (!playerExists) { playerExists = true; // stop player from being destroyed on zone change DontDestroyOnLoad(transform.gameObject); } else { Destroy(gameObject); } } // /* NAME: Update SYNOPSIS: This update function gets all the position changes of the character. It also gets the direction. Checks if the player is attacking. DESCRIPTION: This function gets all of the components and user entry to make teh character move, get the characters position, checks if the player is attacking, gets the speed of the character movement. It also records the last position of the character so that it stays in the position that it was facing. RETURNS: AUTHOR: Thomas Furletti DATE: 07/08/2020 */ void Update() { // This if statement gets the button input from the pause menu so that it can he accessed whilst playing // the game in real time. This makes the players state set to inactive and sets the pause menu to active. if (Input.GetButtonDown("Pause")) { PauseMenu.SetActive(true); this.gameObject.SetActive(false); } playerMoving = false; // check if player is attacking if (!playerAttacking) { //Player movement if (Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < -0.5f) { // transform.Translate(new Vector3(Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f)); playerRigid.velocity = new Vector2(Input.GetAxisRaw("Horizontal") * currentMoveSpeed, playerRigid.velocity.y); playerMoving = true; lastMove = new Vector2(Input.GetAxisRaw("Horizontal"), 0f); } //Player movement if (Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f) { // transform.Translate(new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f)); playerRigid.velocity = new Vector2(playerRigid.velocity.x, Input.GetAxisRaw("Vertical") * currentMoveSpeed); playerMoving = true; lastMove = new Vector2(0f, Input.GetAxisRaw("Vertical")); } //Player movement if (Input.GetAxisRaw("Horizontal") < 0.5f && Input.GetAxisRaw("Horizontal") > -0.5f) { playerRigid.velocity = new Vector2(0f, playerRigid.velocity.y); } //Player movement if (Input.GetAxisRaw("Vertical") < 0.5f && Input.GetAxisRaw("Vertical") > -0.5f) { playerRigid.velocity = new Vector2(playerRigid.velocity.x, 0f); } // Get input and initiate attack from player if (Input.GetKeyDown(KeyCode.Return)) { attackingTimeCounter = attackingTime; playerAttacking = true; playerRigid.velocity = Vector2.zero; anim.SetBool("Attack", true); } // check if player is moving at an angle if(Mathf.Abs(Input.GetAxisRaw("Horizontal")) > 0.5f && Mathf.Abs(Input.GetAxisRaw("Vertical")) > 0.5f) { currentMoveSpeed = moveSpeed * diagMoveSpeed; } else { currentMoveSpeed = moveSpeed; } } // Attack time counters and checkers if (attackingTimeCounter > 0) { attackingTimeCounter -= Time.deltaTime; } if (attackingTimeCounter <= 0) { playerAttacking = false; anim.SetBool("Attack", false); } // set animations anim.SetFloat("MoveX", Input.GetAxisRaw("Horizontal")); anim.SetFloat("MoveY", Input.GetAxisRaw("Vertical")); anim.SetBool("PlayerMoving", playerMoving); anim.SetFloat("LastMoveX", lastMove.x); anim.SetFloat("LastMoveY", lastMove.y); } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using SimpleFormValidationMVC.Models; namespace SimpleFormValidationMVC.Controllers { public class FilmeController : Controller { public IActionResult Index() { return View(); } [HttpPost] public IActionResult Salvar(Filme Filme) { if (!ModelState.IsValid) { return View("Error"); } Filme.DataAvaliacao = DateTime.Now; Filme.Id = Guid.NewGuid(); return View("Sucesso", Filme); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Entities; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; using Models; namespace Api { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var dbpassword = System.Environment.GetEnvironmentVariable("DBPASSWORD"); var connectionString = "Server=dbserver.twooter-network,1433;Database=Minitwit;Trusted_Connection=True;Integrated Security=false;User Id=SA;Password=" + dbpassword; System.Console.WriteLine(connectionString); services.AddDbContext<MinitwitContext>(o => o.UseSqlServer(connectionString)); services.AddScoped<IMinitwitContext, MinitwitContext>(); services.AddScoped<IUserRepository, UserRepository>(); services.AddScoped<IMessageRepository, MessageRepository>(); services.AddControllers( o => o.SuppressAsyncSuffixInActionNames = false); services.AddDistributedMemoryCache(); services.AddSession(options => { options.Cookie.Name = "session"; options.Cookie.IsEssential = true; }); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Api", Version = "v1" }); }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { using (var serviceScope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope()) { var context = serviceScope.ServiceProvider.GetRequiredService<MinitwitContext>(); context.Database.EnsureCreated(); context.Database.Migrate(); } app.UseDeveloperExceptionPage(); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Api v1")); //app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseSession(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); } } }
using System; namespace Compi_segundo { public enum EnumTok { } public enum enumTok { If, Then, Else, Fi, Do, Until, While, Read, Write, Float, Int, Bool, Program, And, Or, Not, For,True,False,Id,Error,Numero,NumeroFraccion,Null, mas, menos, por, entre, menor, menorIgual, mayor, mayorIgual, igual, igualIgual, diferente, puntoComa, coma, ParentesisAbre, parentesisCierra, llaveAbre, llaveCierra, reservada, entreIgual, porIgual, menosMenos, menosIgual, masMas, masIgual, porPor,final }; }
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Text; namespace SimpleBlogBlazor.Shared.Models { public class Post { public Guid PostId { get; set; } [Required] [StringLength(200, ErrorMessage = "Title is long (200 character limit).")] public string Title { get; set; } public string Content { get; set; } public int Category { get; set; } public PostStatus Status { get; set; } public DateTime CreatedOn { get; set; } public DateTime? UpdatedOn { get; set; } } }
using FluentNHibernate.Automapping; using FluentNHibernate.Mapping; using Semafaro.Titulos.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Semafaro.Titulos.Mapping { public class CronnSgvCobrancaMap : ClassMap<CronnSgvCobranca> { public CronnSgvCobrancaMap() { Id(x => x.Id).GeneratedBy.Identity(); Map(x => x.DataCobranca); Map(x => x.ValorPagto); Map(x => x.ValorTotal); Map(x => x.BoletoLinhaDig); Map(x => x.BoletoValor); Map(x => x.BoletoNossoNro).Not.Nullable(); Map(x => x.Dac); Map(x => x.BoletoCodBarras); Map(x => x.CustoBoleto); Map(x => x.TipoCobranca); Map(x => x.Situacao); Map(x => x.DataVencimento); Map(x => x.DataPagamento); Map(x => x.Juros); Map(x => x.Multa); Map(x => x.OutrosAcrescimos); Map(x => x.ValorTitulo); Map(x => x.NumeroDocumento); Map(x => x.Parcela); Map(x => x.DataImpressao); Map(x => x.UsuarioImpressao); Map(x => x.CobrancaRede); Map(x => x.LimiteUnificado); Map(x => x.EmailEnviado); Map(x => x.IniciativaRegeracao); Map(x => x.DataProcessamento); Map(x => x.IdCliente); Map(x => x.IdCobrancaOrigem); Map(x => x.IdNegociacaoCobranca); Map(x => x.IdConvenioBancario); Map(x => x.IdParametroCobranca); Map(x => x.IdTerminal); Map(x => x.IdRede); Map(x => x.IdResponsavelLimite); Map(x => x.IdEmpresa); Map(x => x.DataInclusao); Map(x => x.DataAlteracao); Table("Cobranca"); } } }
using FeriaVirtual.Api.Local.Models.Dto; using FeriaVirtual.Application.Services.Users.Create; using FeriaVirtual.Domain.SeedWork.Commands; using Microsoft.AspNetCore.Mvc; using System; namespace FeriaVirtual.Api.Local.Controllers.Users { [ApiController] public class CreateUserController : ControllerBase { private readonly ICommandBus _commandBus; public CreateUserController(ICommandBus commandBus) => _commandBus = commandBus; [HttpPost] [Route("api/users/create")] public IActionResult Post([FromBody] CreateUserDto userDto) { try { var userCommand = CreateUserCommandBuilder.GetInstance() .Firstname(userDto.Firstname) .Lastname(userDto.Lastname) .Dni(userDto.Dni) .ProfileId(userDto.ProfileId) .Username(userDto.Username) .Password(userDto.Password) .Email(userDto.Email) .Build(); _commandBus.DispatchAsync(userCommand); return StatusCode(201, $"Usuario {userDto.Firstname} {userDto.Lastname} creado correctamente."); } catch (Exception ex) { return StatusCode(400, ex.Message); } } } }
using BHLD.Model.Abstract; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BHLD.Model.Models { [Table("hu_protection_title_setting")] public class hu_protection_title_setting:Auditable { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int id { get; set; } public int bhld_title_id { get; set; } [ForeignKey("bhld_title_id")] public virtual hu_protection_setting fk_hu_protection_setting { get; set; } public int bhld_list_id { get; set; } [ForeignKey("bhld_list_id")] public virtual hu_protection_title fk_hu_protection_title { get; set; } public int amount { get; set; } public DateTime? effect_date { get; set; } public DateTime? expire_date { get; set; } [StringLength(1)] public string actfg { get; set; } [StringLength(1023)] public string remark { get; set; } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; namespace Breu { public class BreuHudController : MonoBehaviour { private static BreuHudController current; // Start is called before the first frame update void Start() { if (current == null) { current = this; DontDestroyOnLoad(gameObject); } else { Destroy(this); } } // Update is called once per frame void Update() { } #region Load Levels public void loadLevel2() { BreuInventory.main.tutorialKey = true; SceneManager.LoadScene("BreuScene02", LoadSceneMode.Single); print("button"); } #endregion } }
using System.Collections.Generic; public class Timer { public float timePassed = 0; public float TimeRemaining { get { return expireTime - timePassed; } } public float expireTime; public bool isComplete = false; public delegate void TimeoutFunction(); public TimerManager cluster; private HashSet<TimeoutFunction> timeoutFunctions; public Timer(float expireTime, TimerManager cluster) { this.expireTime = expireTime; this.cluster = cluster; timeoutFunctions = new HashSet<TimeoutFunction>(); } public void AddTimeoutFunction(TimeoutFunction timeoutFunction) { timeoutFunctions.Add(timeoutFunction); } public void RemoveTimeoutFunction(TimeoutFunction timeoutFunction) { //Potentially risky code- what happens if it's not there? timeoutFunctions.Remove(timeoutFunction); } public void ClearTimeoutFunctions() { timeoutFunctions.Clear(); } public void ExecuteTimeoutFunctions() { foreach (TimeoutFunction timeoutFunction in timeoutFunctions) { timeoutFunction(); } } public void Start() { cluster.StartTimer(this); } public void Stop() { cluster.StopTimer(this); } public void Reset() { cluster.ResetTimer(this); } }
using ApiSGCOlimpiada.Data.ProdutoPedidoOrcamentoDAO; using ApiSGCOlimpiada.Models; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; namespace ApiSGCOlimpiada.Controllers { [Authorize] [Route("api/[controller]")] [ApiController] public class ProdutoPedidoOrcamentoController : ControllerBase { private readonly IProdutoPedidoOrcamentoDAO dao; public ProdutoPedidoOrcamentoController(IProdutoPedidoOrcamentoDAO dao) { this.dao = dao; } [HttpGet] public IEnumerable<ProdutoPedidoOrcamento> GetAll() { return dao.GetAll(); } [HttpGet("{id}", Name = "GetProdutoPedidoOrcamento")] public IActionResult GetProdutoPedidoOrcamentoById(long id) { var ProdutoOrcamentoPedido = dao.Find(id); if (ProdutoOrcamentoPedido == null) return NotFound(new { Message = "ProdutoPedidoOrcamento não encontrado" }); return new ObjectResult(ProdutoOrcamentoPedido); } [HttpPost] public IActionResult Create([FromBody] ProdutoPedidoOrcamento produtoPedidoOrcamento) { if (dao.Add(produtoPedidoOrcamento)) return new ObjectResult(produtoPedidoOrcamento); return BadRequest(new { Message = "Erro interno no servidor" }); } [HttpPut("{id}")] public IActionResult Put([FromBody] ProdutoPedidoOrcamento produtoPedidoOrcamento, long id) { if (dao.Find(id) == null) return NotFound(new { Message = "ProdutoPedidoOrcamento não encontrado" }); if (dao.Update(produtoPedidoOrcamento, id)) return new ObjectResult(produtoPedidoOrcamento); return BadRequest(new { Message = "Erro interno no servidor" }); } [HttpDelete("{id}")] public IActionResult Delete(long id) { if (dao.Find(id) == null) return NotFound(new { Message = "ProdutoPedidoOrcamento não encontrado" }); if (dao.Remove(id)) return Ok(new { Message = "Excluído com sucesso" }); return BadRequest(new { Message = "Erro interno no servidor" }); } [HttpGet("solicitacao/{idSolicitacao}")] public IEnumerable<ProdutoPedidoOrcamento> GetProdutosSolicitacao(long idSolicitacao) { return dao.GetSolicitacao(idSolicitacao); } } }
namespace TripDestination.Services.Data { using System; using System.Linq; using Contracts; using TripDestination.Data.Models; using TripDestination.Data.Common; public class ViewServices : IViewServices { private readonly IDbRepository<View> viewRepos; public ViewServices(IDbRepository<View> viewRepos) { this.viewRepos = viewRepos; } public void AddView(Trip trip, string ip) { bool userAlreadySeenThisTrip = trip.Views .Where(v => v.TripId == trip.Id && v.Ip == ip) .Any(); if (!userAlreadySeenThisTrip) { View view = new View() { TripId = trip.Id, Ip = ip }; this.viewRepos.Add(view); this.viewRepos.Save(); } } public void Delete(int id) { var view = this.viewRepos .All() .Where(v => v.Id == id) .FirstOrDefault(); if (view == null) { throw new Exception("No such view."); } this.viewRepos.Delete(view); this.viewRepos.Save(); } public IQueryable<View> GetAll() { return this.viewRepos .All(); } } }
using Unity.Entities; using Unity.Mathematics; public struct MeleeComponent : IComponentData { public float InterpolationFactor; // 0 for player position and 1 for farthest position from the player public float CooldownTimer; public float AttackTime; public sbyte Direction; public bool Attacking; public bool ReturningToPlayer; } public struct Inactive : IComponentData { } public struct OverlappingMelee : IComponentData { } //---------------------------------------------------------- public struct WeaponComponent : IComponentData { public int Damage; public int AmmoCount; public float FireInterval; public float FireTimer; public float MaxSpread; public float MinSpread; public float SpreadFactor; public float3 LastPosition; public Entity BulletEntity; public float3 BulletPositionOffset; public float BulletSpeed; } public struct WeaponPositionOffset : IComponentData { public float3 Value; } public struct WeaponFireInput : IComponentData { public bool Firing; } public struct SingleFire : IComponentData { } public struct WithMelee : IComponentData { } public struct KeepMeleeRemovedOnPickup : IComponentData { } public struct Bullet : IComponentData { public int Damage; } public struct OverlappingWeaponPickup : IComponentData { } public struct OverlappingBullet : IComponentData { }
using Compiler.TreeStructure.MemberDeclarations; namespace Compiler.TreeStructure.Expressions { public interface ICall: ICommonTreeInterface, ICommonCall { string InputType { get; set; } string Identifier { get; set; } IMemberDeclaration MemberDeclaration { get; set; } } }
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Text; using PiwoBack.Data.Models; namespace PiwoBack.Data.Models { public class User : Entity { [Required] public string Username { get; set; } [Required] public string Email { get; set; } [Required] public string PasswordHash { get; set; } public DateTime RegisterDate { get; set; } public UserRole Role { get; set; } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using GodMorgon.CardEffect; namespace GodMorgon.GameSequencerSpace { public class GSA_PlayerDefense : GameSequencerAction { /** * Should apply a visual defense effect */ public override IEnumerator ExecuteAction(GameContext context) { //launch particle system PlayerManager.Instance.OnShield(); //wait the time of the defense particle effect yield return new WaitForSeconds(PlayerManager.Instance.playerShield.GetDuration()); } } }
namespace Uintra.Core.Search.Entities { public class BaseFacet { public string Name { get; set; } public long Count { get; set; } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; /** * A type of control that's turned on when a specified object is placed in */ public class HoldActivated : MonoBehaviour { //the object that turns on this control public Transform targetObj; //whatever this thing controls public FloatEvent OnActivated; //sound played on activate public AudioSource activateSound; //how close the target needs to be to consider placed public float activateDistance; //How much "value" is sent to the connected event when activated public float value; //if true, control continuously sends value while being pressed //else, it only acts as an on/off signal public bool contSend; //whether this control is activated or not private bool on; //last state of this control private bool lastState; private void Start() { on = (Vector3.Distance(targetObj.position, transform.position) <= activateDistance); //identifier will have same material as target object MeshRenderer identifier = transform.parent.parent.Find("Identifier").GetComponent<MeshRenderer>(); identifier.material = targetObj.gameObject.GetComponent<MeshRenderer>().material; lastState = on; } void Update() { lastState = on; on = (Vector3.Distance(targetObj.position, transform.position) <= activateDistance); if (on) { targetObj.gameObject.GetComponent<Rigidbody>().isKinematic = true; targetObj.gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero; targetObj.position = transform.position; targetObj.gameObject.GetComponent<Rigidbody>().isKinematic = false; activateSound.Play(); } //if contsend, continuously send value to event whle button is pressed if (on != lastState) OnActivated.Invoke(value); } }
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using Alabo.Domains.Entities; using Alabo.Domains.Enums; using Alabo.Extensions; using Alabo.Framework.Basic.Grades.Domain.Services; using Alabo.Industry.Shop.Activitys.Domain.Entities; using Alabo.Industry.Shop.Activitys.Dtos; using Alabo.Industry.Shop.Products.Domain.Entities; using Alabo.Industry.Shop.Products.Domain.Services; using Alabo.Maps; using Alabo.UI.Design.AutoForms; using Alabo.Web.Mvc.Attributes; using Alabo.Web.Mvc.ViewModel; using Microsoft.AspNetCore.Http; using Newtonsoft.Json; namespace Alabo.Industry.Shop.Activitys.Modules.MemberDiscount.Model { /// <summary> /// 会员折扣(会员等级) /// </summary> [ClassProperty(Name = "会员折扣")] public class MemberDiscountActivity : BaseViewModel, IActivity { /// <summary> /// 会员等级 /// </summary> [Display(Name = "设置会员等级价")] [Field(ControlsType = ControlsType.JsonList, ListShow = true, EditShow = true)] [HelpBlock("如果折扣为空或者0,则不设置折扣")] public List<MemberDiscountActivityItem> DiscountList { get; set; } = new List<MemberDiscountActivityItem>(); /// <summary> /// get auto form /// </summary> /// <param name="obj"></param> /// <returns></returns> public AutoForm GetAutoForm(object obj) { //data if (obj == null) { return null; } var discountList = obj.MapTo<MemberDiscountActivity>()?.DiscountList; if (discountList == null || discountList.Count <= 0) { return null; } //builder auto form var fieldGroups = AutoFormMapping.GetFormFields(discountList).ToList(); fieldGroups.ForEach(group => { var fields = new List<FormFieldProperty>(); var gradeItem = group.Items.ToList().Find(i => i.Field == "gradeItems"); var jsonItems = gradeItem?.JsonItems; jsonItems.Foreach(item => { var tempField = item.Items.ToList().Find(i => i.Field == "price"); if (tempField == null) { return; } tempField.Name = item.Items.ToList().Find(i => i.Field == "name").Value?.ToString(); tempField.Field = item.Items.ToList().Find(i => i.Field == "id").Value?.ToString(); fields.Add(tempField); }); group.Items.Remove(gradeItem); //add group.Items.AddRange(fields); }); var autoForm = AutoFormMapping.Convert<MemberDiscountActivity>(); autoForm.Groups[0].Items[0].JsonItems = fieldGroups; return autoForm; } /// <summary> /// get default value /// </summary> public object GetDefaultValue(ActivityEditInput activityEdit, Activity activity) { if (activityEdit.ProductId <= 0) { return null; } var isDefault = true; var result = new MemberDiscountActivity(); if (!string.IsNullOrWhiteSpace(activity.Value)) { isDefault = false; result = JsonConvert.DeserializeObject<MemberDiscountActivity>(activity.Value); } //grade price var productSkus = Resolve<IProductSkuService>().GetGradePrice(activityEdit.ProductId).ToList(); if (isDefault) { result.DiscountList = productSkus.Select(g => GetDefaultSku(g)).ToList(); return result; } //update data var discountList = new List<MemberDiscountActivityItem>(); productSkus.ForEach(item => { var tempDiscount = result.DiscountList.Find(p => p.ProductSkuId == item.Id); if (tempDiscount == null) { discountList.Add(GetDefaultSku(item)); } else { //productSku tempDiscount.GradeItems.ForEach(grade => { var tempGrade = item.GradePriceList.Find(g => g.Id == grade.Id); if (tempGrade != null) { if (grade.Name != tempGrade.Name) { grade.Name = tempGrade.Name; } } else { tempDiscount.GradeItems.Remove(grade); } }); discountList.Add(tempDiscount); } }); result.DiscountList = discountList.OrderBy(p => p.ProductSkuId).ToList(); return result; } public ServiceResult SetValue(HttpContext httpContext) { throw new NotImplementedException(); } /// <summary> /// set value /// </summary> /// <param name="rules"></param> /// <returns></returns> public ServiceResult SetValueOfRule(object rules) { var model = rules.ToObject<MemberDiscountActivity>(); if (model != null && model.DiscountList.Count > 0) { //get all grade var userGrades = Resolve<IGradeService>().GetUserGradeList().ToList(); model.DiscountList.ForEach(item => { item.GradeItems.ForEach(grade => { var tempGrade = userGrades.Find(g => g.Id == grade.Id); if (tempGrade != null) { grade.Name = tempGrade.Name; } }); }); } var result = new ServiceResult(true); result.ReturnObject = model; return result; } private MemberDiscountActivityItem GetDefaultSku(ProductSku productSku) { return new MemberDiscountActivityItem { ProductSkuId = productSku.Id, Name = productSku.PropertyValueDesc, Bn = productSku.Bn, Price = productSku.Price, GradeItems = productSku.GradePriceList.MapTo<List<ProductSkuGradeItem>>() }; } } /// <summary> /// item /// </summary> public class MemberDiscountActivityItem { /// <summary> /// SkuID /// </summary> [Display(Name = "SkuID")] [Field(ControlsType = ControlsType.Label, ListShow = true, EditShow = true)] public long ProductSkuId { get; set; } /// <summary> /// 规格属性名称 /// </summary> [Display(Name = "规格属性名称")] [Field(ControlsType = ControlsType.Label, ListShow = true, EditShow = true)] public string Name { get; set; } /// <summary> /// 商品货号 /// </summary> [Display(Name = "商品货号")] [Field(ControlsType = ControlsType.Label, ListShow = true, EditShow = true)] public string Bn { get; set; } /// <summary> /// 销售价 /// </summary> [Display(Name = "销售价")] [Field(ControlsType = ControlsType.Label, ListShow = true, EditShow = true)] public decimal Price { get; set; } /// <summary> /// grade items /// </summary> [Display(Name = "等级价")] [Field(ControlsType = ControlsType.JsonList, ListShow = true, EditShow = true)] public List<ProductSkuGradeItem> GradeItems { get; set; } } /// <summary> /// grade item /// </summary> public class ProductSkuGradeItem { /// <summary> /// 会员等级 /// </summary> [Display(Name = "等级ID")] [Field(ControlsType = ControlsType.Hidden, ListShow = true, EditShow = true)] public Guid Id { get; set; } /// <summary> /// 等级名称 /// </summary> [Display(Name = "等级名称")] [Field(ControlsType = ControlsType.Label, ListShow = true, EditShow = true)] public string Name { get; set; } /// <summary> /// 会员价 /// </summary> [Display(Name = "会员价")] [Field(ControlsType = ControlsType.Decimal, ListShow = true, EditShow = true, Width = "60")] public decimal Price { get; set; } } }
using ComInLan.Model.Base; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ComInLan.Model.Packet { public class ServerPacket : Json, IServerPacket { public string Id { get; set; } public string DomainId { get; set; } public string Name { get; set; } public ServerPacketType Type { get; set; } } }
using System; using System.Collections.Generic; using Assets.Scripts.Models.Ammo; using Assets.Scripts.Models.ResourceObjects; using Assets.Scripts.Models.ResourceObjects.CraftingResources; namespace Assets.Scripts.Models.Weapons { public class DragunobSniperRifle : Weapon { public DragunobSniperRifle() { WeaponType = WeaponType.Fire; WeaponInventoryId = 19; WeaponInventoryName = "119_DragunovSniperRifle"; AmmoInventoryName = "DragunovAmmo"; AmmoType = typeof(DragunovAmmo); MagazineCapacity = 10; LocalizationName = "dragunov_sniper_rifle"; Description = "fire_weapon"; IconName = "dragunov_sniper_rifle"; Durability = 2500; CanZoom = true; CraftRecipe = new List<HolderObject>(); CraftRecipe.Add(HolderObjectFactory.GetItem(typeof(WoodResource), 150)); CraftRecipe.Add(HolderObjectFactory.GetItem(typeof(Metal), 300)); } public override void Use(GameManager gameManager, Action<int> changeAmount = null) { base.Use(gameManager, changeAmount); if (gameManager.Player.Torch.IsActive) gameManager.Player.Torch.Hide(); } } }
using System; using System.Collections.Generic; using System.ComponentModel; namespace StarBastardCore.Website.Code.Game.Gameplay.Actions { public class GameActionBase { public string ActionName { get; set; } public Dictionary<string, object> Parameters { get; set; } public GameActionBase() { ActionName = GetType().Name; Parameters = new Dictionary<string, object>(); } public GameActionBase(GameActionBase action) { ActionName = action.ActionName; Parameters = action.Parameters; } public GameActionBase(Dictionary<string, object> items) { ActionName = GetType().Name; foreach(var item in items) { Parameters.Add(item.Key, item.Value); } } public virtual void Commit(GameContext entireContext) { throw new InvalidOperationException("Implemente me in derived type."); } public TType Item<TType>(string key) { if(!Parameters.ContainsKey(key)) { return default(TType); } var value = Parameters[key]; try { return (TType)value; } catch { try { return (TType) Convert.ChangeType(value, typeof (TType)); } catch { return (TType)TypeDescriptor.GetConverter(typeof(TType)).ConvertFromInvariantString(value.ToString()); } } } } }
namespace P09TrafficLights { using System; using Models; public class Startup { public static void Main() { string[] inputData = Console.ReadLine().Split(); int numberOfRotates = int.Parse(Console.ReadLine()); TrafficLight trafficLight = new TrafficLight(inputData); for (int i = 0; i < numberOfRotates; i++) { trafficLight.Rotate(); Console.WriteLine(trafficLight); } } } }
using System; public class Programmer : Creator { public override void Create() { throw new NotImplementedException(); } private void BrainStirnSolutions() { base.CreativityLevel = base.CreativityLevel - 15; base.Energy = base.Energy - 10; Console.WriteLine("Brainstorming solutions..."); } private void PickMostOptimalSolution() { base.CreativityLevel = base.CreativityLevel - 5; base.Energy = base.Energy - 5; Console.WriteLine("Picking most optimal solution..."); } private void WriteCode() { base.CreativityLevel = base.CreativityLevel - 7; base.Energy = base.Energy - 5; Console.WriteLine("Writing code..."); } private void TestCode() { base.CreativityLevel = base.CreativityLevel - 3; base.Energy = base.Energy - 3; Console.WriteLine("Testing code..."); } }
using System; using System.Drawing; using CoreFoundation; using UIKit; using Foundation; using Aquamonix.Mobile.IOS.Views; using Aquamonix.Mobile.Lib.Utilities; using Aquamonix.Mobile.IOS.UI; namespace Aquamonix.Mobile.IOS.ViewControllers { [Register("UniversalView")] public class UniversalView : UIView { public UniversalView() { Initialize(); } public UniversalView(RectangleF bounds) : base(bounds) { Initialize(); } void Initialize() { BackgroundColor = UIColor.Red; } } [Register("SliderViewController")] public class SliderViewController : UIViewController { // private static SliderViewController _instance; // private string DeviceId; private SliderViewController() { View.AddSubview(new RangeSliderView(new CoreGraphics.CGRect(50, 100, 300, 50))); } //public static SliderViewController CreateInstance(string deviceId) //{ // //ExceptionUtility.Try(() => // //{ // // if (_instance != null && _instance.DeviceId != deviceId) // // { // // _instance.Dispose(); // // _instance = null; // // } // //}); // //if (_instance == null) // // _instance = new SliderViewController(); // //return _instance; //} public override void DidReceiveMemoryWarning() { // Releases the view if it doesn't have a superview. base.DidReceiveMemoryWarning(); // Release any cached data, images, etc that aren't in use. } public override void ViewDidLoad() { View = new UniversalView(); this.SetCustomBackButton(); base.ViewDidLoad(); // Perform any additional setup after loading the view } public void SetCustomBackButton() { ExceptionUtility.Try(() => { if (this.NavigationItem != null) { this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.BackArrow, UIBarButtonItemStyle.Plain, (o, e) => { if (this.NavigationController != null) this.NavigationController.PopViewController(true); }); } }); } } }
//---------------------------------------------------------------------- // csMain_Scene.cs // Handles the main (and only) menu for the game. using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; public class csMain_Scene : MonoBehaviour { private bool DEBUG_LOCAL = false; // Starting Distance private string LEAF_NAME = "leaf"; // leaf base name private int MAX_CUBES = 50; // Max size private int MAX_LEAF_TYPES = 5; // Max # materials private float START_Z = 100.0f; // Starting Distance private float rayDistance = 200.0f; // The click-ray distance // private float FORCE_LEAF = 6; // private float FORCE_HALF = 3; private float SIZE_X = 10; private float SIZE_Y = 6; private string hitType = ""; private AudioSource[] myAudio; private float timeDown = 0.0f; public GameObject[] cubes; // All cubes public GameObject cube; // A cube Prefab public GameObject anim1; // Touch animation public GameObject points; // Touch animation public int maxCubes; // Current max cubes public int scoreAdd; public int bonusAdd; public Material[] leafMaterials; // Different leafs //---------------------------------------------------------------------- // Unity Start Fn void Start() { maxCubes = 3; // Start slow csMenu_Scene.currentCubes = 0; scoreAdd = 1; bonusAdd = 0; cubes = new GameObject[MAX_CUBES]; SetupAudio(); } //---------------------------------------------------------------------- // Load in audio sources. void SetupAudio() { int i; AudioSource[] aSources = GetComponents<AudioSource>(); myAudio = new AudioSource[15]; for (i=0; i < aSources.Length; i++) { myAudio[i] = aSources[i]; } } //---------------------------------------------------------------------- // Unity Update Fn void Update() { if (! Application.isLoadingLevel) { CreateCube(csMenu_Scene.currentCubes); CheckMouse(); CheckGameOver(); } } //---------------------------------------------------------------------- // Game over here? void CheckGameOver() { if (csMenu_Scene.gameOver) { timeDown += Time.deltaTime; if (timeDown > 3.0f) { csMenu_Scene.returnMenu = true; } } if (csMenu_Scene.returnMenu) { //Application.LoadLevel("menu_scene"); SceneManager.LoadScene("menu_scene"); } } //---------------------------------------------------------------------- // Check mouse click and perform operations when object hit. void CheckMouse() { string hitGameObjectName; string hitName; GameObject hitObject; RaycastHit hit = new RaycastHit(); float x = Random.Range(0.0f, SIZE_X) - SIZE_X / 2; float y = Random.Range(0.0f, SIZE_Y) - SIZE_Y / 2; Ray raycst; bool hitScored; Vector3 pos; Vector3 v3; hitScored = false; // Check the left mouse button, or the touch screen. if (Input.GetMouseButtonDown(0)) { // Get a raycast. raycst = Camera.main.ScreenPointToRay(Input.mousePosition); if (!csMenu_Scene.gameOver && Physics.Raycast(raycst, out hit, rayDistance)) { // Get hit Object hitObject = hit.collider.gameObject; // Get name of object hitGameObjectName = hitObject.name; // Save position pos = v3 = hitObject.transform.position; // Is this object a leaf? if (hitGameObjectName.Contains(LEAF_NAME)) { // Reset location, and add another cube. WriteVector3(out v3, x, y, START_Z); // Reset the object to the starting distance. hitObject.transform.position = v3; // Go set a new random leaf, prevents cheating! RandomLeaf(hit.collider.gameObject); // Add in the bonus. csMenu_Scene.score += scoreAdd + bonusAdd; hitScored = true; hitName = hitGameObjectName; hitName = hitName.Replace(LEAF_NAME, ""); if (hitName.Trim() == hitType.Trim()) { IncreaseBonus(); } else { bonusAdd = 0; } hitType = hitName; // Plays a wind-chime 1 to 6, create the tounch anim. myAudio[int.Parse(hitType) + 1].Play(); CreateAnim(pos); // Chance of new object is less and less. if (Random.Range(1,maxCubes * 2) == 1) { maxCubes++; } if (DEBUG_LOCAL) { Debug.Log("Hit"); } } // It's not a leaf, only for a log. else if (DEBUG_LOCAL) { Debug.Log("Miss"); } // Incease the score bonus +1 if not missed a leaf yet. if (hitScored) { scoreAdd++; } } // If the game isn't over yet. if (!csMenu_Scene.gameOver) { if (!hitScored) { // Missed, reduce score bonuses. myAudio[11].Play(); scoreAdd = scoreAdd / 2; scoreAdd = scoreAdd == 0 ? 1 : scoreAdd; bonusAdd = 0; } } if (DEBUG_LOCAL) { Debug.Log("score = " + csMenu_Scene.score); } } // if (Input.GetMouseButtonDown(0)) { } //---------------------------------------------------------------------- // Create the unity 3D object, a leaf. void CreateCube (int cc) { float x = Random.Range(0.0f, SIZE_X) - SIZE_X / 2; float y = Random.Range(0.0f, SIZE_Y) - SIZE_Y / 2; int r = Random.Range(0, MAX_LEAF_TYPES); Vector3 v; WriteVector3(out v, x, y, START_Z); // If maxLeafs (cubes) not created, make another. if (csMenu_Scene.currentCubes < MAX_CUBES && csMenu_Scene.currentCubes < maxCubes) { // Create the game object cubes[cc] = (GameObject)Instantiate(cube, v, Quaternion.identity); // Update the game object name cubes[cc].name = (LEAF_NAME + r.ToString()).Trim(); // Change the object material. cubes[cc].GetComponent<Renderer>().material = leafMaterials[r]; // One more leaf. csMenu_Scene.currentCubes++; } } //---------------------------------------------------------------------- // Create animation effect void CreateAnim (Vector3 pos) { Color c; GameObject scoreText; float crl = Mathf.Min(bonusAdd, 4) / 4.0f; Vector3 v3; Instantiate(anim1, pos, Quaternion.identity); WriteVector3(out v3, pos.x, pos.y, pos.z); scoreText = (GameObject)Instantiate(points, v3, Quaternion.identity); //c = Color(1, 0, crl * 0.8f, 1); c.r = 1.0f; c.g = 0.0f; c.b = crl * 0.8f; c.a = 1.0f; scoreText.GetComponent<TextMesh>().color = c; if (bonusAdd > 0) { scoreText.GetComponent<TextMesh>().fontStyle = FontStyle.Bold; } scoreText.GetComponent<TextMesh>().text = "+" + (scoreAdd + bonusAdd).ToString(); // scoreText.GetComponent<TextMesh>().fontSize = 24 + crl * 20; } //---------------------------------------------------------------------- // Increase the bonus void IncreaseBonus() { bonusAdd = bonusAdd >= 1000 ? bonusAdd + 1000 : bonusAdd; bonusAdd = bonusAdd == 100 ? 1000 : bonusAdd; bonusAdd = bonusAdd == 10 ? 100 : bonusAdd; bonusAdd = bonusAdd == 0 ? 10 : bonusAdd; /* if (bonusAdd >= 2000) { myAudio[7].Play(); } else if (bonusAdd == 1000) { myAudio[8].Play(); } else if (bonusAdd == 100) { myAudio[10].Play(); } else if (bonusAdd == 10) { myAudio[9].Play(); } */ } //---------------------------------------------------------------------- // Make a random leaf. void RandomLeaf(GameObject leaf) { int r = Random.Range(0, MAX_LEAF_TYPES); leaf.name = (LEAF_NAME + r.ToString()).Trim(); leaf.GetComponent<Renderer>().material = leafMaterials[r]; } //---------------------------------------------------------------------- // Public Functions //---------------------------------------------------------------------- //---------------------------------------------------------------------- // Load a vector w/o using new to avoid garbage colletion public static void WriteVector3(out Vector3 v, float x, float y, float z) { v.x = x; v.y = y; v.z = z; } } // End of class
using System; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Configuration; using System.Linq; using System.Text; using Framework.Core.Common; using Framework.Core.Config; using Tests.Pages.Oberon.Common; using OpenQA.Selenium; using OpenQA.Selenium.Support.PageObjects; namespace Tests.Pages.Oberon.FinancialBatchManager { public class BatchManagerList : BatchManagerBasePage { #region Page Objects public const string Url = "FinancialBatch"; public string HeaderText = "Batch Manager"; public By AddLocator = By.CssSelector(".add"); public IWebElement Add { get { return _driver.FindElement(AddLocator); } } public IWebElement Name { get { return _driver.FindElement(By.CssSelector("#Name")); } } public IWebElement DepositDate { get { return _driver.FindElement(By.CssSelector("#DepositDate")); } } public IWebElement Notes { get { return _driver.FindElement(By.CssSelector("#Notes")); } } public IWebElement CurrentCount { get { return _driver.FindElement(By.CssSelector("td#CurrentCount")); } } public IWebElement ExpectedCount { get { return _driver.FindElement(By.CssSelector("#ExpectedCount")); } } public IWebElement ExpectedAmount { get { return _driver.FindElement(By.CssSelector("#ExpectedAmount")); } } public IWebElement CurrentAmount { get { return _driver.FindElement(By.CssSelector("td#CurrentAmount")); } } public IWebElement Status { get { return _driver.FindElement(By.CssSelector(".input[title='Status']")); } } public IWebElement DateOpenedBlock { get { return _driver.FindElement(By.CssSelector("input#DateOpened")); } } public IWebElement DateClosedBlock { get { return _driver.FindElement(By.CssSelector(".input[title='DateClosed']")); } } public IWebElement DepositDateBlock { get { return _driver.FindElement(By.CssSelector("input#DepositDate")); } } public IWebElement BankAccountBlock { get { return _driver.FindElement(By.CssSelector("select#BankAccountId")); } } public IWebElement NotesWarningBlock { get { return _driver.FindElement(By.CssSelector("span.textLimiterWarning")); } } public IWebElement NameValidationErrorBlock { get { return _driver.FindElement(By.CssSelector("#Name + span.field-validation-error")); } } #endregion public BatchManagerList(Driver driver) : base(driver) { } #region Methods /// <summary> /// Goes to batch manager create page via url /FinancialBatch /// </summary> public void GoToThisPage() { _driver.GoToPage(AppConfig.OberonBaseUrl + Url); WaitForHeaderToDisplay(HeaderLocator, Header, HeaderText); } /// <summary> /// Clicks Add button /// </summary> public void ClickAdd() { _driver.Click(Add); var createBatch = new FinancialBatchCreate(_driver); WaitForHeaderToDisplay(createBatch.HeaderLocator, createBatch.Header, createBatch.HeaderText); } /// <summary> /// returns status text /// </summary> public string FMBStatus { get { return Status.Text; } } /// <summary> /// retruns date opened value /// </summary> public string DateOpened { get { return DateOpenedBlock.GetAttribute("value"); } } /// <summary> /// returns date closed text /// </summary> public string DateClosed { get { return DateClosedBlock.Text; } } /// <summary> /// returns string collection of bank account options /// </summary> public virtual StringCollection BankAccountOptions { get { var items = new StringCollection(); foreach (IWebElement option in _driver.Options(BankAccountBlock)) { items.Add(option.Text); } return items; } } /// <summary> /// returns notes warning text /// </summary> public string NotesWarning { get { return NotesWarningBlock.Text; } } /// <summary> /// returns batch error text /// </summary> public string BatchNameError { get { return NameValidationErrorBlock.Text; } } /// <summary> /// Finds batch by name and clicks its detail page link /// </summary> public void SelectBatchByName(string name) { var flexigrid = new FlexiGrid(_driver, "FinancialBatchList"); flexigrid.GotoFirstPage(); ReadOnlyCollection<IWebElement> trs = flexigrid.FindElements(By.TagName("tr")); for (int i = flexigrid.GetCurrentPage(); i <= flexigrid.GetTotalPages(); i++) { foreach (IWebElement tr in trs) { var batchName = tr.FindElement(By.XPath("./child::td[3]/div/a")).Text; if (batchName == name) { tr.FindElement(By.XPath("./child::td[3]/div/a")).Click(); return; } } } throw new ArgumentException("Batch with given name not found"); } public new void ClickCancelLink() { var form = new FormElements(_driver); form.ClickCancelLink(); _driver.WaitForElementToDisplayBy(AddLocator); } #endregion } }
using DanialProject.Models.Database; using System; using System.Globalization; using System.Web; namespace DanialProject.Models.DataClasses { public class Others { public Others() { } public static string Check_OP(string op) { try { string[] split_Op = op.Split(new char[] { '.' }); if (int.Parse(split_Op[1].ToString()[0].ToString()) <= 0) { op = string.Concat(split_Op[0], "%"); } } catch (Exception exception) { } return op; } public static FilterFeatures FilterFeatures(FilterFeatures filterFeatures) { bool noFee; DateTime now; try { if (filterFeatures.Brough == null) { HttpCookie cookie = HttpContext.Current.Request.Cookies["FilterFeaturesDeatils"]; if (cookie != null) { cookie.Value = "Select One&&false&&0&0&&false&false"; now = DateTime.Now; cookie.Expires = now.AddDays(1); HttpContext.Current.Response.Cookies.Set(cookie); } else { HttpCookie httpCookie = new HttpCookie("FilterFeaturesDeatils") { Value = "Select One&&false&&0&0&&false&false" }; now = DateTime.Now; httpCookie.Expires = now.AddDays(1); HttpContext.Current.Response.Cookies.Add(httpCookie); } } else { HttpCookie cookie = HttpContext.Current.Request.Cookies["FilterFeaturesDeatils"]; if (cookie != null) { string neighborArray = ""; for (int i = 0; i < (int)filterFeatures.Neighborhood.Length; i++) { neighborArray = string.Concat(neighborArray, filterFeatures.Neighborhood[i], ","); } string featureArray = ""; for (int i = 0; i < (int)filterFeatures.Array.Length; i++) { featureArray = string.Concat(featureArray, filterFeatures.Array[i], ","); } object[] brough = new object[19]; brough[0] = filterFeatures.Brough; brough[1] = "&"; brough[2] = neighborArray; brough[3] = "&"; noFee = filterFeatures.NoFee; brough[4] = noFee.ToString(); brough[5] = "&"; brough[6] = filterFeatures.AvailibilityDate; brough[7] = "&"; brough[8] = filterFeatures.Guarantors; brough[9] = "&"; brough[10] = filterFeatures.PassengerElevators; brough[11] = "&"; brough[12] = filterFeatures.FrieghtElevators; brough[13] = "&"; brough[14] = featureArray; brough[15] = "&"; noFee = filterFeatures.CasebyCase; brough[16] = noFee.ToString(); brough[17] = "&"; noFee = filterFeatures.Under30lbs; brough[18] = noFee.ToString(); cookie.Value = string.Concat(brough); now = DateTime.Now; cookie.Expires = now.AddDays(1); HttpContext.Current.Response.Cookies.Set(cookie); } else { string neighborArray = ""; for (int i = 0; i < (int)filterFeatures.Neighborhood.Length; i++) { neighborArray = string.Concat(neighborArray, filterFeatures.Neighborhood[i], ","); } string featureArray = ""; for (int i = 0; i < (int)filterFeatures.Array.Length; i++) { featureArray = string.Concat(featureArray, filterFeatures.Array[i], ","); } HttpCookie httpCookie1 = new HttpCookie("FilterFeaturesDeatils"); object[] str = new object[19]; str[0] = filterFeatures.Brough; str[1] = "&"; str[2] = neighborArray; str[3] = "&"; noFee = filterFeatures.NoFee; str[4] = noFee.ToString(); str[5] = "&"; str[6] = filterFeatures.AvailibilityDate; str[7] = "&"; str[8] = filterFeatures.Guarantors; str[9] = "&"; str[10] = filterFeatures.PassengerElevators; str[11] = "&"; str[12] = filterFeatures.FrieghtElevators; str[13] = "&"; str[14] = featureArray; str[15] = "&"; noFee = filterFeatures.CasebyCase; str[16] = noFee.ToString(); str[17] = "&"; noFee = filterFeatures.Under30lbs; str[18] = noFee.ToString(); httpCookie1.Value = string.Concat(str); now = DateTime.Now; httpCookie1.Expires = now.AddDays(1); HttpContext.Current.Response.Cookies.Add(httpCookie1); } } } catch (Exception exception) { } return filterFeatures; } public static FilterBox GetFilterSession() { FilterBox filter = new FilterBox(); try { string data = HttpContext.Current.Request.Cookies["FilterBoxCookiesInDallienWebsite"].Value; string[] split = data.Split(new char[] { '&' }); filter.Filter = split[0]; filter.From_price = split[1]; filter.To_price = split[2]; filter.Bed = split[3]; filter.Bath = split[4]; } catch (Exception exception) { filter.Filter = "Rent"; filter.From_price = "0"; filter.To_price = "10000"; filter.Bed = "0+"; filter.Bath = ".5+"; } return filter; } public static double Getlatitude(double latitude, double dy) { return latitude + dy / 6378 * 57.3248407643312; } public static double Getlongitude(double longitude, double latitude, double dx) { double ans_dx_pi = dx / 6378 * 57.3248407643312; double New_long = longitude + ans_dx_pi / Math.Cos(latitude * 3.14 / 180); return New_long; } public static void SetFilterSession(FilterBox filter) { DateTime now; if (filter.Filter == null) { HttpCookie cookie = HttpContext.Current.Request.Cookies["FilterBoxCookiesInDallienWebsite"]; if (cookie != null) { cookie.Value = "Rent&$0&$10000&0+&.5+"; now = DateTime.Now; cookie.Expires = now.AddDays(1); HttpContext.Current.Response.Cookies.Set(cookie); } else { HttpCookie httpCookie = new HttpCookie("FilterBoxCookiesInDallienWebsite") { Value = "Rent&$0&$10000&0+&.5+" }; now = DateTime.Now; httpCookie.Expires = now.AddDays(1); HttpContext.Current.Response.Cookies.Add(httpCookie); } FilterFeatures filterFeatures = new FilterFeatures() { Brough = null }; DanialProject.Models.DataClasses.Others.FilterFeatures(filterFeatures); return; } HttpCookie cookie1 = HttpContext.Current.Request.Cookies["FilterBoxCookiesInDallienWebsite"]; if (cookie1 != null) { cookie1.Value = string.Concat(new string[] { filter.Filter, "&", filter.From_price, "&", filter.To_price, "&", filter.Bed, "&", filter.Bath }); now = DateTime.Now; cookie1.Expires = now.AddDays(1); HttpContext.Current.Response.Cookies.Set(cookie1); return; } HttpCookie httpCookie1 = new HttpCookie("FilterBoxCookiesInDallienWebsite") { Value = string.Concat(new string[] { filter.Filter, "&", filter.From_price, "&", filter.To_price, "&", filter.Bed, "&", filter.Bath }) }; now = DateTime.Now; httpCookie1.Expires = now.AddDays(1); HttpContext.Current.Response.Cookies.Add(httpCookie1); } public static FilterBoxDouble ValueToDouble() { double number; FilterBoxDouble filterBoxDouble = new FilterBoxDouble(); try { FilterBox filterBox = DanialProject.Models.DataClasses.Others.GetFilterSession(); filterBoxDouble.Filter = filterBox.Filter; NumberStyles style = NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.AllowLeadingSign | NumberStyles.AllowTrailingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands | NumberStyles.AllowCurrencySymbol | NumberStyles.Integer | NumberStyles.Number; CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); if (double.TryParse(filterBox.From_price, style, culture, out number)) { filterBoxDouble.From_price = number; } if (double.TryParse(filterBox.To_price, style, culture, out number)) { filterBoxDouble.To_price = number; } if (!filterBox.Bath.Contains("+")) { filterBoxDouble.Bath = Convert.ToDouble(filterBox.Bath); filterBoxDouble.BathPlus = false; } else { string[] bathvalue = filterBox.Bath.Split(new char[] { '+' }); filterBoxDouble.Bath = Convert.ToDouble(bathvalue[0]); filterBoxDouble.BathPlus = true; } if (!filterBox.Bed.Contains("+")) { filterBoxDouble.Bed = Convert.ToDouble(filterBox.Bed); filterBoxDouble.BedPlus = false; } else { string[] bedValue = filterBox.Bed.Split(new char[] { '+' }); filterBoxDouble.Bed = Convert.ToDouble(bedValue[0]); filterBoxDouble.BedPlus = true; } } catch (Exception) { } return filterBoxDouble; } } }
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class ButtonsController : MonoBehaviour { [SerializeField] GameObject[] buttons; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } internal void SwitchButtons(String buttonName) { foreach (GameObject button in buttons) { if (button.name != buttonName) { button.GetComponent<Button>().DrawButtonToColor(Color.black); } } } }
using System; namespace Game_of_numbers { class Program { static void Main(string[] args) { int firstInt = int.Parse(Console.ReadLine()); int secondInt = int.Parse(Console.ReadLine()); int magicNumber = int.Parse(Console.ReadLine()); int combinations = 0; for (int i = firstInt; i <= secondInt; i++) { for (int j = firstInt; j <= secondInt; j++) { combinations++; if (i + j == magicNumber && j >= i) { Console.WriteLine($"Number found! {j} + {i} = {i + j}"); return; } } } Console.WriteLine($"{combinations} combinations - neither equals {magicNumber}"); } } }
using UnityEngine; namespace StateMachines { public class PauseHandler2: StateHandler { public override void OnEnter() { //Time.timeScale = 0; } public override void OnExit() { //Time.timeScale = 1; } } }
using System; using System.Collections.Generic; using ReactMusicStore.Core.Domain.Interfaces.Validation; namespace ReactMusicStore.Core.Domain.Validation { public class Validation<TEntity> : IValidation<TEntity> where TEntity : class { private readonly Dictionary<string, IValidationRule<TEntity>> _validationsRules; public Validation() { _validationsRules = new Dictionary<string, IValidationRule<TEntity>>(); } protected virtual void AddRule(IValidationRule<TEntity> validationRule) { var ruleName = validationRule.GetType() + Guid.NewGuid().ToString("D"); _validationsRules.Add(ruleName, validationRule); } protected virtual void RemoveRule(string ruleName) { _validationsRules.Remove(ruleName); } public virtual ValidationResult Valid(TEntity entity) { var result = new ValidationResult(); foreach (var key in _validationsRules.Keys) { var rule = _validationsRules[key]; if (!rule.Valid(entity)) result.Add(new ValidationError(rule.ErrorMessage)); } return result; } } }
using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; namespace MinecraftToolsBoxSDK { public class SpectrumSlider : Slider { #region Public Methods static SpectrumSlider() { DefaultStyleKeyProperty.OverrideMetadata(typeof(SpectrumSlider), new FrameworkPropertyMetadata(typeof(SpectrumSlider))); } public SpectrumSlider() { SetBackground(); //Binding binding = new Binding(); //binding.Path = new PropertyPath("Value"); //binding.RelativeSource = new System.Windows.Data.RelativeSource(RelativeSourceMode.Self); //binding.Mode = BindingMode.TwoWay; //binding.Converter = new ValueToSelectedColorConverter(); //BindingOperations.SetBinding(this, SelectedColorProperty, binding); } #endregion #region Protected Methods protected override void OnValueChanged(double oldValue, double newValue) { base.OnValueChanged(oldValue, newValue); if (!m_withinChanging && !BindingOperations.IsDataBound(this, HueProperty)) { m_withinChanging = true; Hue = 360 - newValue; m_withinChanging = false; } } #endregion #region Private Methods private void SetBackground() { LinearGradientBrush backgroundBrush = new LinearGradientBrush() { StartPoint = new Point(0.5, 0), EndPoint = new Point(0.5, 1) }; const int spectrumColorCount = 30; Color[] spectrumColors = ColorUtils.GetSpectrumColors(spectrumColorCount); for (int i = 0; i < spectrumColorCount; ++i) { double offset = i * 1.0 / spectrumColorCount; GradientStop gradientStop = new GradientStop(spectrumColors[i], offset); backgroundBrush.GradientStops.Add(gradientStop); } Background = backgroundBrush; } private static void OnHuePropertyChanged( DependencyObject relatedObject, DependencyPropertyChangedEventArgs e) { if (relatedObject is SpectrumSlider spectrumSlider && !spectrumSlider.m_withinChanging) { spectrumSlider.m_withinChanging = true; double hue = (double)e.NewValue; spectrumSlider.Value = 360 - hue; spectrumSlider.m_withinChanging = false; } } #endregion #region Dependency Properties public double Hue { get { return (double)GetValue(HueProperty); } set { SetValue(HueProperty, value); } } public static readonly DependencyProperty HueProperty = DependencyProperty.Register("Hue", typeof(double), typeof(SpectrumSlider), new UIPropertyMetadata((double)0, new PropertyChangedCallback(OnHuePropertyChanged))); #endregion #region Private Members private bool m_withinChanging = false; #endregion } }
using System; using System.Diagnostics; namespace MinDbg.CorDebug { /// <summary> /// A base class for all COM wrappers. /// /// Taken from MDBG source. /// </summary> public abstract class WrapperBase : MarshalByRefObject { private readonly Object coobject; protected readonly CorDebuggerOptions options; /// <summary> /// Initializes an instance of the Wrapper class. /// </summary> /// <param name="value">COM object to wrap</param> protected WrapperBase(Object value, CorDebuggerOptions options) { Debug.Assert(value != null); this.coobject = value; this.options = options; } /// <summary cref="System.Object.Equals(Object)"> /// </summary> public override bool Equals(Object value) { if (!(value is WrapperBase)) return false; return ((value as WrapperBase).coobject == this.coobject); } /// <summary cref="System.Object.GetHashCode"> /// </summary> public override int GetHashCode() { return coobject.GetHashCode(); } /// <summary> /// Override also equality operator so we compare /// COM objects inside instead of wrapper references. /// </summary> /// <param name="operand">first operand</param> /// <param name="operand2">second operand</param> /// <returns>true if inner COM objects are the same, false otherwise</returns> public static bool operator ==(WrapperBase operand, WrapperBase operand2) { if (Object.ReferenceEquals(operand, operand2)) return true; if (Object.ReferenceEquals(operand, null)) // this means that operand==null && operand2 is not null return false; return operand.Equals(operand2); } /// <summary> /// Override also inequality operator so we compare /// COM objects inside instead of wrapper references. /// </summary> /// <param name="operand">first operand</param> /// <param name="operand2">second operand</param> /// <returns>true if inner COM objects are different, true otherwise</returns> public static bool operator !=(WrapperBase operand, WrapperBase operand2) { return !(operand == operand2); } } }
using Kitapcim.Models; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Net; using System.Web; using System.Web.Mvc; namespace Kitapcim.Controllers { public class YoneticiController : Controller { private Kitapcim.Models.Yonetici.YoneticiDBContext db=new Kitapcim.Models.Yonetici.YoneticiDBContext(); // // GET: /Yonetici/ public ActionResult Index() { return View(db.kitap.ToList()); } // GET: Movies/Details/5 public ActionResult Details(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Yonetici kitap = db.kitap.Find(id); if (kitap == null) { return HttpNotFound(); } return View(kitap); } // GET: Movies/Create public ActionResult Create() { return View(); } // POST: Movies/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see http://go.microsoft.com/fwlink/?LinkId=317598. [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include = "ID,kitap_adi,yazar_adi,tur,basim_tarihi,fiyat")] Yonetici kitap) { if (ModelState.IsValid) { db.kitap.Add(kitap); db.SaveChanges(); return RedirectToAction("Index"); } return View(kitap); } // GET: Movies/Edit/5 public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Yonetici kitap = db.kitap.Find(id); if (kitap == null) { return HttpNotFound(); } return View(kitap); } // POST: Movies/Edit/5 // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see http://go.microsoft.com/fwlink/?LinkId=317598. [HttpPost] [ValidateAntiForgeryToken] // sahte bir sayfadan gelmediğine emin olmak için kullanılır.Güvenlik önlemi public ActionResult Edit([Bind(Include = "ID,kitap_adi,yazar_adi,tur,basim_tarihi,fiyat")] Yonetici kitap) { if (ModelState.IsValid) { db.Entry(kitap).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(kitap); } // GET: Movies/Delete/5 public ActionResult Delete(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Yonetici kitap = db.kitap.Find(id); if (kitap == null) { return HttpNotFound(); } return View(kitap); } // POST: Movies/Delete/5 [HttpPost, ActionName("Delete")] [ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(int id) { Yonetici kitap = db.kitap.Find(id); db.kitap.Remove(kitap); db.SaveChanges(); return RedirectToAction("Index"); } protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Confluent.Kafka; namespace KafkaComparer.Producer { public class Program { static void Main(string[] args) { var topicName = Environment.GetEnvironmentVariable("TOPIC_NAME"); var kafkaUrl = Environment.GetEnvironmentVariable("KAFKA_URL"); Console.WriteLine($"Broker address : {kafkaUrl}"); Console.WriteLine($"Topic name: {topicName}"); // https://kafka.apache.org/0110/documentation.html#producerconfigs var config = new ProducerConfig(){ MessageMaxBytes = 3000000, BootstrapServers = kafkaUrl, MessageTimeoutMs = 1000 }; using (var producer = new Producer<string, string>(config)) { string text = null; while (text != "exit") { Console.Write("Enter message: "); text = Console.ReadLine(); if(string.IsNullOrEmpty(text)) continue; try { var values = text.Split('-'); var value = values[0]; string key = default; if(values.Count() > 1){ key = values[1]; } Message<string, string> message; Task<DeliveryReport<string, string>> dr; if(!string.IsNullOrEmpty(key)) { message = new Message<string, string> { Key = key, Value = value }; dr = producer.ProduceAsync(topicName, message); } else { message = new Message<string, string> { Value = value }; dr = producer.ProduceAsync(topicName, message); } var result = dr.GetAwaiter().GetResult(); Console.WriteLine($"{DateTime.Now} Delivered to '{result.TopicPartitionOffset}'"); } catch (KafkaException e) { Console.WriteLine($"Delivery failed: {e.Error.Reason}"); } } producer.Flush(TimeSpan.FromSeconds(10)); } } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace MiniShop { public partial class Form1 : Form { Dictionary<TabPage, Merchandise> merchandises; //List<Merchandise> merchandises; List<ShopBasket> basket; public Form1() { InitializeComponent(); // merchandises = new List<Merchandise>(); merchandises = new Dictionary<TabPage, Merchandise>(); basket = new List<ShopBasket>(); LoadMerch(); } public void LoadMerch() { using (System.IO.StreamReader reader = new System.IO.StreamReader("Merch.txt")) { string line = null; while ((line = reader.ReadLine()) != null) { var data = line.Split(';'); Merchandise merch = new Merchandise(data[0], data[1], double.Parse(data[2]), double.Parse(data[3])); string fileName = merch.Name + ".JPG"; string path = Path.Combine(Environment.CurrentDirectory, @"foto\", fileName); merch.ImagePath = path; FileInfo inf = new FileInfo(path); TabPage page = new TabPage(); page.Text = (merch.Name).ToString(); if (inf.Exists ) { using (Bitmap img = new Bitmap(path)) { page.BackgroundImage = (Image)img.Clone(); page.BackgroundImageLayout = ImageLayout.Stretch; } } MerchInfo.TabPages.Add(page); merchandises.Add(page, merch); } } } private void MerchInfo_SelectedIndexChanged(object sender, EventArgs e) { if (MerchInfo.TabPages.Count != 0) { Pavadinimas.Text = merchandises[MerchInfo.SelectedTab].Name; Svoris.Text = merchandises[MerchInfo.SelectedTab].Weight.ToString() + " Kg"; Kaina.Text = merchandises[MerchInfo.SelectedTab].Price.ToString() + " Eur"; } } private void IdetiBtn_Click(object sender, EventArgs e) { var mer = merchandises[MerchInfo.SelectedTab]; bool exist = false; foreach (var item in basket) { if (item.Name == mer.Name) exist = true; } if(!exist) basket.Add(new ShopBasket(mer)); else { var result = MessageBox.Show("Preke jau krepselyje"); } } private void button2_Click(object sender, EventArgs e) { Form2 BasketForm = new Form2(basket); BasketForm.ShowDialog(); } } }
namespace ComputersApplication { public interface IProductMediator { Computer[] GetProducts(string factory); } }
namespace MordorCrueltyPlan.Models { using System.Collections.Generic; using System.Linq; public class Gandalf { private List<Food> foodEathen; public Gandalf() { this.foodEathen = new List<Food>(); } public void Eat(Food food) { this.foodEathen.Add(food); } public int GetHappinessPoints() { return this.foodEathen.Sum(f => f.GetHappinessPoints()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using NotSoSmartSaverAPI.DTO.UserDTO; using NotSoSmartSaverAPI.Interfaces; namespace NotSoSmartSaverAPI.Controllers { [Route("api/[controller]")] [ApiController] public class UserController : ControllerBase { private readonly IUserProcessor _userProcessor; private readonly IUserVerification _userVerification; public UserController(IUserProcessor userProcessor, IUserVerification userVerification) { _userProcessor = userProcessor; _userVerification = userVerification; } [HttpPost] public async Task<IActionResult> AddUser([FromBody] NewUserDTO data) { if (await Task.Run(() => _userProcessor.CreateNewUser(data))) return Ok("User Added"); else return BadRequest("User with that email already exists!"); } [HttpGet] public async Task<IActionResult> UserLogin( string email, string password) { UserLoginDTO data = new UserLoginDTO { email = email, password = password }; if (await _userVerification.IsUserVerifiedAsync(data)) { return Ok(Task.Run(() => _userProcessor.GetUserByUserEmail(data.email))); } else return BadRequest("Failed to log in"); } [HttpPut("ModifyUser")] public async Task<IActionResult> ModifyUser ([FromBody]ModifyUserDTO data) { await Task.Run(() => _userProcessor.ModifyUser(data)); return Ok("User has been modified"); } [HttpPut("ChangeUserPassword")] public async Task<IActionResult> ChangeUserPassword([FromBody] ChangePasswordDTO data) { await Task.Run(() => _userProcessor.ChangeUserPassword(data)); return Ok("Password has been changed"); } [HttpDelete("{userID}")] public async Task<IActionResult> RemoveUser(string userID) { await Task.Run(() => _userProcessor.RemoveUser(userID)); return Ok("User removed"); } } }
using System; using System.Collections.Generic; using System.Linq; using com.Sconit.Entity.BIL; using com.Sconit.Entity.Exception; using com.Sconit.Entity.MD; using NHibernate.Criterion; using Castle.Services.Transaction; using System.IO; using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; using System.Collections; using com.Sconit.Utility; using com.Sconit.Entity.CUST; using NHibernate.Type; using com.Sconit.Entity.ISI; using com.Sconit.Entity; using com.Sconit.Entity.ACC; using com.Sconit.Utility; using System.Text; using System.Data.SqlClient; using System.Data; using NHibernate; using NHibernate.SqlCommand; using NHibernate.Transform; using System.Net.Mail; namespace com.Sconit.Service.Impl { [Transactional] public class TaskMgrImpl : BaseMgr, ITaskMgr { #region 变量 public IGenericMgr genericMgr { get; set; } public INumberControlMgr numberControlMgr { get; set; } public ISystemMgr systemMgr { get; set; } public IEmailMgr emailMgr { get; set; } #endregion #region public methods [Transaction(TransactionMode.Requires)] public void CreateTask(TaskMaster task) { #region 处理代码 string prefix = string.Empty; if (task.Type == CodeMaster.TaskType.Plan) { prefix = ISIConstants.CODE_PREFIX_PLAN; } if (task.Type == CodeMaster.TaskType.Issue) { prefix = ISIConstants.CODE_PREFIX_ISSUE; } if (task.Type == CodeMaster.TaskType.Improve) { prefix = ISIConstants.CODE_PREFIX_IMPROVE; } if (task.Type == CodeMaster.TaskType.Change) { prefix = ISIConstants.CODE_PREFIX_CHANGE; } if (task.Type == CodeMaster.TaskType.Privacy) { prefix = ISIConstants.CODE_PREFIX_PRIVACY; } if (task.Type == CodeMaster.TaskType.Response) { prefix = ISIConstants.CODE_PREFIX_RESPONSE; } if (task.Type == CodeMaster.TaskType.Project) { prefix = ISIConstants.CODE_PREFIX_PROJECT; } if (task.Type == CodeMaster.TaskType.Issue) { prefix = ISIConstants.CODE_PREFIX_PROJECT_ISSUE; } if (task.Type == CodeMaster.TaskType.Audit) { prefix = ISIConstants.CODE_PREFIX_AUDIT; } if (task.Type == CodeMaster.TaskType.Change) { prefix = ISIConstants.CODE_PREFIX_ENGINEERING_CHANGE; } if (string.IsNullOrEmpty(prefix)) { prefix = ISIConstants.CODE_PREFIX_ISI; } task.Code = numberControlMgr.GetTaskNo(prefix); #endregion task.Status = CodeMaster.TaskStatus.Create; genericMgr.Create(task); } [Transaction(TransactionMode.Requires)] public void UpdateTask(TaskMaster task) { genericMgr.Update(task); } [Transaction(TransactionMode.Requires)] public void SubmitTask(string code, User user) { TaskMaster task = genericMgr.FindById<TaskMaster>(code); SubmitTask(task, user); } [Transaction(TransactionMode.Requires)] public void SubmitTask(TaskMaster task, User user) { try { if (task.Status != CodeMaster.TaskStatus.Create) { throw new BusinessException(Resources.ISI.TaskMaster.TaskMaster_Errors_StatusErrorWhenSubmit, task.Status.ToString()); } DateTime dateTimeNow = DateTime.Now; HandleAssign(task, dateTimeNow, user); task.LastModifyDate = dateTimeNow; task.LastModifyUserId = user.Id; task.LastModifyUserName = user.Name.Trim(); this.UpdateTask(task); if (task.Status == CodeMaster.TaskStatus.Assign && task.IsAutoStart) { this.ConfirmTask(task.Code, user); } else if ((!task.IsNoSend && !ISIHelper.Contains(task.AssignUserId.ToString(), user.Id.ToString())//分派人 && !ISIHelper.Contains(task.AssignUpUser, user.Code) //&& !user.Permissions.Contains(ISIConstants.CODE_MASTER_ISI_TASK_VALUE_ISIADMIN) )) { IList<UserSub> userSubList = SubmitUserSub(task, user); #region 处理发送用户 if (userSubList != null && userSubList.Count > 0) { Remind(task, userSubList, user); } #endregion } } catch (Exception ex) { throw ex; } } [Transaction(TransactionMode.Requires)] public void ConfirmTask(string taskCode, User user) { TaskMaster task = genericMgr.FindById<TaskMaster>(taskCode); ConfirmTask(task, user); } [Transaction(TransactionMode.Requires)] public void AssignTask(string taskCode,string assignStartUser, DateTime planStartDate, DateTime planCompleteDate, string desc2, string expectedResults, User user) { TaskMaster task = genericMgr.FindById<TaskMaster>(taskCode); //检查状态 if (task.Status != CodeMaster.TaskStatus.Submit) { throw new BusinessException(Resources.ISI.TaskMaster.TaskMaster_Errors_StatusErrorWhenAssign, task.Status.ToString()); } DateTime dateTimeNow = DateTime.Now; bool isSendRemind = false; bool isUserSubSend = false; if (task.Status == CodeMaster.TaskStatus.Submit) { task.Status = CodeMaster.TaskStatus.Assign; isSendRemind = true; } task.Description2 = desc2; task.ExpectedResults = expectedResults; task.PlanStartDate = planStartDate; task.PlanCompleteDate = planCompleteDate; if (task.Status == CodeMaster.TaskStatus.Assign) { task.AssignDate = dateTimeNow; task.AssignUserId = user.Id; task.AssignUserName = user.Name.Trim(); } task.LastModifyDate = dateTimeNow; task.LastModifyUserId = user.Id; task.LastModifyUserName = user.Name.Trim(); this.UpdateTask(task); if (task.IsAutoStart) { this.ConfirmTask(taskCode, user); } if (!(task.IsAutoStart && task.IsAutoStatus)) { List<UserSub> userSubList = new List<UserSub>(); if (isUserSubSend) { //订阅提醒 IList<UserSub> userSubListT = SubmitUserSub(task, user); if (userSubListT != null && userSubListT.Count > 0) { userSubList.AddRange(userSubListT); } } if (isSendRemind) { //分派提醒 IList<UserSub> userSubListT = this.GenerateUserSub(task, task.StartedUser, false, user); if (userSubListT != null && userSubListT.Count > 0) { userSubList.AddRange(userSubListT); } } if (userSubList != null && userSubList.Count > 0) { Remind(task, userSubList, user); } } } /// <summary> /// 任务开始动作 /// </summary> /// <param name="taskCode"></param> /// <param name="user"></param> [Transaction(TransactionMode.Requires)] public void ConfirmTask(TaskMaster task, User user) { //检查状态 if (task.Status != CodeMaster.TaskStatus.Assign) { throw new BusinessException(Resources.ISI.TaskMaster.TaskMaster_Errors_StatusErrorWhenConfirm, task.Status.ToString()); } DateTime nowDate = DateTime.Now; task.Flag = ISIConstants.CODE_MASTER_ISI_FLAG_DI2; task.Status = CodeMaster.TaskStatus.InProcess; task.StartDate = nowDate; task.StartUserId = user.Id; task.StartUserName = user.Name.Trim(); task.LastModifyDate = nowDate; task.LastModifyUserId = user.Id; task.LastModifyUserName = user.Name.Trim(); this.UpdateTask(task); if (task.IsAutoComplete) { this.CompleteTask(task, user); } } [Transaction(TransactionMode.Requires)] public void ConfirmTask(string taskCode, DateTime planStartDate, DateTime planCompleteDate, string desc2, string expectedResults, User user) { TaskMaster task = genericMgr.FindById<TaskMaster>(taskCode); //检查状态 if (task.Status != CodeMaster.TaskStatus.Assign) { throw new BusinessException(Resources.ISI.TaskMaster.TaskMaster_Errors_StatusErrorWhenConfirm, task.Status.ToString()); } DateTime nowDate = DateTime.Now; task.Flag = ISIConstants.CODE_MASTER_ISI_FLAG_DI2; task.Description2 = desc2; task.ExpectedResults = expectedResults; task.PlanStartDate = planStartDate; task.PlanCompleteDate = planCompleteDate; task.Status = CodeMaster.TaskStatus.InProcess; task.StartDate = nowDate; task.StartUserId = user.Id; task.StartUserName = user.Name.Trim(); task.LastModifyDate = nowDate; task.LastModifyUserId = user.Id; task.LastModifyUserName = user.Name.Trim(); this.UpdateTask(task); if (task.IsAutoComplete) { this.CompleteTask(taskCode, user); } } [Transaction(TransactionMode.Requires)] public void CompleteTask(string taskCode, User user) { TaskMaster task = genericMgr.FindById<TaskMaster>(taskCode); this.CompleteTask(task, user); } [Transaction(TransactionMode.Requires)] public void CompleteTask(TaskMaster task, User user) { //检查状态 if (task.Status != CodeMaster.TaskStatus.InProcess) { throw new BusinessException(Resources.ISI.TaskMaster.TaskMaster_Errors_StatusErrorWhenComplete, task.Status.ToString()); } DateTime nowDate = DateTime.Now; task.Flag = ISIConstants.CODE_MASTER_ISI_FLAG_DI4; task.Status = CodeMaster.TaskStatus.Complete; task.CompleteDate = nowDate; task.CompleteUserId = user.Id; task.CompleteUserName = user.Name.Trim(); task.LastModifyDate = nowDate; task.LastModifyUserId = user.Id; task.LastModifyUserName = user.Name.Trim(); this.UpdateTask(task); if (task.IsAutoClose) { this.CloseTask(task.Code, user); } else if (!task.IsCompleteNoRemind) { //提醒关闭 IList<UserSub> userSubList = this.GenerateUserSub(task, task.CreateUserId.ToString() + ISIConstants.ISI_USER_SEPRATOR + task.SubmitUserId.ToString() + ISIConstants.ISI_USER_SEPRATOR + task.AssignUserId.ToString(), false, user); Remind(task, userSubList, user); } } [Transaction(TransactionMode.Requires)] public void CompleteTask(string taskCode, string desc2, User user) { TaskMaster task = genericMgr.FindById<TaskMaster>(taskCode); //检查状态 if (task.Status != CodeMaster.TaskStatus.InProcess) { throw new BusinessException(Resources.ISI.TaskMaster.TaskMaster_Errors_StatusErrorWhenComplete, task.Status.ToString()); } DateTime nowDate = DateTime.Now; task.Flag = ISIConstants.CODE_MASTER_ISI_FLAG_DI4; task.Description2 = desc2; task.Status = CodeMaster.TaskStatus.Complete; task.CompleteDate = nowDate; task.CompleteUserId = user.Id; task.CompleteUserName = user.Name.Trim(); task.LastModifyDate = nowDate; task.LastModifyUserId = user.Id; task.LastModifyUserName = user.Name.Trim(); this.UpdateTask(task); if (!task.IsCompleteNoRemind) { //提醒关闭 IList<UserSub> userSubList = this.GenerateUserSub(task, task.CreateUserId.ToString() + ISIConstants.ISI_USER_SEPRATOR + task.SubmitUserId.ToString() + ISIConstants.ISI_USER_SEPRATOR + task.AssignUserId.ToString(), false, user); Remind(task, userSubList, user); } if (task.IsAutoClose) { this.CloseTask(taskCode, user); } } [Transaction(TransactionMode.Requires)] public void CloseTask(string taskCode, User user) { TaskMaster task = genericMgr.FindById<TaskMaster>(taskCode); //检查状态 if (task.Status != CodeMaster.TaskStatus.Complete) { throw new BusinessException(Resources.ISI.TaskMaster.TaskMaster_Errors_StatusErrorWhenClose, task.Status.ToString()); } DateTime nowDate = DateTime.Now; task.Status = CodeMaster.TaskStatus.Close; task.Flag = ISIConstants.CODE_MASTER_ISI_FLAG_DI5; task.Color = string.Empty; task.CloseDate = nowDate; task.CloseUserId = user.Id; task.CloseUserName = user.Name.Trim(); task.LastModifyDate = nowDate; task.LastModifyUserId = user.Id; task.LastModifyUserName = user.Name.Trim(); this.UpdateTask(task); } [Transaction(TransactionMode.Requires)] public void CreateTaskDetail(TaskMaster task, string level, IList<UserSub> userSubList, bool isEmailException, bool isSMSException, User user) { DateTime now = DateTime.Now; foreach (UserSub userSub in userSubList) { TaskDetail taskDetail = new TaskDetail(); taskDetail.TaskCode = task.Code; taskDetail.Status = task.Status; taskDetail.IsEmail = userSub.IsEmail; taskDetail.IsSMS = userSub.IsSMS; taskDetail.BackYards = task.BackYards; taskDetail.TaskSubType = task.TaskSubType; taskDetail.Description1 = task.Description1; taskDetail.Description2 = task.Description2; taskDetail.UserName = task.UserName; taskDetail.ExpectedResults = task.ExpectedResults; taskDetail.Flag = task.Flag; taskDetail.Color = task.Color; // taskDetail.FailureMode = task.FailureMode != null ? task.FailureMode.Code : task.FailureModeCode; taskDetail.PlanCompleteDate = task.PlanCompleteDate; taskDetail.PlanStartDate = task.PlanStartDate; taskDetail.Subject = task.Subject; taskDetail.UserEmail = task.Email; taskDetail.UserMobilePhone = task.MobilePhone; taskDetail.CreateDate = now; taskDetail.CreateUserId = user.Id; taskDetail.CreateUserName = user.Name; taskDetail.LastModifyDate = now; taskDetail.LastModifyUserId = user.Id; taskDetail.LastModifyUserName = user.Name; taskDetail.Priority = task.Priority; if (isEmailException) { taskDetail.EmailStatus = ISIConstants.CODE_MASTER_ISI_SEND_STATUS_FAIL; } else { taskDetail.EmailStatus = taskDetail.IsEmail ? ISIConstants.CODE_MASTER_ISI_SEND_STATUS_SUCCESS : ISIConstants.CODE_MASTER_ISI_SEND_STATUS_NOTSEND; } if (taskDetail.IsEmail) { taskDetail.EmailCount += 1; } if (isSMSException) { taskDetail.SMSStatus = ISIConstants.CODE_MASTER_ISI_SEND_STATUS_FAIL; } else { taskDetail.SMSStatus = taskDetail.IsSMS ? ISIConstants.CODE_MASTER_ISI_SEND_STATUS_SUCCESS : ISIConstants.CODE_MASTER_ISI_SEND_STATUS_NOTSEND; } if (taskDetail.IsSMS) { taskDetail.SMSCount += 1; } taskDetail.Level = level; taskDetail.Email = userSub.Email; taskDetail.MobilePhone = userSub.MobilePhone; taskDetail.Receiver = userSub.Code; taskDetail.IsActive = true; genericMgr.Create(taskDetail); } } public void CreateTaskStatus(TaskStatus taskStatus,User currentUser,bool isComplete) { TaskMaster task = genericMgr.FindById<TaskMaster>(taskStatus.TaskCode); //自动开始此任务 if (task.Status == CodeMaster.TaskStatus.Assign) { this.ConfirmTask(task.Code, currentUser); } genericMgr.Create(taskStatus); if (taskStatus.IsCurrentStatus || taskStatus.IsRemindAssignUser || taskStatus.IsRemindCommentUser || taskStatus.IsRemindCreateUser || taskStatus.IsRemindStartUser || isComplete) { if (taskStatus.IsCurrentStatus || isComplete) { if (isComplete && task.Status == CodeMaster.TaskStatus.InProcess) { CompleteTask(task, currentUser); } this.UpdateTaskStatus(taskStatus, task); } this.RemindStatus(task, taskStatus); } } [Transaction(TransactionMode.Requires)] public void UpdateTaskStatus(TaskStatus taskStatus, TaskMaster task) { task.Flag = taskStatus.Flag; task.Color = taskStatus.Color; task.LastModifyDate = taskStatus.LastModifyDate; task.LastModifyUserId = taskStatus.LastModifyUserId; task.LastModifyUserName = taskStatus.LastModifyUserName; this.UpdateTask(task); } #endregion #region private methods private void Remind(TaskMaster task, string level, double minutes, IList<UserSub> userSubList, User operationUser) { if (userSubList == null || userSubList.Count == 0) return; StringBuilder toEmail = new StringBuilder(); StringBuilder toMobliePhone = new StringBuilder(); foreach (UserSub userSub in userSubList) { if (userSub.IsEmail) { if (toEmail.Length != 0) { toEmail.Append(";"); } toEmail.Append(userSub.Email); } if (userSub.IsSMS) { if (toMobliePhone.Length != 0) { toMobliePhone.Append(";"); } toMobliePhone.Append(userSub.MobilePhone); } } string emailBody = string.Empty; string smsBody = string.Empty; #region 获取内容 if (toEmail.Length > 0) { emailBody = this.GetEmailBody(task, level, minutes, operationUser); } if (toMobliePhone.Length > 0) { smsBody = this.GetSMSBody(task, level, minutes, operationUser); } #endregion string userMail = string.Empty; MailPriority mailPriority; #region email标题 回复人 优先级 string subject = this.GetSubject(operationUser.Code, operationUser.Name, task.Code, task.Type, task.Priority, task.Subject, level, task.Status); if (operationUser != null && !string.IsNullOrEmpty(operationUser.Email) && ISIHelper.IsValidEmail(operationUser.Email)) { userMail = operationUser.Name + "," + operationUser.Email; } else if (level == ISIConstants.ISI_LEVEL_BASE && !string.IsNullOrEmpty(task.Email) && ISIHelper.IsValidEmail(task.Email)) { if (!string.IsNullOrEmpty(task.UserName)) { userMail = task.UserName + "," + task.Email; } else { userMail = task.Email; } } if (task.Priority == CodeMaster.TaskPriority.Urgent) { mailPriority = MailPriority.High; } else { mailPriority = MailPriority.Normal; } #endregion bool isEmailException = false; bool isSMSException = false; #region 邮件与短信发送 if (!string.IsNullOrEmpty(emailBody) && !string.IsNullOrEmpty(toEmail.ToString())) { //todo emailMgr.SendEmail(subject, emailBody, toEmail.ToString(), string.Empty, mailPriority); // isEmailException = this.SendEmail(task.Code, subject, emailBody, toEmail.ToString(), userMail, mailPriority, operationUser); //isEmailException = this.SendEmail(task.Code, subject, emailBody, "tiansu@yfgm.com.cn", userMail, mailPriority, operationUser); } if (!string.IsNullOrEmpty(smsBody) && !string.IsNullOrEmpty(toMobliePhone.ToString())) { isSMSException = this.SendSMS(task.Code, toMobliePhone.ToString(), smsBody, operationUser); } #endregion #region 记录上报TaskDetail CreateTaskDetail(task, level, userSubList, isEmailException, isSMSException, operationUser); #endregion } private IList<UserSub> SubmitUserSub(TaskMaster task, User user) { IList<UserSub> userSubList = null; if (task.Status == CodeMaster.TaskStatus.Submit && !string.IsNullOrEmpty(ISIHelper.EditUser(task.AssignUserId.ToString()))) { userSubList = GenerateUserSub(task, task.AssignUserId.ToString(), false, user); } else if (task.Status == CodeMaster.TaskStatus.Assign) { if (!string.IsNullOrEmpty(ISIHelper.EditUser(task.StartedUser))) { userSubList = GenerateUserSub(task, task.StartedUser, false, user); } else if (!string.IsNullOrEmpty(ISIHelper.EditUser(task.StartUserId.ToString()))) { userSubList = GenerateUserSub(task, task.StartUserId.ToString(), false, user); } } return userSubList; } [Transaction(TransactionMode.Unspecified)] private IList<UserSub> GenerateUserSub(TaskMaster task, User user) { return this.GenerateUserSub(task, string.Empty, true, user); } //查询所有管理员,不考虑订阅 [Transaction(TransactionMode.Unspecified)] private IList<UserSub> GenerateUserSub(string taskSubType, User user) { DetachedCriteria criteria = DetachedCriteria.For(typeof(User)); ProjectionList projectionList = Projections.ProjectionList() .Add(Projections.Property("Code"), "Code") .Add(Projections.Property("IsActive"), "IsEmail") .Add(Projections.Property("IsActive"), "IsSMS") .Add(Projections.Property("Email"), "Email") .Add(Projections.Property("MobliePhone"), "MobilePhone"); DetachedCriteria[] taCrieteria = GetTaskAdminPermissionCriteria(); criteria.Add( Expression.Or( Subqueries.PropertyIn("Code", taCrieteria[0]), Subqueries.PropertyIn("Code", taCrieteria[1]))); criteria.SetProjection(Projections.Distinct(projectionList)); criteria.Add(Expression.Eq("IsActive", true)); criteria.SetResultTransformer(Transformers.AliasToBean(typeof(UserSub))); IList<UserSub> userSubList = genericMgr.FindAll<UserSub>(criteria); //GenerateUserSub(taskSubType, ref userSubList); return userSubList; } [Transaction(TransactionMode.Unspecified)] private IList<UserSub> GenerateUserSub(TaskMaster task, string userCodes, bool isUserSub, User user) { return GenerateUserSub(task.Type, task.TaskSubType, task.Code, userCodes, isUserSub, user); } [Transaction(TransactionMode.Unspecified)] private IList<UserSub> GenerateUserSub(CodeMaster.TaskType taskType, string taskSubTypeCode, string taskCode, string userIds, bool isUserSub, User user) { string[] userCodeArray = null; if (!string.IsNullOrEmpty(userIds)) { userCodeArray = userIds.Split(ISIConstants.ISI_SEPRATOR, StringSplitOptions.RemoveEmptyEntries).Distinct().ToArray(); userCodeArray = userCodeArray.Where(u => !string.IsNullOrEmpty(u)).ToArray<string>(); } if (string.IsNullOrEmpty(userIds) || userCodeArray == null || userCodeArray.Length == 0) { return new List<UserSub>(); } IList<UserSub> userSubList = new List<UserSub>(); if (!isUserSub) { string users = string.Join(",", userCodeArray); IList<SqlParameter> sqlParam = new List<SqlParameter>(); sqlParam.Add(new SqlParameter("@TaskType", taskType)); sqlParam.Add(new SqlParameter("@TaskSubType", taskSubTypeCode)); sqlParam.Add(new SqlParameter("@TaskCode", taskCode)); sqlParam.Add(new SqlParameter("@UserCodes", users)); sqlParam.Add(new SqlParameter("@CurrentUser", user.Code)); var objList = this.genericMgr.FindAllWithNativeSql<object[]>("exec USP_Search_TaskEmail ?,?,?,?,?", new object[] { (int)taskType, taskSubTypeCode, taskCode, users, user.Id.ToString() }, new IType[] { NHibernateUtil.String, NHibernateUtil.String, NHibernateUtil.String, NHibernateUtil.String, NHibernateUtil.String }); foreach (var obj in objList) { UserSub userSub = new UserSub(); userSub.Code = obj[0].ToString(); userSub.IsEmail = true; userSub.Email = obj[1].ToString(); userSubList.Add(userSub); } } else { //考虑是否订阅,有权限才能订阅,因此不考虑权限, DetachedCriteria criteria = DetachedCriteria.For(typeof(UserSubscription)); criteria.CreateAlias("User", "u", JoinType.InnerJoin); ProjectionList projectionList = Projections.ProjectionList() .Add(Projections.Property("u.Code"), "Code") .Add(Projections.Property("IsEmail"), "IsEmail") .Add(Projections.SqlProjection(@"isnull(Email,USR_Email) as Email", new String[] { "Email" }, new IType[] { NHibernateUtil.String })) .Add(Projections.Property("IsSMS"), "IsSMS") .Add(Projections.SqlProjection(@"isnull(MobilePhone, USR_MPhone) as MobilePhone", new String[] { "MobilePhone" }, new IType[] { NHibernateUtil.String })); // criteria.SetProjection(Projections.Distinct(projectionList)); criteria.Add(Expression.Eq("u.IsActive", true)); criteria.Add(Expression.Eq("TaskSubType", taskSubTypeCode)); if (userCodeArray != null && userCodeArray.Length > 0) { criteria.Add(Expression.In("u.Code", userCodeArray)); } if (user != null) { criteria.Add(Expression.Not(Expression.Eq("u.Code", user.Code))); } criteria.Add(Expression.Or( Expression.And(Expression.Eq("IsEmail", true), Expression.Or(Expression.IsNotNull("Email"), Expression.IsNotNull("u.Email"))), Expression.And(Expression.Eq("IsSMS", true), Expression.Or(Expression.IsNotNull("MobilePhone"), Expression.IsNotNull("u.MobliePhone"))) )); criteria.SetResultTransformer(Transformers.AliasToBean(typeof(UserSub))); userSubList = genericMgr.FindAll<UserSub>(criteria); } return userSubList; } private void Remind(TaskMaster task, IList<UserSub> userSubList, User operationUser) { this.Remind(task, ISIConstants.ISI_LEVEL_BASE, 0, userSubList, operationUser); } private void Remind(TaskMaster task, IList<UserSub> userSubList, string helpContent, User operationUser) { task.HelpContent = helpContent; this.Remind(task, ISIConstants.ISI_LEVEL_HELP, 0, userSubList, operationUser); } protected void RemindStatus(TaskMaster task, TaskStatus taskStatus) { #region 获取用户列表 StringBuilder users = new StringBuilder(); if (taskStatus.IsRemindCreateUser) { users.Append(task.CreateUserId.ToString()); if (!string.IsNullOrEmpty(task.SubmitUserId.ToString())) { users.Append(ISIConstants.ISI_USER_SEPRATOR); users.Append(task.SubmitUserId.ToString()); } } if (taskStatus.IsRemindAssignUser) { if (!string.IsNullOrEmpty(task.AssignUserId.ToString())) { if (users.Length != 0) { users.Append(ISIConstants.ISI_USER_SEPRATOR); } users.Append(task.AssignUserId.ToString()); } else if (task.AssignUserId != null) { if (users.Length != 0) { users.Append(ISIConstants.ISI_USER_SEPRATOR); } users.Append(task.AssignUserId.ToString()); } } if (taskStatus.IsRemindStartUser && task.StartedUser != null) { if (users.Length != 0) { users.Append(ISIConstants.ISI_USER_SEPRATOR); } users.Append(task.StartedUser); } if (taskStatus.IsRemindCommentUser) { //所有评论人 // var commentList = commentDetailMgrE.GetComment(task.Code); var commentList = new List<CommentDetail>(); if (commentList != null && commentList.Count > 0) { string commentUsers = string.Join(";", commentList.Select(t => t.CreateUser).Distinct().ToArray<string>()); if (users.Length != 0) { users.Append(ISIConstants.ISI_USER_SEPRATOR); } users.Append(commentUsers); task.CommentDetail = commentList[0]; } } #endregion User operationUser = new User(); operationUser.Id = taskStatus.LastModifyUserId; operationUser.FirstName = taskStatus.LastModifyUserName; IList<UserSub> userSubList = this.GenerateUserSub(task, users.ToString(), false, operationUser); task.TaskStatus = taskStatus; this.Remind(task, ISIConstants.ISI_LEVEL_STATUS, 0, userSubList, operationUser); } [Transaction(TransactionMode.Requires)] private bool SendSMS(string code, string toMobliePhone, string msg, User user) { bool isSMSException = false; //try //{ // emppMgrE.AsyncSend(toMobliePhone, msg, user); //} //catch (Exception e) //{ // isSMSException = true; // log.Error("Code=" + code + ",toMobliePhone=" + toMobliePhone + ",operator=" + user.Code + ",e=" + e.Message, e); //} return isSMSException; } private string GetDesc(CodeMaster.TaskType type, string userCode) { return string.Empty; //if (type == ISIConstants.ISI_TASK_TYPE_PLAN) //{ // return languageMgrE.TranslateMessage("ISI.TSK.Plan", userCode); //} //if (type == ISIConstants.ISI_TASK_TYPE_ISSUE) //{ // return languageMgrE.TranslateMessage("ISI.TSK.Issue", userCode); //} //if (type == ISIConstants.ISI_TASK_TYPE_IMPROVE) //{ // return languageMgrE.TranslateMessage("ISI.TSK.Improve", userCode); //} //if (type == ISIConstants.ISI_TASK_TYPE_CHANGE) //{ // return languageMgrE.TranslateMessage("ISI.TSK.Change", userCode); //} //if (type == ISIConstants.ISI_TASK_TYPE_PRIVACY) //{ // return languageMgrE.TranslateMessage("ISI.TSK.Privacy", userCode); //} //if (type == ISIConstants.ISI_TASK_TYPE_RESPONSE) //{ // return languageMgrE.TranslateMessage("ISI.TSK.Response", userCode); //} //if (type == ISIConstants.ISI_TASK_TYPE_PROJECT) //{ // return languageMgrE.TranslateMessage("ISI.TSK.Project", userCode); //} //if (type == ISIConstants.ISI_TASK_TYPE_AUDIT) //{ // return languageMgrE.TranslateMessage("ISI.TSK.Audit", userCode); //} //if (type == ISIConstants.ISI_TASK_TYPE_PROJECT_ISSUE) //{ // return languageMgrE.TranslateMessage("ISI.TSK.PrjIss", userCode); //} //if (type == ISIConstants.ISI_TASK_TYPE_ENGINEERING_CHANGE) //{ // return languageMgrE.TranslateMessage("ISI.TSK.Enc", userCode); //} //return languageMgrE.TranslateMessage("ISI.TSK.Task", userCode); } [Transaction(TransactionMode.Unspecified)] protected string GetEmailBody(TaskMaster task, string level, double minutes, User operationUser) { StringBuilder content = new StringBuilder(); try { content.Append("<p style='font-size:15px;'>"); string separator = ISIConstants.EMAIL_SEPRATOR; DateTime now = DateTime.Now; var companyName = systemMgr.GetEntityPreferenceValue(Entity.SYS.EntityPreference.CodeEnum.CompanyName); ISIHelper.AppendTestText(companyName, content, separator); if (level == ISIConstants.ISI_LEVEL_HELP) { content.Append(separator); content.Append("<U>求助</U>:" + task.HelpContent); content.Append(separator); content.Append(separator); content.Append(operationUser.Name); content.Append(separator); content.Append(now.ToString("yyyy-MM-dd HH:mm")); content.Append(separator); content.Append(separator); } if (level == ISIConstants.ISI_LEVEL_STATUS) { PutStatusText(task, content, separator); PutCommentText(task, content, separator); } if (level == ISIConstants.ISI_LEVEL_COMMENT) { PutCommentText(task, content, separator); PutStatusText(task, content, separator); } if (level == ISIConstants.ISI_LEVEL_STARTPERCENT) { content.Append(separator); content.Append("按照预计完成时间 " + (task.PlanCompleteDate.HasValue ? task.PlanCompleteDate.Value.ToString("yyyy-MM-dd HH:mm") : string.Empty) + " 已经过去 " + (task.StartPercent.Value * 100).ToString("0.####") + "% 请注意进度。"); content.Append(separator); content.Append(separator); content.Append(separator); } if (level == ISIConstants.ISI_LEVEL_OPEN) { content.Append(separator); content.Append("已经到了预计开始时间 " + (task.PlanStartDate.HasValue ? task.PlanStartDate.Value.ToString("yyyy-MM-dd HH:mm") : string.Empty) + ",提醒开始执行!"); content.Append(separator); content.Append(separator); content.Append(separator); } if (level == ISIConstants.ISI_LEVEL_COMPLETE) { content.Append(separator); content.Append("已经超过预计完成时间 " + (task.PlanCompleteDate.HasValue ? task.PlanCompleteDate.Value.ToString("yyyy-MM-dd HH:mm") : string.Empty) + "。请注意!"); content.Append(separator); content.Append(separator); content.Append(separator); } if (!string.IsNullOrEmpty(task.Description1)) { content.Append("<U>描述</U>: " + task.Description1.Replace(ISIConstants.TEXT_SEPRATOR, separator).Replace(ISIConstants.TEXT_SEPRATOR2, "<br/>")); } content.Append(separator); if (!string.IsNullOrEmpty(task.Description2)) { content.Append("<I>补充描述</I>: " + task.Description2.Replace(ISIConstants.TEXT_SEPRATOR, separator).Replace(ISIConstants.TEXT_SEPRATOR2, "<br/>")); } content.Append(separator + separator); if (!string.IsNullOrEmpty(task.ExpectedResults)) { content.Append("<U>预期结果/达成结果</U>: "); content.Append(task.ExpectedResults.Replace(ISIConstants.TEXT_SEPRATOR, separator).Replace(ISIConstants.TEXT_SEPRATOR2, "<br/>")); content.Append(separator + separator); } content.Append("<U>" + this.GetDesc(task.Type, operationUser.Name) + "</U>: "); content.Append(task.Code); if (task.Priority == CodeMaster.TaskPriority.Urgent) { // content.Append("[" + codeMasterMgrE.GetCachedCodeMaster(ISIConstants.CODE_MASTER_ISI_PRIORITY, task.Priority).Description + "]"); } content.Append(separator); // content.Append("<U>状态</U>: " + systemMgr.r( this.codeMasterMgrE.LoadCodeMaster(ISIConstants.CODE_MASTER_ISI_STATUS, task.Status).Description); if (!string.IsNullOrEmpty(task.Subject)) { content.Append(separator); content.Append("<U>标题</U>: " + task.Subject); } DateTime date = DateTime.Now; if (level == ISIConstants.ISI_LEVEL_BASE)//提醒 { content.Append(separator); if (task.Status == CodeMaster.TaskStatus.Submit) { content.Append("<U>发送类型</U>: 分派提醒"); } else if (task.Status == CodeMaster.TaskStatus.Assign) { content.Append("<U>发送类型</U>: 执行提醒"); } else { content.Append("<U>发送类型</U>: 提醒"); } } else if (level == ISIConstants.ISI_LEVEL_COMMENT) { content.Append(separator); content.Append("<U>发送类型</U>: 评论"); } else if (level == ISIConstants.ISI_LEVEL_STATUS) { content.Append(separator); content.Append("<U>发送类型</U>: 进展"); } else if (level == ISIConstants.ISI_LEVEL_HELP) { content.Append(separator); content.Append("<U>发送类型</U>: 求助"); } else if (level == ISIConstants.ISI_LEVEL_STARTPERCENT) { content.Append(separator); content.Append("<U>发送类型</U>: 执行进度提醒"); } else if (level == ISIConstants.ISI_LEVEL_OPEN) { content.Append(separator); content.Append("<U>发送类型</U>: 开始执行提醒"); } else if (level == ISIConstants.ISI_LEVEL_COMPLETE) { content.Append(separator); content.Append("<U>发送类型</U>: 逾期完成提醒"); } else//上报 { content.Append(separator); content.Append("<U>发送类型</U>: 上报" + level + "级"); //分派提醒 if (task.Status == CodeMaster.TaskStatus.Submit && task.SubmitDate.HasValue) { string diff = ISIHelper.GetDiff(task.SubmitDate.Value.AddMinutes(minutes)); if (!string.IsNullOrEmpty(diff)) { content.Append(separator); content.Append("<U>分派超时</U>: " + diff); } date = task.SubmitDate.Value; } //开始提醒 if ((task.Status == CodeMaster.TaskStatus.Assign && task.AssignDate.HasValue)) { string diff = ISIHelper.GetDiff(task.AssignDate.Value.AddMinutes(minutes)); if (!string.IsNullOrEmpty(diff)) { content.Append(separator); content.Append("<U>确认超时</U>: " + diff); } date = task.AssignDate.Value; } //关闭提醒 else if (task.Status == CodeMaster.TaskStatus.Complete && task.CompleteDate.HasValue) { string diff = ISIHelper.GetDiff(task.CompleteDate.Value.AddMinutes(minutes)); if (!string.IsNullOrEmpty(diff)) { content.Append(separator); content.Append("<U>关闭超时</U>: " + diff); } date = task.CompleteDate.Value; } } if (!string.IsNullOrEmpty(task.BackYards)) { content.Append(separator); content.Append("<U>追溯码</U>: " + task.BackYards); } content.Append(separator); content.Append("<U>时间</U>: " + date.ToString("yyyy-MM-dd HH:mm") + separator); if (task.Type == CodeMaster.TaskType.Project) { content.Append("<U>项目</U>: " + task.TaskSubTypeDesc + separator); content.Append("<U>阶段</U>: " + task.Phase + separator); //content.Append("序号: " + task.Seq + separator); } else { //content.Append("<U>类型</U>: " + (task.TaskSubType != null ? task.TaskSubType.Description : task.TaskSubTypeDesc) + separator); //if (task.FailureMode != null || !string.IsNullOrEmpty(task.FailureModeCode)) //{ // content.Append("<U>失效模式</U>: " + (task.FailureMode != null ? task.FailureMode.Code : task.FailureModeCode) + separator); //} } content.Append("<U>地点</U>: " + task.TaskAddress + separator); if (!string.IsNullOrEmpty(task.AssignStartUserName)) { content.Append("<U>执行人</U>: " + task.AssignStartUserName + separator); } else { //string principals = this.GetUserName(task.AssignStartUserName); //content.Append("<U>执行人</U>: " + principals + separator); } if (task.PlanStartDate.HasValue) { content.Append("<U>预计开始时间</U>: " + task.PlanStartDate.Value.ToString("yyyy-MM-dd HH:mm") + separator); } if (task.PlanCompleteDate.HasValue) { content.Append("<U>预计完成时间</U>: " + task.PlanCompleteDate.Value.ToString("yyyy-MM-dd HH:mm") + separator); } content.Append(separator + separator); if (task.UserName != null && task.UserName.Trim() != string.Empty) content.Append(task.UserName + separator); if (task.MobilePhone != null && task.MobilePhone.Trim() != string.Empty && ISIHelper.IsValidMobilePhone(task.MobilePhone)) content.Append("Tel: " + task.MobilePhone + separator); if (task.Email != null && task.Email.Trim() != string.Empty && ISIHelper.IsValidEmail(task.Email)) content.Append("Email: " + task.Email + separator); var webAddress = systemMgr.GetEntityPreferenceValue(Entity.SYS.EntityPreference.CodeEnum.WebAddress); content.Append(separator); content.Append(companyName + separator); content.Append("<a href='http://" + webAddress + "'>http://" + webAddress + "</a>"); content.Append(separator); content.Append("</p>"); } catch (Exception e) { // log.Error(e.Message, e); } return content.ToString(); } private void PutCommentText(TaskMaster task, StringBuilder content, string separator) { if (task.CommentDetail != null) { content.Append(separator); content.Append("<U>评论</U>:"); if (!string.IsNullOrEmpty(task.CommentDetail.Comment)) { content.Append(task.CommentDetail.Comment.Replace(ISIConstants.TEXT_SEPRATOR, separator).Replace(ISIConstants.TEXT_SEPRATOR2, "<br/>")); } content.Append(separator); content.Append(separator); content.Append(task.CommentDetail.CreateUserNm); content.Append(separator); content.Append(task.CommentDetail.CreateDate.ToString("yyyy-MM-dd HH:mm")); content.Append(separator); content.Append(separator); content.Append(separator); } } private void PutStatusText(TaskMaster task, StringBuilder content, string separator) { if (task.TaskStatus != null) { content.Append(separator); content.Append("<U>进展</U>:"); if (!string.IsNullOrEmpty(task.TaskStatus.Description)) { content.Append(task.TaskStatus.Description.Replace(ISIConstants.TEXT_SEPRATOR, separator).Replace(ISIConstants.TEXT_SEPRATOR2, "<br/>")); content.Append(separator); content.Append("标志: <span style='background-color:" + task.TaskStatus.Color + "'>" + task.TaskStatus.Flag + "</span>"); content.Append(separator); content.Append("开始时间: " + task.TaskStatus.StartDate.ToString("yyyy-MM-dd")); content.Append(separator); content.Append("结束时间: " + task.TaskStatus.EndDate.ToString("yyyy-MM-dd")); } content.Append(separator); content.Append(separator); content.Append(task.TaskStatus.LastModifyUserName); content.Append(separator); content.Append(task.TaskStatus.LastModifyDate.ToString("yyyy-MM-dd HH:mm")); content.Append(separator); content.Append(separator); content.Append(separator); } } [Transaction(TransactionMode.Unspecified)] protected string GetSMSBody(TaskMaster task, string level, double minutes, User operationUser) { StringBuilder content = new StringBuilder(); string separator = ISIConstants.SMS_SEPRATOR; try { content.Append("ISI "); var companyName = systemMgr.GetEntityPreferenceValue(Entity.SYS.EntityPreference.CodeEnum.CompanyName); ISIHelper.AppendTestText(companyName, content, separator); if (!string.IsNullOrEmpty(task.HelpContent)) { content.Append("请协助求助处理"); content.Append(separator); } #region 拼邮件,后续再加 //content.Append(this.GetDesc(task.Type, operationUser.Code)); //content.Append(task.Code); //if (task.Priority == ISIConstants.CODE_MASTER_ISI_PRIORITY_URGENT) //{ // content.Append("[" + codeMasterMgrE.GetCachedCodeMaster(ISIConstants.CODE_MASTER_ISI_PRIORITY, task.Priority).Description + "]"); //} //if (!string.IsNullOrEmpty(task.Subject)) //{ // content.Append(separator); // content.Append("标题:" + task.Subject); //} //content.Append(separator); //content.Append("类型: " + (task.TaskSubType != null ? task.TaskSubType.Description : task.TaskSubTypeDesc) + "|" + this.codeMasterMgrE.LoadCodeMaster(ISIConstants.CODE_MASTER_ISI_STATUS, task.Status).Description); //DateTime date = DateTime.Now; //if (level == ISIConstants.ISI_LEVEL_BASE)//提醒 //{ // content.Append("|提醒"); //} //else if (level == ISIConstants.ISI_LEVEL_HELP) //{ // content.Append("|求助"); //} //else if (level == ISIConstants.ISI_LEVEL_COMMENT) //{ // content.Append("|评论"); //} //else if (level == ISIConstants.ISI_LEVEL_STARTPERCENT) //{ // content.Append("|执行进度"); //} //else if (level == ISIConstants.ISI_LEVEL_OPEN) //{ // content.Append("|开始"); //} //else if (level == ISIConstants.ISI_LEVEL_COMPLETE) //{ // content.Append("|逾期完成"); //} //else//上报 //{ // content.Append("|上报"); // //content.Append(level + "级"); // //分派提醒 // if (task.Status == ISIConstants.CODE_MASTER_ISI_STATUS_VALUE_SUBMIT && task.SubmitDate.HasValue) // { // string diff = ISIHelper.GetDiff(task.SubmitDate.Value.AddMinutes(minutes)); // if (!string.IsNullOrEmpty(diff)) // { // content.Append(separator); // content.Append("分派超时:" + diff); // } // date = task.SubmitDate.Value; // } // //开始提醒 // if ((task.Status == ISIConstants.CODE_MASTER_ISI_STATUS_VALUE_ASSIGN && task.AssignDate.HasValue)) // { // string diff = ISIHelper.GetDiff(task.AssignDate.Value.AddMinutes(minutes)); // if (!string.IsNullOrEmpty(diff)) // { // content.Append(separator); // content.Append("确认超时:" + diff); // } // date = task.AssignDate.Value; // } // //关闭提醒 // else if ((task.Status == ISIConstants.CODE_MASTER_ISI_STATUS_VALUE_INPROCESS // || task.Status == ISIConstants.CODE_MASTER_ISI_STATUS_VALUE_COMPLETE) && task.StartDate.HasValue) // { // string diff = ISIHelper.GetDiff(task.StartDate.Value.AddMinutes(minutes)); // if (!string.IsNullOrEmpty(diff)) // { // content.Append(separator); // content.Append("关闭超时:" + diff); // } // if (task.Status == ISIConstants.CODE_MASTER_ISI_STATUS_VALUE_INPROCESS) // { // date = task.StartDate.Value; // } // else if (task.Status == ISIConstants.CODE_MASTER_ISI_STATUS_VALUE_COMPLETE) // { // date = task.CompleteDate.Value; // } // } //} //if (!string.IsNullOrEmpty(task.BackYards)) //{ // content.Append(separator); // content.Append("追溯码:" + task.BackYards); //} //content.Append(separator); //content.Append("时间:" + date.ToString("yyyy-MM-dd HH:mm") + separator); ////content.Append("类型:" + task.TaskSubType.Description + separator); //if (task.FailureMode != null || !string.IsNullOrEmpty(task.FailureModeCode)) //{ // content.Append("失效模式:" + (task.FailureMode != null ? task.FailureMode.Code : task.FailureModeCode) + separator); //} //content.Append("地点:" + task.TaskAddress + separator); //if (task.PlanStartDate.HasValue) //{ // content.Append("预计开始时间:" + task.PlanStartDate.Value.ToString("yyyy-MM-dd HH:mm") + separator); //} //if (task.PlanCompleteDate.HasValue) //{ // content.Append("预计完成时间:" + task.PlanCompleteDate.Value.ToString("yyyy-MM-dd HH:mm") + separator); //} //if (task.Status == ISIConstants.CODE_MASTER_ISI_STATUS_VALUE_COMPLETE) //{ // content.Append("已经完成!"); // return content.ToString(); //} //if (level == ISIConstants.ISI_LEVEL_COMMENT) //{ // if (task.CommentDetail != null && !string.IsNullOrEmpty(task.CommentDetail.Comment)) // { // content.Append(ISIHelper.GetStrLength(task.CommentDetail.Comment, 20)); // content.Append(separator); // content.Append(task.CommentDetail.CreateUserNm); // content.Append(separator); // content.Append(task.CommentDetail.CreateDate.ToString("yyyy-MM-dd HH:mm")); // } //} //else //{ // if (!string.IsNullOrEmpty(task.Description1)) // { // content.Append(ISIHelper.GetStrLength(task.Description1, 20)); // content.Append(separator); // } // if (!string.IsNullOrEmpty(task.UserName) // || (!string.IsNullOrEmpty(task.MobilePhone) && ISIHelper.IsValidMobilePhone(task.MobilePhone))) // { // content.Append("["); // if (!string.IsNullOrEmpty(task.UserName)) // { // content.Append(task.UserName); // } // if (!string.IsNullOrEmpty(task.MobilePhone) && ISIHelper.IsValidMobilePhone(task.MobilePhone)) // { // if (!string.IsNullOrEmpty(task.UserName)) // { // content.Append(", "); // } // content.Append(task.MobilePhone); // } // content.Append("]"); // } // if (task.Status == ISIConstants.CODE_MASTER_ISI_STATUS_VALUE_COMPLETE) // { // content.Append(separator); // content.Append("关闭回复 " + ISIHelper.GetSerialNo(task.Code) + "+空格+Y"); // } //} #endregion } catch (Exception e) { // log.Error(e.Message, e); } return content.ToString(); } private string GetSubject(string userCode, string userName, string code, CodeMaster.TaskType type, CodeMaster.TaskPriority priority, string value, string level, CodeMaster.TaskStatus status) { StringBuilder subject = new StringBuilder(); subject.Append(userName + " "); #region 拼内容,后面再改 //if (priority == CodeMaster.TaskPriority.Urgent) //{ // subject.Append(codeMasterMgrE.GetCachedCodeMaster(ISIConstants.CODE_MASTER_ISI_PRIORITY, priority).Description + " "); //} //if (!string.IsNullOrEmpty(level)) //{ // if (level == ISIConstants.ISI_LEVEL_HELP) // { // subject.Append(languageMgrE.TranslateMessage("ISI.Remind.Help", userCode)); // } // else if (level == ISIConstants.ISI_LEVEL_BASE) // { // if (status == ISIConstants.CODE_MASTER_ISI_STATUS_VALUE_ASSIGN) // { // subject.Append(languageMgrE.TranslateMessage("ISI.Remind.Assign", userCode)); // } // else // { // subject.Append(languageMgrE.TranslateMessage("ISI.Remind.Subscription", userCode)); // } // } // else if (level == ISIConstants.ISI_LEVEL_COMMENT) // { // subject.Append(languageMgrE.TranslateMessage("ISI.Remind.Comment", userCode)); // } // else if (level == ISIConstants.ISI_LEVEL_STATUS) // { // subject.Append(languageMgrE.TranslateMessage("ISI.Remind.TaskStatus", userCode)); // } // else if (level == ISIConstants.ISI_LEVEL_STARTPERCENT) // { // subject.Append(languageMgrE.TranslateMessage("ISI.Remind.Schedule", userCode)); // } // else if (level == ISIConstants.ISI_LEVEL_OPEN) // { // subject.Append(languageMgrE.TranslateMessage("ISI.Remind.Open", userCode)); // } // else if (level == ISIConstants.ISI_LEVEL_COMPLETE) // { // subject.Append(languageMgrE.TranslateMessage("ISI.Remind.OverDue", userCode)); // } // else // { // subject.Append(languageMgrE.TranslateMessage("ISI.Remind.Up", userCode, new string[] { level })); // } // } #endregion subject.Append(" " + this.GetDesc(type, userCode) + ": "); if (string.IsNullOrEmpty(value)) { subject.Append(code); } else { subject.Append(value); } return subject.ToString(); } private static DetachedCriteria[] GetTaskAdminPermissionCriteria() { DetachedCriteria[] criteria = new DetachedCriteria[2]; DetachedCriteria upSubCriteria = DetachedCriteria.For<UserPermission>(); upSubCriteria.CreateAlias("User", "u"); upSubCriteria.CreateAlias("Permission", "pm"); upSubCriteria.CreateAlias("pm.Category", "pmc"); ; upSubCriteria.Add(Expression.Eq("pmc.Code", ISIConstants.CODE_MASTER_ISI_TYPE_VALUE_TASKADMIN)); upSubCriteria.Add(Expression.In("pm.Code", new string[] { ISIConstants.CODE_MASTER_ISI_TASK_VALUE_ISIADMIN, ISIConstants.CODE_MASTER_ISI_TASK_VALUE_TASKFLOWADMIN })); upSubCriteria.SetProjection(Projections.Distinct(Projections.ProjectionList().Add(Projections.GroupProperty("u.Code")))); DetachedCriteria rpSubCriteria = DetachedCriteria.For<RolePermission>(); rpSubCriteria.CreateAlias("Role", "r"); rpSubCriteria.CreateAlias("Permission", "pm"); rpSubCriteria.CreateAlias("pm.Category", "pmc"); ; rpSubCriteria.Add(Expression.Eq("pmc.Code", ISIConstants.CODE_MASTER_ISI_TYPE_VALUE_TASKADMIN)); rpSubCriteria.Add(Expression.In("pm.Code", new string[] { ISIConstants.CODE_MASTER_ISI_TASK_VALUE_ISIADMIN, ISIConstants.CODE_MASTER_ISI_TASK_VALUE_TASKFLOWADMIN })); rpSubCriteria.SetProjection(Projections.Distinct(Projections.ProjectionList().Add(Projections.GroupProperty("r.Code")))); DetachedCriteria urSubCriteria = DetachedCriteria.For<UserRole>(); urSubCriteria.CreateAlias("User", "u"); urSubCriteria.CreateAlias("Role", "r"); urSubCriteria.SetProjection(Projections.Distinct(Projections.ProjectionList().Add(Projections.GroupProperty("u.Code")))); urSubCriteria.Add(Subqueries.PropertyIn("r.Code", rpSubCriteria)); criteria[0] = upSubCriteria; criteria[1] = urSubCriteria; return criteria; } private void HandleAssign(TaskMaster task, DateTime now, User user) { task.SubmitDate = now; task.SubmitUserId = user.Id; task.SubmitUserName = user.Name.Trim(); task.Status = CodeMaster.TaskStatus.Submit; if (string.IsNullOrEmpty(task.AssignStartUser)) { #region 排班 //IList<SchedulingView> schedulingViewList = schedulingMgrE.GetScheduling2(now.Date, now.Date, task.TaskSubType.Code, string.Empty); //if (schedulingViewList != null && schedulingViewList.Count > 0) //{ // SchedulingView schedulingView = schedulingViewList.Where(s => s.StartTime <= now && now <= s.EndTime).FirstOrDefault(); // if (schedulingView != null) // { // if (schedulingView.Id.HasValue) // { // //排班表有执行人 // task.Scheduling = schedulingView.Id; // task.SchedulingStartUser = schedulingView.StartUser; // task.SchedulingShift = schedulingView.ShiftCode; // task.SchedulingShiftTime = schedulingView.StartTime.ToString("yyyy-MM-dd HH:mm") + " " + schedulingView.EndTime.ToString("yyyy-MM-dd HH:mm"); // } // else // { // task.Scheduling = null; // task.AssignStartUser = schedulingView.StartUser; // if (string.IsNullOrEmpty(task.AssignStartUser) && schedulingView.IsAutoAssign) // { // task.AssignStartUser = ISIConstants.ISI_LEVEL_SEPRATOR + user.Code + ISIConstants.ISI_LEVEL_SEPRATOR; // } // task.SchedulingShift = schedulingView.ShiftCode; // task.SchedulingShiftTime = schedulingView.StartTime.ToString("yyyy-MM-dd HH:mm") + " " + schedulingView.EndTime.ToString("yyyy-MM-dd HH:mm"); // } // } // else // { // ClearScheduling(task); // } //} //else //{ // ClearScheduling(task); //} #endregion if (!string.IsNullOrEmpty(task.SchedulingStartUser) || !string.IsNullOrEmpty(task.AssignStartUser)) { //userCodes = !string.IsNullOrEmpty(task.SchedulingStartUser) ? task.SchedulingStartUser : task.AssignStartUser; //this.wfDetailMgrE.CreateWFDetail(task.Code, task.Status, ISIConstants.CODE_MASTER_ISI_STATUS_VALUE_ASSIGN, now, user); task.Status = CodeMaster.TaskStatus.Assign; task.AssignDate = now; task.AssignUserId = user.Id; task.AssignUserName = user.Name.Trim(); if (!task.IsAutoAssign) { task.PlanStartDate = now; task.PlanCompleteDate = this.GetPlanCompleteDate(task.TaskSubType, task.PlanStartDate.Value); } } } } private DateTime GetPlanCompleteDate(string taskSubTypeCode, DateTime planStartDate) { TaskSubType taskSubType = genericMgr.FindById<TaskSubType>(taskSubTypeCode); DateTime planEndDate = planStartDate; if (taskSubType.AssignUpTime.HasValue) { planEndDate = planEndDate.AddMinutes(double.Parse(taskSubType.AssignUpTime.Value.ToString())); } else { //EntityPreference entityPreference = entityPreferenceMgrE.LoadEntityPreference(ISIConstants.ENTITY_PREFERENCE_CODE_ISI_ASSIGN_UP_TIME); //if (entityPreference != null && !string.IsNullOrEmpty(entityPreference.Value)) //{ // planEndDate = planEndDate.AddMinutes(double.Parse(entityPreference.Value)); //} } if (taskSubType.StartUpTime.HasValue) { planEndDate = planEndDate.AddMinutes(double.Parse(taskSubType.StartUpTime.Value.ToString())); } else { var startUpTime = systemMgr.GetEntityPreferenceValue(Entity.SYS.EntityPreference.CodeEnum.StartUpTime); planEndDate = planEndDate.AddMinutes(double.Parse(startUpTime)); } if (taskSubType.CloseUpTime.HasValue) { planEndDate = planEndDate.AddMinutes(double.Parse(taskSubType.CloseUpTime.Value.ToString())); } else { var closeUpTime = systemMgr.GetEntityPreferenceValue(Entity.SYS.EntityPreference.CodeEnum.StartUpTime); planEndDate = planEndDate.AddMinutes(double.Parse(closeUpTime)); } return planEndDate; } #endregion } }
//using System; //using System.Collections.Generic; //using System.Diagnostics; //using System.Linq; //using System.Threading.Tasks; //using System.Xml.Serialization; //using Breeze.Helpers; //using Breeze.Screens; //using Breeze.Services.InputService; //using Breeze.AssetTypes.DataBoundTypes; //using BreezeModels; //using MachineInterface; //using Microsoft.Xna.Framework; //using Microsoft.Xna.Framework.Graphics; //#if WINDOWS_UAP //using Windows.Foundation; //#endif //namespace Breeze.AssetTypes //{ // public class PatternAsset : DataboundAsset // { // private int delayedRegen = -1; // public PatternAsset() // { // } // public PatternAsset(Color color, int brushSize, FloatRectangle position, ChannelContainer channel, PatternInstance patternInstance, Pattern pattern, int sampleWidth, int renderDelay, float zoom, Color? backgroundColor = null) // { // Color.Value = color; // BrushSize.Value = brushSize; // Position.Value = position; // BackgroundColor.Value = backgroundColor; // Channel.Value = channel; // Pattern.Value = pattern; // PatternInstance.Value = patternInstance; // SampleWidth.Value = sampleWidth; // RenderDelay.Value = renderDelay; // Zoom.Value = zoom; // Position.SetChangeAction(Update); // Zoom.SetChangeAction(Update); // BrushSize.SetChangeAction(Update); // Color.SetChangeAction(Update); // BackgroundColor.SetChangeAction(Update); // Pattern.SetChangeAction(Update); // PatternInstance.SetChangeAction(Update); // } // private void Update() // { // throw new NotImplementedException(); // } // private SmartSpriteBatch _spriteBatch; // private int generatedSampleWidth; // public DataboundValue<FloatRectangle> Position { get; set; } = new DataboundValue<FloatRectangle>(); // [XmlIgnore] // public DataboundValue<Pattern> Pattern { get; set; } = new DataboundValue<Pattern>(); // public DataboundValue<PatternInstance> PatternInstance { get; set; } = new DataboundValue<PatternInstance>(); // [XmlIgnore] // public DataboundValue<ChannelContainer> Channel { get; set; } = new DataboundValue<ChannelContainer>(); // public DataboundValue<Color?> BackgroundColor { get; set; }=new DataboundValue<Color?>(); // public DataboundValue<Color> Color { get; set; }=new DataboundValue<Color>(); // public DataboundValue<int> BrushSize { get; set; }=new DataboundValue<int>(); // public DataboundValue<float> Scale { get; set; } = new DataboundValue<float>(1); // [XmlIgnore] // public DataboundValue<RenderTarget2D[]> RenderTargets = new DataboundValue<RenderTarget2D[]>(); // public DataboundValue<int> RenderDelay = new DataboundValue<int>(); // public DataboundValue<float> Zoom = new DataboundValue<float>(); // public DataboundValue<int> SampleWidth { get; } = new DataboundValue<int>(); // private int[] tops; // private int[] bottoms; // private int generatedWidth = 0; // private float generatedZoom = 0; // //internal void Update(PatternAsset patternAsset) // //{ // // Position = patternAsset.Position; // // Zoom = patternAsset.Zoom; // //} // //internal void Update(FloatRectangle position, float zoom) // //{ // // Position = position; // // Zoom = zoom; // //} // private void Generate(ScreenAbstractor screen, SmartSpriteBatch spriteBatch) // { // try // { // var ps = screen.Translate(Position.Value); // int pixelWidth = (int)ps.Value.Width; // float instanceTickWidth = PatternInstance.Value.TickEnd - PatternInstance.Value.TickStart; // var tttt = pixelWidth / instanceTickWidth; // int pw = (int)(tttt * Pattern.Value.TickLength); // var xtops = new int[pw / SampleWidth.Value]; // var xbottoms = new int[pw / SampleWidth.Value]; // int sampleLength = (int)(16 * Solids.Song.TicksToSample(instanceTickWidth)); // float actualSamplesPerPixel = (float)sampleLength / (float)pixelWidth; // float asppdoubled = SampleWidth.Value * actualSamplesPerPixel; // int mid = (int)(ps.Value.Height / 2); // int ht = (int)(ps.Value.Height / 2); // Int16[] bounce = Pattern.Value.GetBounce((IMachine)Channel.Value.Machine).BounceDownLeft.From16BitByteArrayToInt16Array(); // int aspddd = (int)Math.Max(asppdoubled, 1); // for (int x = 0; x < pw / SampleWidth.Value; x++) // { // int tickStart = (int)((x * asppdoubled) + PatternInstance.Value.GetSampleOffset()) % bounce.Length; // Int16[] samples = bounce.WrappedCopy(tickStart, aspddd); // float mx = samples.Max() / (float)Int16.MaxValue; // float mn = samples.Min() / (float)Int16.MaxValue; // int tp = (int)(mid - (mx * ht)); // int bt = (int)(mid - (mn * ht)); // xtops[x] = tp; // xbottoms[x] = bt; // } // tops = xtops; // bottoms = xbottoms; // generatedWidth = pixelWidth; // generatedZoom = Zoom.Value; // delayedRegen = 0; // justRendered = true; // generatedSampleWidth = SampleWidth.Value; // } // catch { } // Solids.IsCurrentlyGeneratingPatternImage = false; // } // //TODO - this is no longer called :( // public void Update(SmartSpriteBatch spriteBatch, ScreenAbstractor screen, float opacity, FloatRectangle? clip = null) // { // if (Solids.IsCurrentlyGeneratingPatternImage) return; // FloatRectangle? ps = screen.Translate(Position.Value); // if (ps != null && (int)ps.Value.Width == generatedWidth && SampleWidth.Value == generatedSampleWidth) // { // delayedRegen = 0; // return; // } // if (Solids.IsCurrentlyGeneratingPatternImage == false) // { // delayedRegen++; // } // if (delayedRegen > RenderDelay.Value && !Solids.IsCurrentlyGeneratingPatternImage) // { // Solids.IsCurrentlyGeneratingPatternImage = true; //#if WINDOWS_UAP // IAsyncAction asyncAction = Windows.System.Threading.ThreadPool.RunAsync( // (workItem) => // { // Generate(screen, _spriteBatch); // }); //#else // Generate(screen, _spriteBatch); //#endif // } // } // public override void Draw(SmartSpriteBatch spriteBatch, ScreenAbstractor screen, float opacity, FloatRectangle? clip = null, Texture2D bgTexture = null, Vector2? scrollOffset = null) // { // FloatRectangle? ps = screen.Translate(Position.Value.Move(scrollOffset)); // clip = screen.Translate(clip); // if (clip.HasValue) // { // if (ps.Value.Right < clip.Value.X || ps.Value.X > clip.Value.Right) // { // return; // } // } // Rectangle tmp = screen.Translate(Position.Value.Move(scrollOffset)).ToRectangle(); // if (clip.HasValue) // { // if (tmp.Bottom < clip.Value.Y || tmp.Y > clip.Value.Bottom) // { // return; // } // } // Rectangle clipped = tmp.Clip(clip); // if (clipped.X == clipped.Right) // { // return; // } // if (generatedWidth > 0) // { // if ((ps.Value.Width != rendered.Width&& ps.Value.Height != rendered.Height) || justRendered) // { // SetVerticesAtZero(screen, ps.Value, clip.Value); // justRendered = false; // } // if (vertices.Count > 2) // { // //spriteBatch.DrawUserPrimitives(PrimitiveType.TriangleStrip, vertices.ToArray(), 0, vertices.Count - 2); // spriteBatch.DrawUserPrimitives(new List<SmartSpriteBatch.UserPrimitiveContainer>() { new SmartSpriteBatch.UserPrimitiveContainer(PrimitiveType.TriangleStrip, vertices.ToArray(), 0, vertices.Count - 2) }, this.Position.Value.ToVector2); // } // } // spriteBatch.DrawSolidRectangle(new FloatRectangle( // (int)(ps.Value.Clamp(clip).X), // (int)(ps.Value.Clamp(clip).Y + (ps.Value.Clamp(clip).Height) / 2f) - 2, // (int)(ps.Value.Clamp(clip).Width), 2), // Color.Value * 0.5f); // //spriteBatch.DrawLine( // // new Vector2(ps.Value.Clamp(clip.Value).X, ps.Value.Clamp(clip.Value).Y+(ps.Value.Clamp(clip.Value).Height) / 2f), // // new Vector2(ps.Value.Clamp(clip.Value).X + (ps.Value.Clamp(clip.Value).Width), ps.Value.Clamp(clip.Value).Y + (ps.Value.Clamp(clip.Value).Height) / 2f), // // Color.Black * 0.5f, // // null); // } // private bool justRendered; // List<VertexPositionColor> vertices = new List<VertexPositionColor>(); // private void SetVertices(ScreenAbstractor screen, FloatRectangle ps, FloatRectangle clip) // { // int pixelWidth = (int)ps.Width; // bool first = true; // int minX = 0; // int maxX = (int)screen.bounds.BottomRight.X; // float widthFactor = ps.Width / generatedWidth; // widthFactor = Zoom.Value / generatedZoom; // vertices = new List<VertexPositionColor>(); // float reqWidth = pixelWidth - 1 - SampleWidth.Value; // float startI = 0; // float startPos = (int)ps.X; // if (startPos < 0) // { // float dif = (0 - startPos); // startI = dif; // startPos = startPos + dif; // reqWidth = reqWidth - dif; // } // if (startPos < clip.X) // { // float dif = (clip.X - startPos); // startI = startI + dif; // startPos = startPos + dif; // reqWidth = reqWidth - dif; // } // if (startPos + reqWidth > screen.bounds.Width) // { // reqWidth = (int)screen.bounds.Width - startPos; // } // if (startPos + reqWidth > clip.BottomRight.X) // { // reqWidth = (int)clip.BottomRight.X - startPos; // } // if (startPos > 0 && reqWidth > 0) // { // float sourcePixel = ((float)(((startI) / widthFactor) / SampleWidth.Value)); // int sp = (int)(sourcePixel - 0.499999f) % tops.Length; // vertices.Add(new VertexPositionColor(new Vector3(ps.X + startI, Math.Min(Math.Max(ps.Y + bottoms[(int)sp], clip.Y), clip.Bottom), 0), Color.Value)); // vertices.Add(new VertexPositionColor(new Vector3(ps.X + startI, Math.Min(Math.Max(ps.Y + tops[(int)sp] - 1, clip.Y), clip.Bottom), 0), Color.Value)); // float mxb = bottoms.Max(); // for (int i = 1; i < reqWidth; i = i + SampleWidth.Value) // { // sourcePixel = ((float)(((i + startI) / widthFactor) / SampleWidth.Value)); // sp = (int)(sourcePixel - 0.499999f) % tops.Length; // float height = bottoms[(int)sp] / mxb; // vertices.Add(new VertexPositionColor(new Vector3(ps.X + i + startI + SampleWidth.Value, Math.Min(Math.Max(ps.Y + bottoms[(int)sp], clip.Y), clip.Bottom), 0), Color.Value * height)); // vertices.Add(new VertexPositionColor(new Vector3(ps.X + i + startI + SampleWidth.Value, Math.Min(Math.Max(ps.Y + tops[(int)sp] - 1, clip.Y), clip.Bottom), 0), Color.Value * height)); // } // } // rendered = ps; // } // private void SetVerticesAtZero(ScreenAbstractor screen, FloatRectangle ps, FloatRectangle clip) // { // int pixelWidth = (int)ps.Width; // bool first = true; // int minX = 0; // int maxX = (int)screen.bounds.BottomRight.X; // float widthFactor = ps.Width / generatedWidth; // widthFactor = Zoom.Value / generatedZoom; // vertices = new List<VertexPositionColor>(); // float reqWidth = pixelWidth - 1 - SampleWidth.Value; // float startPos = 0; // if (startPos + reqWidth > clip.BottomRight.X) // { // reqWidth = (int)clip.BottomRight.X - startPos; // } // if (reqWidth > 0) // { // int sp = 0;// (int)(sourcePixel - 0.499999f) % tops.Length; // vertices.Add(new VertexPositionColor(new Vector3(0 , bottoms[(int)sp], 0), Color.Value)); // vertices.Add(new VertexPositionColor(new Vector3(0 , tops[(int)sp] - 1, 0), Color.Value)); // float mxb = bottoms.Max(); // for (int i = 1; i < reqWidth; i = i + SampleWidth.Value) // { // float sourcePixel = ((float)(((i ) / widthFactor) / SampleWidth.Value));// ((float)(((startI) / widthFactor) / SampleWidth)); // sp = (int)(sourcePixel - 0.499999f) % tops.Length; // float height = bottoms[(int)sp] / mxb; // vertices.Add(new VertexPositionColor(new Vector3(ps.X + i + SampleWidth.Value, bottoms[(int)sp],0), Color.Value * height)); // vertices.Add(new VertexPositionColor(new Vector3(ps.X + i + SampleWidth.Value, tops[(int)sp] - 1, 0), Color.Value * height)); // } // } // rendered = ps; // } // private FloatRectangle rendered; // } //}
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using WCFService; namespace UnitTestProject1 { [TestClass] //Called unit test, but also contains test with Database PostgreSQL on Windows Server 2008 R8 public class UnitTest1 { WCFService.RestfulService client = new WCFService.RestfulService(); [TestMethod] public void PasswordDoNotMatch() { //Unit test //Password don't match test string ExpectedResult = "Passwords do not match!"; Assert.AreEqual(ExpectedResult, client.RegisterData("Something", "Wrong Password", "Correct Password", "My name", "Kaj@kaj.nl")); } [TestMethod] public void RegisterErrorMandatoryFields() { //Unit Test //Return error All fields are mandatory string ExpectedResult = "All fields are mandatory!"; Assert.AreEqual(ExpectedResult, client.RegisterData("", "", "", "", "")); } [TestMethod] public void CheckUserFromDatabaseReturnUserInfo() { //Integration test //Returns information about the user jurgen1 string ExpectedResult = "Information about user with User ID 6 / jurgen1 / Jurgen@jurgen.nl / Jurgen1 / "; Assert.AreEqual(ExpectedResult, client.SelectUser("jurgen1")); } [TestMethod] public void ChangeAdminPassword() { //Integration test //Changing password of the admin to the professional password chosen by the programmers string ExpectedResult = "Password changed!"; Assert.AreEqual(ExpectedResult, client.ChangePass("admin", "admin")); } [TestMethod] public void CreateRandomUser() { //Integration test //Creates user test string ExpectedResult = "Registration Succesfull!"; Assert.AreEqual(ExpectedResult, client.RegisterData("Ditiseentestaccount", "testpassword", "testpassword", "Testaccount", "testaccount@test.nl")); } [TestMethod] public void DeleteTheRandomUser() { //Integration test //The same users from the test above is deleted. string ExpectedResult = "The user has been deleted!"; Assert.AreEqual(ExpectedResult,client.DeleteUser("Ditiseentestaccount")); } [TestMethod] public void PasswordChangeButFails() { //Integration test //Tries to change password but username is nothing. string ExpectedResult = "Please submit Username for validation!"; Assert.AreEqual(ExpectedResult, client.ChangePass("", "Thisshouldfail")); } } }
using UnityEngine; using System.Collections; using System; using System.Text; using System.Security.Cryptography; using Mio.TileMaster; #if UNITY_EDITOR using UnityEditor; #endif public class SystemHelper { private static string _deviceUniqueID; private static string _networkUniqueID; private static string _product_encode; public static string deviceUniqueID { get { try { if (_deviceUniqueID == null) computeDeviceUniqueID(); } catch (Exception ex) { _deviceUniqueID = "Default"; Debug.LogError("SG Can't not get DeviceID " + ex.Message); } return _deviceUniqueID; } } public static string deviceNetworkUniqueID { get { if (_networkUniqueID == null) { _networkUniqueID=deviceUniqueID; } return _networkUniqueID; } } public static void ChangeNetworkIdForTesting(string testDeviceId) { _networkUniqueID=testDeviceId; } #if UNITY_EDITOR && UNITY_IPHONE private static string getProductName() { if(_product_encode==null) { string text=PlayerSettings.productName; System.Text.Encoding utf8 = System.Text.Encoding.UTF8; Byte[] encodedBytes = utf8.GetBytes(text); Byte[] convertedBytes = Encoding.Convert(Encoding.UTF8, Encoding.ASCII, encodedBytes); System.Text.Encoding ascii = System.Text.Encoding.ASCII; _product_encode=ascii.GetString(convertedBytes); //Debug.LogError(_product_encode); } return _product_encode; } #endif #if UNITY_EDITOR && UNITY_ANDROID private static string getProductName() { if(_product_encode==null) { string text=PlayerSettings.productName; System.Text.Encoding utf8 = System.Text.Encoding.UTF8; Byte[] encodedBytes = utf8.GetBytes(text); Byte[] convertedBytes = Encoding.Convert(Encoding.UTF8, Encoding.ASCII, encodedBytes); System.Text.Encoding ascii = System.Text.Encoding.ASCII; _product_encode=ascii.GetString(convertedBytes); //Debug.LogError(_product_encode); } return _product_encode; } #endif private static void computeDeviceUniqueID() { string systemID = ""; #if UNITY_EDITOR && UNITY_IPHONE systemID = getProductName()+"IOS_"+SystemInfo.deviceUniqueIdentifier; #elif UNITY_EDITOR && UNITY_ANDROID //temporary code to remove the 'phonecall' permission on android systemID = getProductName()+"ANR_"+GameManager.Instance.DeviceID; #elif UNITY_IPHONE systemID = "IOS_"+SystemInfo.deviceUniqueIdentifier; #elif UNITY_ANDROID systemID = "ANR_"+SystemInfo.deviceUniqueIdentifier; #else systemID = "OTH_"+SystemInfo.deviceUniqueIdentifier; #endif _deviceUniqueID = systemID.Replace("-", "").ToLower(); /*int len = systemID.Length; int numLong = len / 15; if (len % 15 > 0) numLong++; _deviceUniqueID = MathfEx.BaseConvert(16, 36, systemID);*/ /*byte[] bytes = new Byte[len / 2]; int numBytes = len / 2; for (int i = 0; i < numBytes; i++) { string hexByte = systemID.Substring(i * 2, 2); bytes[i] = Convert.ToByte(hexByte, 16); } _deviceUniqueID = System.Convert.ToBase64String(bytes);*/ } }
using System; namespace TaxCalc { class Program { static void Main(string[] args) { Console.WriteLine("Enter status : "); int status = int.Parse(Console.ReadLine()); Console.WriteLine("Enter profit : "); int zarada = int.Parse(Console.ReadLine()); double tax = 0; if (status == 1) { if (zarada <= 8350) tax = zarada * 0.1; else if (zarada <= 33950) tax = (8350.0 * 0.1) + (zarada - 8350) * 0.15; else if (zarada <= 82250) tax = (8350.0 * 0.1) + (33950 - 8350) * 0.15 + (zarada - 33950) * 0.25; } Console.WriteLine(tax); } } }
using gMediaTools.Models.ProcessRunner; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace gMediaTools.Services.ProcessRunner.x264 { public class X264ProcessRunnerService { public IProcessRunnerParameters GetAllParameters(string x264FileName) { // Syntax: x264 [options] -o outfile infile DefaultProcessRunnerParameters all = new DefaultProcessRunnerParameters(x264FileName, " ", false); // First Group [options] //================================================ DefaultProcessRunnerParameterGroup optionsGroup = new DefaultProcessRunnerParameterGroup("options", 1, " "); all.ParameterGroups.Add(optionsGroup); // Presets // ======= optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("profile", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("preset", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("tune", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("slow-firstpass", "--", " ", false) ); // Frame-type options // ================== optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("keyint", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("min-keyint", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-scenecut", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("scenecut", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("intra-refresh", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("bframes", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("b-adapt", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("b-bias", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("b-pyramid", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("open-gop", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-cabac", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("ref", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-deblock", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("deblock", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("slices", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("slices-max", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("slice-max-size", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("slice-max-mbs", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("slice-min-mbs", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("tff", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("bff", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("constrained-intra", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("pulldown", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("fake-interlaced", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("frame-packing", "--", " ", false) ); // Ratecontrol // =========== optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("qp", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("bitrate", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("crf", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("rc-lookahead", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("vbv-maxrate", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("vbv-bufsize", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("vbv-init", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("crf-max", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("qpmin", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("qpmax", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("qpstep", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("ratetol", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("ipratio", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("pbratio", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("chroma-qp-offset", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("aq-mode", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("aq-strength", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("pass", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("stats", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-mbtree", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("qcomp", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("cplxblur", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("qblur", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("zones", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("qpfile", "--", " ", false) ); // Analysis // ======== optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("partitions", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("direct", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-weightb", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("weightp", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("me", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("merange", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("mvrange", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("mvrange-thread", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("subme", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("psy-rd", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-psy", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-mixed-refs", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-chroma-me", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-8x8dct", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("trellis", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-fast-pskip", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("no-dct-decimate", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("nr", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("deadzone-inter", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("deadzone-intra", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("cqm", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("cqmfile", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("cqm4", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("cqm8", "--", " ", false) ); // Video Usability Info (Annex E) // ============================== optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("overscan", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("videoformat", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("range", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("colorprim", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("transfer", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("colormatrix", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("chromaloc", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("alternative-transfer", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("nal-hrd", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("filler", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("pic-struct", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("crop-rect", "--", " ", false) ); // Input/Output // ============ optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("muxer", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("demuxer", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("input", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("input-depth", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("output-depth", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("level", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("bluray-compat", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("stitchable", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("psnr", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("ssim", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("threads", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("lookahead-threads", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("sliced-threads", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("thread-input", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("non-deterministic", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("cpu-independent", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("opencl", "--", " ", false) ); optionsGroup.Parameters.Add( new AllowsEmptyValueProcessRunnerParameter("aud", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("tcfile-in", "--", " ", false) ); optionsGroup.Parameters.Add( new NonEmptyValueProcessRunnerParameter("tcfile-out", "--", " ", false) ); // Second group outfile //================================================ DefaultProcessRunnerParameterGroup outFileGroup = new DefaultProcessRunnerParameterGroup("outfile", 2, " "); all.ParameterGroups.Add(outFileGroup); outFileGroup.Parameters.Add( new QuotedValueProcessRunnerParameter("output", "--", " ") ); // Third group infile //================================================ DefaultProcessRunnerParameterGroup inFileGroup = new DefaultProcessRunnerParameterGroup("infile", 3, " "); all.ParameterGroups.Add(inFileGroup); inFileGroup.Parameters.Add( new NoNameProcessRunnerParameter("infile", true) ); return all; } } }
namespace DocumentsApproval.Commands { public class RejectDocument : BaseCommand { public string Rejecter { get; set; } } }
using System; using System.Collections.Generic; using System.Text; using WpfSuduko.MVC.Models; namespace WpfSuduko.MVC.Controllers { class FileController { private string _filePath = "D:\\Workspaces\\WpfSuduko\\WpfSuduko\\Files\\Boards.txt"; public void AppendBoardToFile(Board board, string optionalAppendBegin = "") { using (System.IO.StreamWriter file = new System.IO.StreamWriter(@_filePath, true)) { file.WriteLine(optionalAppendBegin + board.ToString()); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace CMSWebsite { public partial class EditPage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // get pageid string pageid = Request.QueryString["pageid"]; // if there is not pageid in url if (String.IsNullOrEmpty(pageid)) { pageWrapper.InnerText = "<h1>ERROR: This page does not exist</h1>"; return; } // show existed data // get pagetitle and pagebody and isPublished query // if isPublished, remain delete button. If not, show recover button string query = "SELECT * FROM pages WHERE pageid = " + pageid; List<HTMLPAGE> Pages = new WEBSITEDB().List_Query(query); foreach (HTMLPAGE page in Pages) { // show current data PageTitle.Text = page.PageTitle; PageBody.Text = page.PageBody; // if isPublished, hide recover button. If not, hide recover button if (page.IsPublished == "True" || page.IsPublished == "1") { // if isPublished, hide recover button RecoverBtn.Style.Add("display", "none"); } else { // if not, hide delete button DeleteBtn.Style.Add("display", "none"); } } } } protected void Edit_Click(object sender, EventArgs e) { string pagetitle = PageTitle.Text; string pagebody = PageBody.Text; // get pageid string pageid = Request.QueryString["pageid"]; // execute update query //UPDATE pages SET pagetitle = "123", pagebody = "321", isPublished = true WHERE pageid = 1 string query = "UPDATE pages SET pagetitle = \"" + pagetitle + "\"" + ", pagebody = \"" + pagebody + "\"" + " WHERE pageid = " + pageid; // db instance WEBSITEDB db = new WEBSITEDB(); // execute crud query db.CRUD_Query(query); Response.Redirect("DetailPage.aspx?pageid=" + pageid); } // todo remix both delete and recover function protected void Delete_Click(object sender, EventArgs e) { // get pageid string pageid = Request.QueryString["pageid"]; bool isPublished = false; // execute update query //UPDATE pages SET pagetitle = "123", pagebody = "321", isPublished = true WHERE pageid = 1 string query = "UPDATE pages SET isPublished = " + isPublished + " WHERE pageid = " + pageid; // db instance WEBSITEDB db = new WEBSITEDB(); // execute crud query db.CRUD_Query(query); Response.Redirect("Manage.aspx"); } protected void Recover_Click(object sender, EventArgs e) { // get pageid string pageid = Request.QueryString["pageid"]; bool isPublished = true; // execute update query //UPDATE pages SET pagetitle = "123", pagebody = "321", isPublished = true WHERE pageid = 1 string query = "UPDATE pages SET isPublished = " + isPublished + " WHERE pageid = " + pageid; // db instance WEBSITEDB db = new WEBSITEDB(); // execute crud query db.CRUD_Query(query); Response.Redirect("DetailPage.aspx?pageid=" + pageid); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class EnemyDamage : MonoBehaviour { [Header("Configurables")] [SerializeField] private int damage = 1; [SerializeField] private float damageResetTime = 0.25f; private Collider2D enemyCollider = null; private void Awake() { enemyCollider = GetComponent<Collider2D>(); } private void OnTriggerEnter2D(Collider2D collision) { HealthSystem health = collision.GetComponent<HealthSystem>(); if (health != null) health.ChangeHealth(-damage); enemyCollider.enabled = false; Invoke(nameof(ResetTrigger), damageResetTime); } private void ResetTrigger() { enemyCollider.enabled = true; } }
#if UNITY_2019_1_OR_NEWER using UnityEditor; using UnityAtoms.Editor; namespace UnityAtoms.BaseAtoms.Editor { /// <summary> /// Variable property drawer of type `Color`. Inherits from `AtomDrawer&lt;ColorVariable&gt;`. Only availble in `UNITY_2019_1_OR_NEWER`. /// </summary> [CustomPropertyDrawer(typeof(ColorVariable))] public class ColorVariableDrawer : VariableDrawer<ColorVariable> { } } #endif
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WebApiAngularEcommerce { public class Cart { public int ID { get; set; } [JsonIgnore] public virtual List<ProductCart> Products { get; set; } = new List<ProductCart>(); //public virtual User user { get; set; } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Boton : MonoBehaviour { public void Lentiviris() { Time.timeScale = 0.5f; } public void Normaliviris() { Time.timeScale = 1; } public void Rapidiviris() { Time.timeScale = 3; } }
using System; using System.Collections; using System.Collections.Generic; using DefaultNamespace; using UnityEngine; using UnityEngine.UI; public class Coin : MonoBehaviour { public int coinValue = 50; //if player hits the coin, then destroy the coin private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.name == "Player") { ScoreManager.Instance.ChangeScore(coinValue); Destroy(gameObject); } } }
namespace MinEvenNumber { using System; using System.Globalization; using System.Linq; using System.Threading; public class Startup { public static void Main(string[] args) { Console.WriteLine(Execute()); } private static string Execute() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; var args = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .Select(double.Parse) .Where(a => a % 2 == 0) .ToArray(); if (args.Length == 0) { return "No match"; } return $"{args.Min():f2}"; } } }
using UnityEngine; using System; using UnityEngine.UI; public class SunControl : MonoBehaviour { public float rotationSpeed; public GameObject terrain; public Text timeOfDay; void Update () { float mapSize = terrain.GetComponent<TerrainManager>().Size; transform.RotateAround(new Vector3(mapSize / 2, 0, mapSize / 2), Vector3.forward, rotationSpeed * Time.deltaTime); // calculate time of day, for funsies; 0 degree rotation is 06:00 float adjustedRot = transform.rotation.eulerAngles.z + 90; if (adjustedRot > 360) { adjustedRot -= 360; } int hours = (int)(adjustedRot / 15); int minutes = (int)((adjustedRot - hours * 15) * 4); timeOfDay.text = String.Format("{0}:{1}", hours.ToString("D2"), minutes.ToString("D2")); } }