Ejemplo n.º 1
0
        /*
         * Function: GetFlightsByTime
         * Description: Gets all the flight in DB that are active during `relative_to` time.
         */
        public IEnumerable <Flight> GetFlightsByTime(MyDateTime relativeTo)
        {
            var flights = new List <Flight> {
            };

            // Connection Opened //
            _conn.Open();

            var cmd = _conn.CreateCommand();

            cmd.CommandText = @"SELECT * FROM flights 
                                    WHERE takeoff_unix <= " + relativeTo.unix +
                              " AND landing_unix >= " + relativeTo.unix +
                              " AND is_external = 0";


            using (var reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    // Logic seems problematic - passing reader and connection to Flight
                    var flight = new Flight(reader, _conn, relativeTo);
                    flights.Add(flight);
                }
            }

            // Connection Closed //
            _conn.Close();

            return(flights);
        }
Ejemplo n.º 2
0
 public MinerTradeHistoryRecordControl()
 {
     InitializeComponent();
     this.datagrid.ItemsSource        = App.TradeHistoryVMObject.ListMinerBuyRecords;
     this.dpStartCreateTime.ValueTime = MyDateTime.FromDateTime(DateTime.Now.AddDays(-7));
     this.dpEndCreateTime.ValueTime   = MyDateTime.FromDateTime(DateTime.Now);
 }
Ejemplo n.º 3
0
        private string getCalculatedInvocieNumber(int freeNum)
        {
            //Last one or 2 digit + Prefix + Number

            string Num = "";

            //year, 9, 10,11..
            Num += MyDateTime.GetYearNumber();

            //Prefix,
            string prefix = "";

            switch (_invType)
            {
            case (int)NInvoiceType.Regular:
                prefix = SalesCenterConstants.PrefixInvoice;

                break;

            case (int)NInvoiceType.Proforma:
                prefix = SalesCenterConstants.PrefixProformaInvoice;

                break;
            }

            Num += prefix;

            Num += (freeNum + SalesCenterConstants.BEGIN_INVOICE_NUMBER).ToString("D4");

            return(Num);
        }
 protected ArchivesDetails GetArchivesFromReader(IDataReader iDataReader)
 {
     return(new ArchivesDetails((int)iDataReader["Id"], (byte)iDataReader["BigType"], (byte)iDataReader["SmallType"]
                                , (double)iDataReader["Amount"], (double)iDataReader["Price"], (double)iDataReader["PaidMoney"], (double)iDataReader["StayingPrice"]
                                , (double)iDataReader["Profit"], MyDateTime.Parse(iDataReader["AddedDate1"].ToString())
                                , MyDateTime.Parse(iDataReader["AddedDate2"].ToString()), MyDateTime.Parse(iDataReader["AddedDate"].ToString()), iDataReader["Details"].ToString()));
 }
 public void SetRecordPay()
 {
     this.ParentObject.IsPay   = true;
     this.ParentObject.PayTime = MyDateTime.FromDateTime(DateTime.Now);
     NotifyPropertyChange("IsPay");
     NotifyPropertyChange("PayTime");
 }
 public AlipayHistoryRecordControl()
 {
     InitializeComponent();
     this.datagrid.ItemsSource     = App.TradeHistoryVMObject.ListAllAlipayRecords;
     this.dpStartPayTime.ValueTime = MyDateTime.FromDateTime(DateTime.Now.AddDays(-7));
     this.dpEndPayTime.ValueTime   = MyDateTime.FromDateTime(DateTime.Now);
 }
        public override string IsValidated()
        {
            var    b = true;
            string validationResult = "";

            //Installation Address
            var msc = new MySalesJobMasterListCustomer(BaseValue.JobID);

            msc.SetInstallTo();

            if (msc.CustomerID == 0)
            {
                validationResult += "No Installation Company Selected  " + System.Environment.NewLine;
                b = false;
            }
            else
            {
                var mc = new MyCustomer(msc.CustomerID);

                if (MyConvert.ConvertToString(mc.Value.ADDR_1).Length < 5)
                {
                    validationResult += "No Installation Address  " + System.Environment.NewLine;
                    b = false;
                }
            }


            //Document Attached
            var requiredDocuemntTypes = new int[] { 200 };

            for (int i = 0; i < requiredDocuemntTypes.Length; i++)
            {
                var docTypeID   = requiredDocuemntTypes[i];
                var docAttached = _db.PermitDocuments.Where(x => x.BaseAppID == BaseValue.BaseAppID & x.DocType == docTypeID).ToList();
                if (!docAttached.Any())
                {
                    var docType = _db.PermitDocumentTypes.Find(docTypeID);
                    validationResult += "Document Required: " + docType.TypeName + System.Environment.NewLine;
                    b = false;
                }
            }

            //Leadtime
            if (BaseValue.Deadline <= DateTime.Today)
            {
                validationResult += "Lead time is 5 business days  " + System.Environment.NewLine;
                b = false;
            }
            else
            {
                var endDate = Convert.ToDateTime(BaseValue.Deadline);
                if (MyDateTime.GetDiffHoursOfWeekday(DateTime.Today, endDate) < 24 * NLeadTime)
                {
                    validationResult += "Lead time is 5 business days  " + System.Environment.NewLine;
                    b = false;
                }
            }

            return(b ? "ok" : validationResult);
        }
 public GoldCoinRechargeHistoryRecordControl()
 {
     InitializeComponent();
     this.dgRecords.ItemsSource       = App.TradeHistoryVMObject.ListGoldCoinRechargeRecords;
     this.dpStartCreateTime.ValueTime = MyDateTime.FromDateTime(DateTime.Now.AddDays(-7));
     this.dpEndCreateTime.ValueTime   = MyDateTime.FromDateTime(DateTime.Now);
 }
Ejemplo n.º 9
0
        /*
         * Function: GetExternalFlightsByTime
         * Description: This method sends an async request to the external servers, and asks for
         *              the relevant flights for `relative_to`.
         */
        public async Task <IEnumerable <Flight> > GetExternalFlightsByTime(MyDateTime relativeTo)
        {
            var flights = new List <Flight> {
            };

            var servers = _queryManager.GetAllServers();

            foreach (var server in servers)
            {
                try
                {
                    // Send the request and try to get the Flights list
                    var    url = server.url + "/api/Flights?relative_to=" + relativeTo.iso;
                    string ext = await _httpClient.GetStringAsync(url);

                    var severFlights = JsonConvert.DeserializeObject <IEnumerable <Flight> >(ext);

                    flights.AddRange(severFlights);
                }
                catch (Exception e)
                {
                    var err = @"Problem occurred while fetching data from
                                server " + server.url + " (" + e.Message + ")";
                    Console.WriteLine(err);
                }
            }

            // Set all flight as external
            foreach (var flight in flights)
            {
                flight.isExternal = true;
            }

            return(flights);
        }
Ejemplo n.º 10
0
 public BaseDetails(int id, string name, string details, MyDateTime addeddate)
 {
     this.ID        = id;
     this.Details   = details;
     this.AddedDate = addeddate;
     this.Name      = name;
 }
        public HandleExceptionAlipayRecordWindow(AlipayRechargeRecordUIModel alipayRecord)
        {
            InitializeComponent();
            _alipayRecord = alipayRecord;

            try
            {
                this.txtAlipayOrderNumber.Text   = alipayRecord.alipay_trade_no;
                this.txtBuyerEmail.Text          = alipayRecord.buyer_email;
                this.txtBuyerEmail.IsReadOnly    = true;
                this.txtBuyerUserName.Text       = alipayRecord.user_name;
                this.txtBuyerUserName.IsReadOnly = true;
                this.txtOrderNumber.Text         = alipayRecord.out_trade_no;
                this.txtOrderNumber.IsReadOnly   = true;
                this.txtOrderType.Text           = alipayRecord.TradeTypeText;
                this.numTotalFee.Value           = (double)alipayRecord.total_fee;
                this.numTotalFee.IsReadOnly      = true;
                //this.numValueRMB.Value = (double)alipayRecord.value_rmb;
                this.mydpPayTime.ValueTime = MyDateTime.FromDateTime(alipayRecord.pay_time);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Ejemplo n.º 12
0
        public int PayAward(string adminUserName, string playerUserName, int recordID)
        {
            RouletteWinnerRecord record = _finishedRouletteWinnerRecord.FirstOrDefault(r => r.RecordID == recordID);

            if (record == null)
            {
                return(OperResult.RESULTCODE_GAME_WINAWARDRECORD_NOT_EXIST);
            }
            if (record.UserName != playerUserName)
            {
                return(OperResult.RESULTCODE_GAME_WINAWARDRECORD_NOT_EXIST);
            }

            record.IsPay   = true;
            record.PayTime = MyDateTime.FromDateTime(DateTime.Now);

            //save To DB
            DBProvider.GameRouletteDBProvider.SetWinnerRecordPay(record);
            //notify player
            LogHelper.Instance.AddInfoLog("管理员[" + adminUserName + "],确认支付了玩家[" + playerUserName + "]的幸运转盘大奖," + record.AwardItem.AwardName);

            string playerToken = ClientManager.GetToken(playerUserName);

            if (!string.IsNullOrEmpty(playerToken))
            {
                if (RouletteWinRealAwardPaySucceedNotify != null)
                {
                    RouletteWinRealAwardPaySucceedNotify(playerToken, record);
                }
            }

            _finishedRouletteWinnerRecord.Remove(record);

            return(OperResult.RESULTCODE_TRUE);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 领取奖励
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="recordID"></param>
        /// <param name="info1"></param>
        /// <param name="info2"></param>
        public int TakeAward(string userName, int recordID, string info1, string info2)
        {
            RouletteWinnerRecord record = _finishedRouletteWinnerRecord.FirstOrDefault(r => r.RecordID == recordID);

            if (record == null)
            {
                return(OperResult.RESULTCODE_GAME_WINAWARDRECORD_NOT_EXIST);
            }
            if (record.UserName != userName)
            {
                return(OperResult.RESULTCODE_GAME_WINAWARDRECORD_NOT_EXIST);
            }
            record.IsGot    = true;
            record.GotTime  = MyDateTime.FromDateTime(DateTime.Now);
            record.GotInfo1 = info1;
            record.GotInfo2 = info2;
            //Save to DB
            DBProvider.GameRouletteDBProvider.SetWinnerRecordGot(record);

            //Notify Administrator
            LogHelper.Instance.AddInfoLog("玩家[" + userName + "],领取了幸运转盘大奖," + record.AwardItem.AwardName);


            return(OperResult.RESULTCODE_TRUE);
        }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            MyDateTime test = new MyDateTime(2000);

            Console.WriteLine(test);
            MyDateTime test1 = new MyDateTime();

            Console.WriteLine(test1);
            int        result;
            MyDateTime act   = new MyDateTime();
            MyDateTime date  = new MyDateTime(29, 2, 2001);
            MyDateTime date2 = new MyDateTime(1, 2, 2000);

            act.Chrono(ref date, ref date2);
            Console.WriteLine(date.ToString());
            Console.WriteLine(date2.ToString());


            act.Calculated(date, date2, out result);
            Console.WriteLine(result);
            //Person person = new Person("pasha", "ruchkov", DateTime.Parse("2.2.2000"));
            //Magazine magazine = new Magazine("IMYA",DateTime.Parse("1.2.2000"), 1 );
            //magazine.AddArticle(new [] {new Article(person, "name", 2), });
            //magazine.AddArticle(new [] {new Article(person, "name1", 3), });
            //magazine.AddArticle(new [] {new Article(person, "name2", 5), });
            //Console.WriteLine(magazine.ToString());
            Console.ReadKey();
        }
 protected ClientDealDetails GetClientDealFromReader(IDataReader iDataReader)
 {
     return(new ClientDealDetails(
                (int)iDataReader["Id"], (int)iDataReader["TypeId"], (int)iDataReader["ClientId"]
                , (double)iDataReader["Amount"], (double)iDataReader["Price"], (double)iDataReader["PaidMoney"],
                iDataReader["Details"].ToString(),
                MyDateTime.Parse(iDataReader["AddedDate"].ToString()), (TheUnito)Enum.Parse(typeof(TheUnito), iDataReader["TheUnit"].ToString()), (double)iDataReader["BusinessPrice"], iDataReader["ClientName"].ToString(), iDataReader["TypeName"].ToString()));
 }
        public StoneSellTradeHistoryRecordControl()
        {
            InitializeComponent();
            this.dgRecords.ItemsSource = App.StoneOrderVMObject.ListMySellStoneHistoryOrders;

            this.dpStartCreateTime.ValueTime = MyDateTime.FromDateTime(DateTime.Now.AddDays(-7));
            this.dpEndCreateTime.ValueTime   = MyDateTime.FromDateTime(DateTime.Now);
        }
Ejemplo n.º 17
0
 public void AsyncGetUserRemoteHandleServiceRecords(string playerUserName, MyDateTime beginCreateTime, MyDateTime endCreateTime, int pageItemCount, int pageIndex)
 {
     if (GlobalData.Client.IsConnected)
     {
         App.BusyToken.ShowBusyWindow("正在查询数据...");
         GlobalData.Client.GetUserRemoteHandleServiceRecords(playerUserName, beginCreateTime, endCreateTime, pageItemCount, pageIndex);
     }
 }
Ejemplo n.º 18
0
        public static int InsertCompany(int id, string name, string details)
        {
            MyDateTime     xx  = new MyDateTime(DateTime.Now);
            CompanyDetails tb1 = new CompanyDetails(id, name, details, xx, 0);
            int            x   = myRealProvider.InsertCompany(tb1);

            return(x);
        }
Ejemplo n.º 19
0
 public void AsyncGetMyselfAwardRecord(int RouletteAwardItemID, MyDateTime BeginWinTime, MyDateTime EndWinTime, int IsGot, int IsPay, int pageItemCount, int pageIndex)
 {
     if (GlobalData.Client.IsEnable)
     {
         App.BusyToken.ShowBusyWindow("正在加载数据...");
         GlobalData.Client.GetAllWinAwardRecords(GlobalData.CurrentUser.UserName, RouletteAwardItemID, BeginWinTime, EndWinTime, IsGot, IsPay, pageItemCount, pageIndex, GlobalData.CurrentUser.UserName);
     }
 }
Ejemplo n.º 20
0
        public DelegateBuyStoneHistoryRecordControl()
        {
            InitializeComponent();

            this.dgRecords.ItemsSource       = App.StackStoneVMObject.AllFinishedBuyOrders;
            this.dpStartCreateTime.ValueTime = MyDateTime.FromDateTime(DateTime.Now.AddDays(-7));
            this.dpEndCreateTime.ValueTime   = MyDateTime.FromDateTime(DateTime.Now);
        }
Ejemplo n.º 21
0
 public void AsyncGetBuyMinerFinishedRecordList(string playerUserName, MyDateTime beginCreateTime, MyDateTime endCreateTime, int pageItemCount, int pageIndex)
 {
     if (GlobalData.Client != null)
     {
         App.BusyToken.ShowBusyWindow("正在查询矿工购买记录...");
         ListMinerBuyRecords.Clear();
         GlobalData.Client.GetBuyMinerFinishedRecordList(playerUserName, beginCreateTime, endCreateTime, pageItemCount, pageIndex);
     }
 }
Ejemplo n.º 22
0
 public void AsyncGetWithdrawRMBRecordList(int state, string playerUserName, MyDateTime beginCreateTime, MyDateTime endCreateTime, string adminUserName, MyDateTime beginPayTime, MyDateTime endPayTime, int pageItemCount, int pageIndex)
 {
     if (GlobalData.Client != null)
     {
         App.BusyToken.ShowBusyWindow("正在查找数据...");
         ListHistoryWithdrawRecords.Clear();
         GlobalData.Client.GetWithdrawRMBRecordList(state, playerUserName, beginCreateTime, endCreateTime, adminUserName, beginPayTime, endPayTime, pageItemCount, pageIndex);
     }
 }
 protected BusinesDealDetails GetBusinesDealFromReader(IDataReader iDataReader)
 {
     return(new BusinesDealDetails(
                (int)iDataReader["Id"], (int)iDataReader["TypeId"], (int)iDataReader["ManId"]
                , (double)iDataReader["Amount"], (double)iDataReader["BusinessPrice"],
                (double)iDataReader["ClientPrice"], (double)iDataReader["PaidMoney"],
                iDataReader["Details"].ToString(),
                MyDateTime.Parse(iDataReader["AddedDate"].ToString()), iDataReader["ManName"].ToString(), iDataReader["TypeName"].ToString()));
 }
Ejemplo n.º 24
0
 public Store(int id, int typeid, double amount, MyDateTime addedDatecompany, MyDateTime addedDateclient, string typename)
 {
     this.ID               = id;
     this.TypeId           = typeid;
     this.Amount           = amount;
     this.AddedDateClient  = addedDateclient;
     this.AddedDateCompany = addedDatecompany;
     this.TypeName         = typename;
 }
 protected TypeDetails GetTypeFromReader(IDataReader iDataReader)
 {
     return(new TypeDetails(
                (int)iDataReader["Id"],
                iDataReader["TypeName"].ToString(),
                (double)iDataReader["BusinessPrice"],
                (double)iDataReader["ClientPrice"], (double)iDataReader["BusinessClientPrice"],
                MyDateTime.Parse(iDataReader["AddedDate"].ToString()), iDataReader["AllCompanyId"].ToString(), (TheUnito)Enum.Parse(typeof(TheUnito), iDataReader["TheUnit"].ToString()), iDataReader["BaraCode"].ToString()));
 }
 protected ClientDetails GetClientFromReader(IDataReader iDataReader)
 {
     return(new ClientDetails(
                (int)iDataReader["Id"],
                iDataReader["ClientName"].ToString(),
                iDataReader["Details"].ToString(),
                MyDateTime.Parse(iDataReader["AddedDate"].ToString()), (double)iDataReader["Balance"]
                ));
 }
 protected LastClientsAccountDetails GetLastClientAccountFromReader(IDataReader iDataReader)
 {
     return(new LastClientsAccountDetails(
                (int)iDataReader["Id"],
                (int)iDataReader["ClientId"],
                (double)iDataReader["Can"],
                (double)iDataReader["Numbero"],
                (double)iDataReader["Sar"],
                MyDateTime.Parse(iDataReader["AddedDate"].ToString())));
 }
        public static int InsertType(int id, string name, double businessprice, double clientprice, double businessclientprice, TheUnito theUnit, string baracode)
        {
            MyDateTime xx = new MyDateTime(DateTime.Now);

            TypeDetails tb1 = new TypeDetails(id, name, businessprice, clientprice, businessclientprice, xx, "", theUnit, baracode);

            int x = myRealProvider.InsertType(tb1);

            return(x);
        }
Ejemplo n.º 29
0
        public WipTaskSchedule(int contentID, DateTime targetDate)
        {
            _targetDate = MyDateTime.GetDateOfMinusBusinessDays(targetDate, -1);


            var dbml = new ProjectModelDbEntities();

            _task = dbml.tblWipTasks.First(x => x.ContentID == contentID);
            _scheduleStartDate = DateTime.Today;
        }
        private void Search()
        {
            string     playerUserName  = this.txtPlayerUserName.Text.Trim();
            MyDateTime beginCreateTime = this.dpStartCreateTime.ValueTime;
            MyDateTime endCreateTime   = this.dpEndCreateTime.ValueTime;

            int pageIndex = (int)this.numPageIndex.Value;

            App.MineTradeVMObject.AsyncGetBuyMineFinishedRecordList(playerUserName, beginCreateTime, endCreateTime, GlobalData.PageItemsCount, pageIndex);
        }
Ejemplo n.º 31
0
    public int CompareTo(MyDateTime aDateTime)
    {
        ////#if UNITY_FLASH
        if (timestamp < aDateTime.timestamp) {
            return -1;
        } else if (timestamp == aDateTime.timestamp) {
            return 0;
        } else {
            return 1;
        }
        //#else

        //#endif
    }
Ejemplo n.º 32
0
 public HomeIndexFilter()
 {
     DateMin = new MyDateTime();
     DateMax = new MyDateTime();
 }
Ejemplo n.º 33
0
 private bool DateIsValid(MyDateTime date){
     return date.IsValid && date.DateTime.HasValue;
 }