// Which member to add the boat to
 // Display views, get inputs to create/save boat to a member
 private void AddBoat(model.Member member)
 {
     try
     {
         _memberView.DisplayMember(member);
         model.Boat.BoatType type = _boatView.GetTypeFromUser();
         double length = _boatView.GetLengthFromUser();
         DateTime registrationDate = _boatView.GetRegistrationDate();
         model.Boat boat = new model.Boat(type, length, registrationDate);
         member.AddBoat(boat);
         _list.SaveMemberList();
         DoMemberView(member);
     }
     catch (Exception ex)
     {
         _memberView.DisplayMember(member);
         _boatView.DisplayErrorMessage(ex.Message);
         if (_boatView.DoesUserWantsToQuit() == true)
         {
             DoMemberView(member);
         }
         else
         {
             AddBoat(member);
         }
     }
 }
Exemple #2
0
    protected void POMRepeaterMaintain_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        LinkButton btn = (LinkButton)e.Item.FindControl("btndelete");

        btn.Visible = false;

        model m = new model();

        m.open();
        SqlDataReader dr = m.admin("logintbl", "loginid=" + Session["admin"].ToString() + " and deptname like 'admin'");

        if (dr.HasRows)
        {
            dr.Read();
            btn.Visible = true;
        }
        dr.Close();
        SqlDataReader dr1 = m.admin("logintbl", "loginid=" + Session["admin"].ToString() + " and deptname like 'manager'");

        if (dr1.HasRows)
        {
            dr1.Read();
            btn.Visible = true;
        }
        dr1.Close();
        m.close();
    }
Exemple #3
0
        public override bool update(ModelDTO obj)
        {
            // Find(id) выполнит запрос и найдет объект по этому ID
            model m = db.models.Find(obj.model);

            if (m != null)
            {
                m.modelName.manufacturer = obj.company;
                m.model1 = obj.modelName;

                m.transmission = obj.transmission;
                m.type         = obj.type;
                m.engine       = obj.engine;
                m.colour       = obj.colour;

                // danger behaviour
                List <car> cars = m.cars.ToList();
                cars[0].price        = obj.price;
                cars[0].rest         = obj.rest;
                cars[0].deliveryTime = obj.delivery;

                db.SaveChanges();

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        rcd = GameObject.Find("GlobalRecord").GetComponent <GlobalRecord>();

        canvas          = GameObject.Find("Canvas").GetComponent <Canvas>();
        wordDisplay     = canvas.frontDisplay;
        backWordDisplay = canvas.backDisplay;
        showE           = 0.0f;

        isGameOver = false;

        // receive database
        db = rcd.database;

        // load words
        LoadWords(db);

        mainWord     = GameObject.Find("mainWord");
        battle       = GameObject.Find("Camera").GetComponent <t_BattleSystem>();
        barHP        = GameObject.Find("Camera").GetComponent <HorizontalBar>();
        blur         = GameObject.Find("Camera").GetComponent <BlurEffect>();
        blur.enabled = false;

        isDead = false;

        // initial
        Initial();

        levelNum = 3;
        levelNow = 1;
    }
Exemple #5
0
    public void GetOrdernoandRefno()
    {
        model m = new model();

        m.open();
        SqlDataReader dr = m.getLastRecord("orderno", "purchasemaster", "orderno");

        if (dr.HasRows)
        {
            dr.Read();
            ordno = Convert.ToInt32(dr["orderno"]);
        }
        else
        {
            ordno = 0;
        }
        ordno = Convert.ToInt32(ordno) + 1;

        String todaydate = DateTime.Today.ToString("yyMM");

        todaydate = DateTime.Today.ToString("yyMM");
        String refno = "R-" + todaydate + ordno;

        refrenceno.Text = refno;

        m.close();
    }
Exemple #6
0
 public Class(String name, String judgeName, model.Size size, List<model.Grade> grades)
 {
     this.Name = name;
     this.judgeName = judgeName;
     this.size = size;
     this.grades = grades;
 }
Exemple #7
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(model.ContractModel model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into Contract(");
            strSql.Append("ID,Descption,ParentID,SlnID,Complated,AgreementID)");
            strSql.Append(" values (");
            strSql.Append("@ID,@Descption,@ParentID,@SlnID,@Complated,@AgreementID)");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4),
                    new SqlParameter("@Descption", SqlDbType.VarChar,100),
                    new SqlParameter("@ParentID", SqlDbType.Int,4),
                    new SqlParameter("@SlnID", SqlDbType.Int,4),
                    new SqlParameter("@Complated", SqlDbType.Bit,0),
                    new SqlParameter("@AgreementID", SqlDbType.Int,4)};
            parameters[0].Value = model.ID;
            parameters[1].Value = model.Descption;
            parameters[2].Value = model.ParentID;
            parameters[3].Value = model.SlnID;
            parameters[4].Value = model.Complated;
            parameters[5].Value = model.AgreementID;
            int rows = SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Exemple #8
0
        public ActionResult Create(model model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var item = model.ToDomain();

                    _database.Add(item);
                    if (item.IsPublic == true)
                    {
                        return(RedirectToAction("Public"));
                    }
                    else
                    {
                        return(RedirectToAction("My"));
                    }
                } catch (Exception e)
                {
                    ModelState.AddModelError("", e.Message);
                }
            }

            return(View(model));
        }
Exemple #9
0
        public PlayGame(model.Game a_game, view.IView a_view)
        {
            m_game = a_game;
            m_view = a_view;

            m_game.AddObserver(this);
        }
        public bool DoHit(model.Player a_dealer)
        {
            var cards = a_dealer.GetHand();

            // Check if limit has reached....
            if (a_dealer.CalcScore() == g_hitLimit)
            {
                foreach (var card in cards)
                {
                    // Must hit if ace in hand. Because score IS 17!
                    //Ace turns into 1 score instead
                    if (card.GetValue() == Card.Value.Ace)
                    {
                        return true;
                    }
                }
            }

            // No special circumstances....
            if (a_dealer.CalcScore() < g_hitLimit)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public bool DoHit(model.Player a_dealer)
        {
            int[] cardScores = a_dealer.getCardScoreArray();
            total = 0;

            if (a_dealer.CalcScore() < 17)
            {
                return true;
            }

            if (a_dealer.CalcScore() == 17){

                foreach (Card c in a_dealer.GetHand())
                {
                    if (c.GetValue() != Card.Value.Ace)
                    {
                        total += cardScores[(int)c.GetValue()];
                    }
                }
                //if this is true a soft 17 is active.
                if (total <= 6)
                {
                    return true;
                }
            }

            return false;
        }
        public bool Play(model.Game a_game, view.IView a_view)
        {
            //Initialize fields
            m_view = a_view;
            m_game = a_game;

            a_view.DisplayWelcomeMessage();

            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            view.Input input = a_view.GetInput();

            if (input == view.Input.Play)
            {
                a_game.NewGame();
            }
            else if (input == view.Input.Hit)
            {
                a_game.Hit();
            }
            else if (input == view.Input.Stand)
            {
                a_game.Stand();
            }

            return input != view.Input.Quit;
        }
        public bool Play(model.Game a_game, view.IView a_view)
        {
            m_view = a_view;
            m_game = a_game;
            a_view.DisplayWelcomeMessage();

            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            BlackJack.view.Events input = (BlackJack.view.Events)a_view.GetInput();

            if (input == view.Events.Play)
            {
                a_game.NewGame();
            }
            else if (input == view.Events.Hit)
            {
                a_game.Hit();
            }
            else if (input == view.Events.Stand)
            {
                a_game.Stand();
            }

            return input != view.Events.Quit;
        }
Exemple #14
0
 public PlayGame(model.Game g, view.IView v)
 {
     a_game = g;
     a_view = v;
     a_view.DisplayWelcomeMessage();
     a_game.Subscribe(this);
 }
        public void SensorDataUpdated(model.SensorData data)
        {
            lock (_lock)
            {
                List<TcpClient> clientsToDelete = new List<TcpClient>();

                foreach (TcpClient client in _clients)
                {
                    try
                    {
                        NetworkStream stream = client.GetStream();
                        BinaryFormatter formatter = new BinaryFormatter();

                        formatter.Serialize(stream, data);
                    }
                    catch (Exception)
                    {
                        clientsToDelete.Add(client);
                    }
                }

                foreach (TcpClient c in clientsToDelete)
                {
                    _clients.Remove(c);
                }
            }
        }
Exemple #16
0
        // With some validation to confirm the delete
        public bool ConfirmDelete(model.Member m)
        {
            Console.WriteLine("-----------------------------------");
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write(" Repeat the memberId to confirm: ");

            try
            {
                int memberId = int.Parse(Console.ReadLine());
                Console.WriteLine("");
                if (memberId == m.MemberId)
                {
                    PressKeyToContinue();
                    return true;
                }
                else
                {
                    Console.WriteLine(" MemberId missmatched!");
                }
            }
            catch (FormatException)
            {
                Console.WriteLine("\n Invalid ID!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            PressKeyToContinue();
            return false;
        }
Exemple #17
0
 public PlayGame(model.Game a_game, view.IView a_view)
 {
     m_game = a_game;
     m_view = a_view;
     m_view.DisplayWelcomeMessage();
     m_game.Subsribe(this);
 }
Exemple #18
0
        public bool Play(model.Game a_game)
        {
            m_view.DisplayWelcomeMessage();

            m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                m_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            switch((view.Choices)m_view.GetInput())
            {
                case view.Choices.Play:
                    a_game.NewGame();
                    break;
                case view.Choices.Hit:
                    a_game.Hit();
                    break;
                case view.Choices.Stand:
                    a_game.Stand();
                    break;
                case view.Choices.Quit:
                    return false;

                default:
                    break;
            }

            return true;
        }
Exemple #19
0
        public ActionResult Edit(model model, EventCriteria criteria)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var item = model.ToDomain();
                    item.Id = model.Id;

                    _database.Update(model.Id, item);

                    if (item.IsPublic == true)
                    {
                        return(RedirectToAction("Public"));
                    }
                    else
                    {
                        return(RedirectToAction("My"));
                    }
                } catch (Exception e)
                {
                    ModelState.AddModelError("", e.Message);
                };
            }
            ;

            return(View(model));
        }
Exemple #20
0
        public bool PlayGame(view.Console a_view, model.GameFacade a_game)
        {
            a_view.PresentInstructions();
            a_view.DisplayHands(a_game.GetDealerHand(), a_game.GetDealerScore(), a_game.GetPlayerHand(), a_game.GetPlayerScore());
            if (a_game.IsGameOver())
            {
                a_view.DisplayWinner(a_game.IsPlayerWinner());
            }

            view.Console.Event e;

            e = a_view.GetEvent();
            if (e == view.Console.Event.Quit)
            {
                return false;
            }
            if (e == view.Console.Event.Start)
            {
                a_game.StartNewRound();

            }
            if (e == view.Console.Event.Hit)
            {
                a_game.Hit();
            }
            if (e == view.Console.Event.Stand)
            {
                a_game.Stand();
            }

            return true;
        }
Exemple #21
0
 public bool Play(model.Game a_game)
 {            
     m_view.DisplayWelcomeMessage();
     if (a_game.GetPlayerScore() != 0)
     {
         m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
         m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());
     }
     if (a_game.IsGameOver())
     {
         m_view.DisplayGameOver(a_game.IsDealerWinner());
     }
     gameAction input = m_view.GetInput();
     if (input == gameAction.play)
     {
         m_view.DisplayWelcomeMessage();
         var test = a_game.NewGame();
     }
     else if (input == gameAction.hit)
     {
         a_game.Hit();
     }
     else if (input == gameAction.stand)
     {
         a_game.Stand();
     }
     return input != gameAction.quit;
 }
Exemple #22
0
        public bool Play(model.Game a_game)
        {
            //a_game.AddSubscriber(this);
            m_view.DisplayWelcomeMessage();

               // m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            //m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());//

            if (a_game.IsGameOver())
            {
                m_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            model.Game.Status input = m_view.GetInput();

            if (input == model.Game.Status.NewGame)
            {
                a_game.NewGame();
            }
            else if (input == model.Game.Status.Hit)
            {
                a_game.Hit();
            }
            else if (input == model.Game.Status.Stand)
            {
                a_game.Stand();
            }

            return input != model.Game.Status.Quit;
        }
Exemple #23
0
        int r_skydirect; // not used?

        #endregion Fields

        #region Methods

        //  of newsky on the left of each scan, 128 bytes
        //  of topsky on the right, because the low-level
        //  drawers need 256-byte scan widths
        /*
        =============
        R_InitSky

        A sky texture is 256*128, with the right side being a masked overlay
        ==============
        */
        public static void R_InitSky(model.texture_t mt)
        {
            int     i, j;
            int     src;

            src = (int)mt.offsets[0];

            for (i = 0; i < 128; i++)
            {
                for (j = 0; j < 128; j++)
                {
                    newsky[(i * 256) + j + 128] = mt.pixels[src+i * 256 + j + 128];
                }
            }

            for (i = 0; i < 128; i++)
            {
                for (j = 0; j < 131; j++)
                {
                    if (mt.pixels[src + i * 256 + (j & 0x7F)] != 0)
                    {
                        bottomsky[(i * 131) + j] = mt.pixels[src + i * 256 + (j & 0x7F)];
                        bottommask[(i * 131) + j] = 0;
                    }
                    else
                    {
                        bottomsky[(i * 131) + j] = 0;
                        bottommask[(i * 131) + j] = 0xff;
                    }
                }
            }

            r_skysource = newsky;
        }
Exemple #24
0
        public bool Play(model.Game a_game, view.IView a_view)
        {
            a_view.DisplayWelcomeMessage();

            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            int input = a_view.GetInput();

            if (input == 'p')
            {
                a_game.NewGame();
            }
            else if (input == 'h')
            {
                a_game.Hit();
            }
            else if (input == 's')
            {
                a_game.Stand();
            }

            return input != 'q';
        }
        public bool DoHit(model.Player a_dealer)
        {
            int score = a_dealer.CalcScore();

            if (score < g_hitLimit)
            {
                return true;
            }

            if (score == g_hitLimit)
            {
                foreach (Card c in a_dealer.GetHand())
                {
                    //If Ace is in the hand, checks if score without Ace is 6
                    if ((c.GetValue() == Card.Value.Ace) && (score - 11 == 6))
                    {
                        score -= 10;
                    }
                }

                return score < g_hitLimit;
            }

            return false;
        }
Exemple #26
0
        public bool Play(model.Game a_game, view.IView a_view)
        {
            a_view.DisplayWelcomeMessage();
            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            //int input = a_view.GetInput(); removed due to hidden depencendy.
            int input = System.Console.In.Read();

            if (input == 'p')
            {
                a_game.NewGame();
            }
            else if (input == 'h')
            {
                a_game.Hit();
            }
            else if (input == 's')
            {
                a_game.Stand();
            }

            return input != 'q';
        }
        public bool DoHit(model.Player a_dealer)
        {
            int[] cardScores = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11 };
            var score = 0;
            var cards = a_dealer.GetHand();
            var numberOfAces = 0;
            foreach (var c in cards)
            {
                
                if (c.GetValue() != Card.Value.Hidden)
                {
                    score += cardScores[(int)c.GetValue()];

                    if (c.GetValue() == Card.Value.Ace)
                    {
                        numberOfAces++;
                    }
                }
            }

            while ((score == g_hitLimit || score > 21) && numberOfAces > 0)
            {
                numberOfAces--;
                score -= 10;
            }

            return score < g_hitLimit;
        }
 public void DrawCard(model.Card card)
 {
     m_view.DisplayWelcomeMessage();
     m_view.DisplayDealerHand(m_game.GetDealerHand(), m_game.GetDealerScore());
     m_view.DisplayPlayerHand(m_game.GetPlayerHand(), m_game.GetPlayerScore());
     Thread.Sleep(750);
 }
        public void ShowCard(model.Card a_card)
        {
            //first do some randomize
            RandomizeCard();

            DoShowCard(a_card);
        }
Exemple #30
0
 public PlayGame(model.Game A_game,
     view.IView A_view)
 {
     a_game = A_game;
       a_view = A_view;
       a_game.addSub(this);
 }
Exemple #31
0
        public PlayGame(model.Game a_game, view.IView a_view)
        {
            this.a_game = a_game;
            this.m_view = a_view;

            a_game.AddSubscriber(this);
        }
Exemple #32
0
 /// <summary>
 /// Add a boat menu
 /// </summary>
 /// <param name="a_member">model.Member, the member who owns the new boat</param>
 private void AddBoat(model.Member a_member)
 {
     m_console.AddBoat(a_member);
     for (int i = 0; i < (int)model.Boat.Type.Count; i += 1)
     {
         string message = string.Format("{0}: {1}", i, (model.Boat.Type)i);
         m_console.WriteMessage(message);
     }
     int type;
     while (true)
     {
         m_console.WriteMessage("Type: ");
         bool isNumeric = int.TryParse(m_console.ReadResponse(), out type);
         if (isNumeric && type >= 0 && type < (int)model.Boat.Type.Count)
         {
             break;
         }
         m_console.WriteMessage("Invalid type, type must be a number choosen from the list above");
     }
     double length;
     while (true)
     {
         m_console.WriteMessage("Length: ");
         bool isDouble = double.TryParse(m_console.ReadResponse(), out length);
         if (isDouble && length > 0)
         {
             break;
         }
         m_console.WriteMessage("Invalid length. Length must be of the format XX or XX,XX");
     }
     a_member.GetBoatList().AddBoat((model.Boat.Type)type, length);
     m_console.SetCurrentMenu(view.Console.CurrentMenu.Member);
     GoToCurrentMenu(a_member);
 }
        public bool DoHit(model.Player a_dealer)
        {
            if (a_dealer.CalcScore() == g_hitLimit)
            {
                int otherValue = 0;
                bool aceFound = false;
                int[] cardScores = new int[(int)model.Card.Value.Count] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11 };

                foreach (Card card in a_dealer.GetHand())
                {
                    if (card.GetValue() == Card.Value.Ace && !aceFound)
                    {
                        aceFound = true;
                    } else {
                        otherValue += cardScores[(int)card.GetValue()];
                        if (otherValue > 6)
                        {
                            return false;
                        }
                    }
                }
                if (otherValue == 6 && aceFound)
                {
                    return true;
                }
            }
            return a_dealer.CalcScore() < g_hitLimit;
        }
Exemple #34
0
        public int BoatMenu(model.Boat a_boat)
        {
            Console.Clear();
            Console.WriteLine("");
            Console.WriteLine("-----Boat specifics-----");
            Console.WriteLine("Type: {0}", a_boat.GetType());
            Console.WriteLine("Length: {0}", a_boat.GetLength());

            Console.WriteLine("");
            Console.WriteLine("---------------");
            Console.WriteLine("");
            Console.WriteLine("(D) to Delete boat (U) to Update boat");
            ConsoleKeyInfo input = Console.ReadKey();
            if (input.Key == ConsoleKey.D)
            {
                return 1;
            }

            else if (input.Key == ConsoleKey.U)
            {
                return 2;
            }

            else return 0;          //returnera nåt annat
        }
        public ActionResult DeleteConfirmed(int id)
        {
            model model = db.models.Find(id);

            db.models.Remove(model);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #36
0
 public AnalysisForm(model FemapModel)
 {
     InitializeComponent();
     this.FemapModel = FemapModel;
     timer1.Start();
     timer1.Interval = 200;
     timer1.Tick    += timer1_Tick;
 }
    public MainPage()
    {
        InitializeComponent();
        model m = new model();

        m.Name         = "name_1";
        BindingContext = m;
    }
 public bool DoHit(model.Player a_dealer)
 {
     //if (a_dealer.CalcScore() == g_hitLimit)
     //{
     //    return DealerHasAce(a_dealer.GetHand());
     //}
     return a_dealer.CalcScore() < g_hitLimit;
 }
        public PlayGame(view.IView a_view, model.Game a_game)
        {
            m_view = a_view;
            m_game = a_game;

            // Subscribe to observer
            m_game.AddSubscribtionToCards(this);
        }
 public int Create(model state)
 {
     //if (db.PrintTime.Find(state.PrintTimeId) != null)
     //    return -1;
     state.StartPrintTime = DateTime.Now.ToLocalTime();  //时间状态在创建数据条目时自动生成
     db.PrintTime.Add(state);
     db.SaveChanges();
     return(1);
 }
Exemple #41
0
        public JsonResult Read(model state)
        {
            db.Configuration.ProxyCreationEnabled = false;
            IEnumerable <model> query = from q in db.WarehouseState
                                        where q.StateId == state.StateId && state.CurrentTime.Day == q.CurrentTime.Day && q.CurrentTime.Month == state.CurrentTime.Month && q.CurrentTime.Year == state.CurrentTime.Year
                                        select q;

            return(Json(query.OrderByDescending(item => item.StateId)));
        }
Exemple #42
0
        public ActionResult Create()
        {
            var model = new model();

            model.StartDate = DateTime.Today;
            model.EndDate   = DateTime.Today;

            return(View(model));
        }
Exemple #43
0
 public ActionResult SubmitForm(model model)
 {
     return(Json(
                new Get
     {
         status = true,
         statuscode = "510"
     }));
 }
Exemple #44
0
 private void OnEnable()
 {
     fJSON = readJSONFile();
     fUI   = FaustUI_UI.ReadJSONUi(fJSON);
     fUI.getUI(0).setNumParams();
     _dsp      = (model)target;
     paramtab1 = new float[variables];
     paramtab2 = new float[variables];
 }
Exemple #45
0
        /*用来储存当前操作的时间,与金额*/
        public model draw(string ID, string DRAW)
        {
            model         mm     = null;
            string        DT_sql = "select * from DATA where id='" + ID + "'";
            SqlConnection DT_con = new SqlConnection(count);

            DT_con.Open();
            SqlCommand    DT_cmd = new SqlCommand(DT_sql, DT_con);
            SqlDataReader DT_dr  = DT_cmd.ExecuteReader();
            model         i_mm   = new model();

            if (DT_dr.HasRows)
            {
                DT_dr.Read();
                /*-----------先读取之前转账的信息------------*/
                DT        += DT_dr["RECORD"].ToString().Trim();
                i_mm.money = DT_dr["MONEY"].ToString().Trim();
            }
            DT_dr.Close();
            DT_con.Close();
            if (DRAW == "" || Convert.ToInt32(DRAW) > Convert.ToInt32(i_mm.money))
            {
                //model i_mm = null;
                mm = i_mm;
                return(mm);
            }
            else
            {
                DT += "\n" + DateTime.Now.ToString("yyy-M-d H:m:s");
                SqlConnection con = new SqlConnection(count);
                con.Open();
                string        sql = "select * from data where id='" + ID + "'";//这个查询账号的信息,再进行读取余额
                SqlCommand    cmd = new SqlCommand(sql, con);
                SqlDataReader dr  = cmd.ExecuteReader();

                if (dr.Read())
                {
                    i = Convert.ToInt32(dr["money"].ToString().Trim());//自己的本钱/
                }
                con.Close();
                int k = i - Convert.ToInt32(DRAW);//自己的本钱减去要取出来的钱,然后把k更新到数据可以里
                //2018-12-6 14:3:53已取出100  2018-12-6 14:6:24 已取出10元
                DT += " 已取出" + DRAW + "元";
                string sqlup = "update data set money='" + k + "',RECORD='" + DT + "'where id='" + ID + "'";//执行sql语句
                //string sql02 = "update DATA set mory='" + k + "',RECORD='" + NOW + "'where ID='" + textBox1.Text.Trim() + "'";
                con.Open();
                SqlCommand cmdup = new SqlCommand(sqlup, con);
                int        n     = cmdup.ExecuteNonQuery();
                con.Close();
                mm       = null;
                mm       = new model();
                mm.money = Convert.ToString(i);
                //要把已经计算好的金额更新到数据库中
                return(mm);
            }
        }
Exemple #46
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        model m = new model();

        m.open();
        m.insert("salesmantbl", "salesmanname,salesdeptname,isdelete", "'" + salesmanname.Text + "','" + dropdeptname.SelectedValue + "',1");
        cleartextbox();
        m.close();
        showsalesmanName();
    }
    protected void btnupdate_Click(object sender, EventArgs e)
    {
        model m = new model();

        m.open();
        m.update("logintbl", "name='" + name.Text + "',surname='" + surname.Text + "',username='******',contact='" + contact.Text + "',deptname='" + dropdeptname.SelectedItem + "',password='******',passhint='" + passhint.Text + "',DOB='" + DOB.Text + "',modifydate='" + DateTime.Now.ToString() + "'", "loginid=" + Label2.Text);
        m.close();
        cleartextbox();
        showCarregi();
    }
    protected void btnupdate_Click(object sender, EventArgs e)
    {
        model m = new model();

        m.open();
        m.update("partstbl", "partname='" + partname.Text + "',carcompanyid='" + carcompany.SelectedValue + "',cartypeid='" + cartype.SelectedValue + "',carmodelid='" + carmodel.SelectedValue + "',carsubmodelid='" + carsubmodel.SelectedValue + "',partprice='" + partprice.Text + "',sgst='" + sgst.Text + "',cgst='" + cgst.Text + "',igst='" + igst.Text + "',remark='" + remark.Text + "',partcode='" + partcode.Text + "',loginid='" + loginidtext + "',tdate='" + DateTime.Now.ToString("yyyy-MM-dd") + "' ", "partid=" + Label1.Text);
        m.close();
        cleartextbox();
        showParts();
    }
Exemple #49
0
    protected void btnupdate_Click(object sender, EventArgs e)
    {
        model m = new model();

        m.open();
        m.update("servicecategory", "servicename='" + servicename.Text + "',price='" + price.Text + "',sgst='" + sgst.Text + "',cgst='" + cgst.Text + "',igst='" + igst.Text + "' ", "servicecategoryid=" + Label1.Text);
        m.close();
        cleartextbox();
        showServicecategory();
    }
Exemple #50
0
        public static void Test()
        {
            model data = new model();

            data.bbb = "aaa";
            var validationContext = new ValidationContext(data);
            var resultValidation  = new List <ValidationResult>();
            var isValid           = Validator.TryValidateObject(data, validationContext, resultValidation, true);
            var errormsg          = string.Join("|", resultValidation.Select(x => x.ErrorMessage));
        }
Exemple #51
0
            public void Excluir(model modelo)
            {
                if (modelo.ID == 0)
                {
                    throw new Exception("Selecione uma produto");
                }
                DALProduto objExcluir = new DALProduto();

                objExcluir.Excluir(modelo);
            }
    protected void btnsubmit_Click1(object sender, EventArgs e)
    {
        model m = new model();

        m.open();
        m.insert("carmodel", "carmodelname,cartypeid,isdelete", "'" + carmodel1.Text + "'," + cartype.SelectedValue + ",1");
        m.close();
        cleartextbox();
        showCarModel();
    }
        private void CarregarClientes()
        {
            model             get          = new model();
            List <DtoCliente> ListClientes = get.getAllClientes();

            comboBoxNome.DataSource    = null;
            comboBoxNome.ValueMember   = "id";
            comboBoxNome.DisplayMember = "nome";
            comboBoxNome.DataSource    = ListClientes;
        }
        private void CarregarMMotoristas()
        {
            model get = new model();
            List <DtoMotorista> ListMotorista = get.getAllMotorista();

            comboBoxNome.DataSource    = null;
            comboBoxNome.ValueMember   = "id";
            comboBoxNome.DisplayMember = "nome";
            comboBoxNome.DataSource    = ListMotorista;
        }
 public int Create(model state)
 {
     if (db.UserInfo.Find(state.UserId) != null)
     {
         return(-1);
     }
     db.UserInfo.Add(state);
     db.SaveChanges();
     return(1);
 }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        model m = new model();

        m.open();
        m.update("logintbl", "name='" + name.Text + "',surname='" + surname.Text + "',password='******',passhint='" + passhint.Text + "'", "loginid='" + Label2.Text + "'");
        ScriptManager.RegisterStartupScript(Page, GetType(), "dis", "<script> $(document).ready(function () { $('#updatedisplay').modal('show');  }); </script>", false);
        PageLoadDataFillOfLoger();
        m.close();
    }
    void Update()
    {
        //database = GameObject.Find("database").GetComponent<model>();
        database = DataManager.modelComponent;
        wordList = database.getWords();

        DontDestroyOnLoad(gameObject);
        //Application.LoadLevel("menuScene");
        this.enabled = false;
    }
    protected void btnsubmit_Click1(object sender, EventArgs e)
    {
        model m = new model();

        m.open();
        m.insert("carcompany", "carcompanyname,isdelete", "'" + carcompanyname.Text + "',1");
        m.close();
        cleartextbox();
        showCarcompany();
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        model m = new model();

        m.open();
        m.insert("depttbl", "deptname,isdelete", "'" + deptname.Text.ToUpper() + "',1");
        cleartextbox();
        showDept();
        m.close();
    }
Exemple #60
0
        /*储存*/
        public model Storage(string ID, string Money)
        {
            string        DT_sql = "select * from DATA";
            SqlConnection DT_con = new SqlConnection(count);

            DT_con.Open();
            SqlCommand    DT_cmd = new SqlCommand(DT_sql, DT_con);
            SqlDataReader DT_dr  = DT_cmd.ExecuteReader();
            int           m      = 0;

            if (DT_dr.HasRows)
            {
                DT_dr.Read();
                /*-----------先读取之前转账的信息------------*/
                DT += DT_dr["RECORD"].ToString().Trim();
                m   = Convert.ToInt32(DT_dr["MONEY"].ToString().Trim());
            }
            DT_dr.Close();
            DT_con.Close();

            DT += "\n" + DateTime.Now.ToString("yyy-M-d H:m:s");
            if (Money == "")
            {
                model i_mm = null;
                return(i_mm);
            }
            else
            {
                //model mm = new model();
                model         mm  = null;
                SqlConnection con = new SqlConnection(count);
                con.Open();
                string        sql = "select * from data where id='" + ID + "'";//这个查询账号的信息,再进行读取余额
                SqlCommand    cmd = new SqlCommand(sql, con);
                SqlDataReader dr  = cmd.ExecuteReader();

                if (dr.Read())
                {
                    i = Convert.ToInt32(dr["money"].ToString().Trim());//自己的本钱/
                }
                con.Close();
                int k = i + Convert.ToInt32(Money);                                                          //自己的本钱减去要取出来的钱,然后把k更新到数据可以里
                DT += " 已存入" + Money + "元";
                string sqlup = "update data set money='" + k + "',RECORD='" + DT + "'where id='" + ID + "'"; //执行sql语句
                con.Open();
                SqlCommand cmdup = new SqlCommand(sqlup, con);
                int        n     = cmdup.ExecuteNonQuery();
                con.Close();
                mm       = null;
                mm       = new model();
                mm.money = Convert.ToString(k);
                //要把已经计算好的金额更新到数据库中
                return(mm);
            }
        }