public long Insert(CardMaster card) { using (var sqlConnection = new SqlConnection(Constant.DatabaseConnection)) { sqlConnection.Open(); var _cardMaster = new CardMaster() { GUID = Guid.NewGuid().ToString(), RECORD_STATUS = 1, INSERT_DATE = DateTime.Now, INSERT_USER = card.INSERT_USER, UPDATE_DATE = DateTime.Now, UPDATE_USER = card.UPDATE_USER, CUSTOMER_NUMBER = card.CUSTOMER_NUMBER, CARD_ALIAS = card.CARD_ALIAS, CARD_CVV = card.CARD_CVV, CARD_EXPIRE_DATE = card.CARD_EXPIRE_DATE, CARD_EXPIRE_MONTH = card.CARD_EXPIRE_MONTH, CARD_EXPIRE_YEAR = card.CARD_EXPIRE_YEAR, CARD_HOLDER_NAME = card.CARD_HOLDER_NAME, CARD_MASKED_NUMBER = card.CARD_MASKED_NUMBER, CARD_REF_NUMBER = card.CARD_REF_NUMBER, CONVERSATION_ID = card.CONVERSATION_ID }; var customerGuid = sqlConnection.Insert <CardMaster>(_cardMaster); sqlConnection.Close(); return(customerGuid); } }
public void MasterTransfer(int mode, DateTime date) { if (Card == null) { return; } UStatus.UpdateValue(2); CollectedBits = UStatus.Value; SaveUserStatus(); //CardObject CO = (CardObject)card; int m = Int32.Parse(mode.ToString()); if (mode == 0) // Give to Employer { Employer.AddCardTransfer(Card, date); Card.EmployerName = Employer.FullName; CardMaster.ReturnCard(Card, date); SaveEmployers(); SaveCardManager(); } else if (mode == 1) // back from Employer { CardMaster.AddCard(Card, date); Card.EmployerName = "Master"; Employer.ReturnCard(Card, date); SaveEmployers(); SaveCardManager(); } //Card = null; }
public CardMaster Update(CardMaster card) { CardMaster _cardMaster = null; using (var sqlConnection = new SqlConnection(Constant.DatabaseConnection)) { sqlConnection.Open(); _cardMaster = sqlConnection.Get <CardMaster>(card.CUSTOMER_NUMBER); _cardMaster.RECORD_STATUS = 1; _cardMaster.UPDATE_DATE = DateTime.Now; _cardMaster.UPDATE_USER = card.UPDATE_USER; _cardMaster.CARD_ALIAS = card.CARD_ALIAS; _cardMaster.CARD_CVV = card.CARD_CVV; _cardMaster.CARD_EXPIRE_DATE = card.CARD_EXPIRE_DATE; _cardMaster.CUSTOMER_NUMBER = card.CUSTOMER_NUMBER; _cardMaster.CARD_EXPIRE_MONTH = card.CARD_EXPIRE_MONTH; _cardMaster.CARD_EXPIRE_YEAR = card.CARD_EXPIRE_YEAR; _cardMaster.CARD_HOLDER_NAME = card.CARD_HOLDER_NAME; _cardMaster.CARD_MASKED_NUMBER = card.CARD_MASKED_NUMBER; _cardMaster.CARD_REF_NUMBER = card.CARD_REF_NUMBER; _cardMaster.CONVERSATION_ID = card.CONVERSATION_ID; sqlConnection.Update <CardMaster>(_cardMaster); var result = sqlConnection.Get <CardMaster>(_cardMaster.CUSTOMER_NUMBER); } return(_cardMaster); }
private void receivedHandler(Dictionary <string, object> dict) { var uri = (NetworkDataURI)Enum.Parse(typeof(NetworkDataURI), dict["uri"].ToString()); switch (uri) { case NetworkDataURI.SpecialWin: case NetworkDataURI.Retire: if (dict["isWin"].ToString() == "1") { Sender.Send("Win."); } else { Sender.Send("Lose."); } break; case NetworkDataURI.BattleFinish: switch (ToolboxGame.RealTimeNetworkBattle.GetBattleManager().JudgeCurrentFinishStatus()) { case BattleFinishStatus.Life_Win: case BattleFinishStatus.ShortageDeck_Win: Sender.Send("Win."); break; case BattleFinishStatus.Life_Lose: case BattleFinishStatus.ShortageDeck_Lose: Sender.Send("Lose."); break; } break; #if DEBUG case NetworkDataURI.PlayHand: case NetworkDataURI.PlayHandActions: var str = new List <string>(); if (dict.ContainsKey("knownList")) { var list = dict["knownList"] as List <Object>; foreach (var info in list) { var cardInfo = info as Dictionary <string, object>; var cardId = cardInfo["card_id"].ToInt(); str.Add(CardMaster.GetInstance().GetCardParameterFromId(cardId).CardName); } } Sender.Send($"PlayHand:{str.Aggregate((a, b) => $"{a},{b}")}"); break; default: Sender.Send($"ReceiveMsg:{uri.ToString()}"); break; #endif } }
public bool DeleteMasterCard() { CardObject CO = Card; if (CardMaster.DeleteCard(CO)) { Card = null; SaveCardManager(); return(true); } return(false); }
public void AddMasterCard(string n, string t, DateTime dt) { CardObject CO = new CardObject() { CardType = t, Number = n, EmployerName = "Master" }; CardMaster.AddCard(CO, dt); UStatus.UpdateValue(2); CollectedBits = UStatus.Value; SaveUserStatus(); SaveCardManager(); }
public Operation <CardMaster> PostCardMaster(CardMaster cardMaster) { if (cardMaster == null) { return(new Operation <CardMaster>() { Fail = "Card is null !" }); } Operation <CardMaster> op_CardMaster = new Operation <CardMaster>(); using (IDbConnection connection = new SqlConnection(ERPService.Properties.Settings.Default.DefaultConnectionString)) { IDbTransaction transaction = null; try { connection.Open(); transaction = connection.BeginTransaction(); if (cardMaster.Id == 0) { connection.Insert(cardMaster, transaction); } else { connection.Update(cardMaster, transaction); } transaction.Commit(); connection.Close(); op_CardMaster.Value = cardMaster; op_CardMaster.Successful = true; } catch (Exception ex) { try { transaction.Rollback(); } catch { } op_CardMaster.Fail = ex.Message; } } new Repositories.LogRepository().Log(20, cardMaster.Id, cardMaster); return(op_CardMaster); }
public CardMaster Delete(CardMaster card) { CardMaster _cardMaster = null; using (var sqlConnection = new SqlConnection(Constant.DatabaseConnection)) { sqlConnection.Open(); _cardMaster = sqlConnection.Get <CardMaster>(card.CUSTOMER_NUMBER); _cardMaster.RECORD_STATUS = 0; _cardMaster.UPDATE_DATE = DateTime.Now; _cardMaster.UPDATE_USER = card.UPDATE_USER; sqlConnection.Update <CardMaster>(_cardMaster); var result = sqlConnection.Get <CardMaster>(card.CUSTOMER_NUMBER); } return(_cardMaster); }
public Operation <CardMaster> GetCardMaster(int Id) { Operation <CardMaster> op_item = new Operation <CardMaster>(); CardMaster card = null; using (IDbConnection connection = new SqlConnection(Properties.Settings.Default.DefaultConnectionString)) { try { card = connection.Get <CardMaster>(Id); op_item.Value = card; op_item.Successful = (card != null); } catch (Exception ex) { op_item.Fail = ex.Message; } } return(op_item); }
public CardMaster SelectByCardRefNumber(long cardRefNumber) { CardMaster _cardMaster = null; using (var sqlConnection = new SqlConnection(Constant.DatabaseConnection)) { sqlConnection.Open(); IEnumerable <CardMaster> card_master = sqlConnection.Query <CardMaster>("select * from CARD_MASTER where CARD_REF_NUMBER = @id and RECORD_STATUS = 1", new { id = cardRefNumber }); if (card_master.Count() == 0) { throw new Exception(CommonDefinitions.CUSTOMER_NOT_FOUND); } else { _cardMaster = card_master.FirstOrDefault(); } } return(_cardMaster); }
public void MasterTransfer(int mode, DateTime date) { //CardObject CO = (CardObject)card; int m = Int32.Parse(mode.ToString()); if (m == 0) // Give to Employer { CardMaster.RemodeCard(Card); Employer.ReturnCard(Card, date); Employer.AddCardTransfer(Card, date); Card.EmployerName = Employer.FullName; SaveEmployers(); } else if (m == 1) // back from Employer { //SaveEmployers(); } //Card = null; }