コード例 #1
0
        private void EditSatellite()
        {
            var num = txtNumber.Value.Trim();
            var t   = SatelliteInstance.Find(f => f.id == ParseInt(Utility.Decrypt(hidID.Value)));

            if (null != t)
            {
                var old = SatelliteInstance.Find(f => f.CardNo.Equals(num));
                if (null != old && old.id != t.id)
                {
                    ShowNotification("./satellite_manage.aspx", "Cannot edit the satellite object: The number has exist.", false);
                }
                else
                {
                    SatelliteInstance.Update(f => f.id == t.id, act => { act.CardNo = num; });
                    SaveHistory(new TB_AccountHistory()
                    {
                        ActionId = ActionInstance.Find(f => f.Name.Equals("EditSat")).id,
                        ObjectA  = SatelliteInstance.ToString(t)
                    });
                    ShowNotification("./satellite_manage.aspx", "You saved the satellite information.");
                }
            }
            else
            {
                ShowNotification("./satellite_manage.aspx", "Cannot edit the satellite object: no record exist.", false);
            }
        }
コード例 #2
0
        private void NewSatellite()
        {
            var num = txtNumber.Value.Trim();
            var t   = SatelliteInstance.Find(f => f.CardNo.Equals(num));

            if (null != t)
            {
                ShowNotification("./satellite_manage.aspx", "Error: A old one has the same card number <a>" + num + "</a>.", false);
                return;
            }
            else
            {
                var obj = SatelliteInstance.GetObject();
                obj.CardNo = num;
                SatelliteInstance.Add(obj);

                SaveHistory(new TB_AccountHistory()
                {
                    ActionId = ActionInstance.Find(f => f.Name.Equals("AddSat")).id,
                    ObjectA  = SatelliteInstance.ToString(obj)
                });
                ShowNotification("./satellite_manage.aspx", "You add a new satellite object.");
            }
        }