Beispiel #1
0
 /// <summary>
 /// Update a Port.
 /// </summary>
 public void Update(Model.Port port)
 {
     //
     // todo: add other logic here.
     //
     accessor.Update(port);
 }
Beispiel #2
0
 /// <summary>
 /// Insert a Port.
 /// </summary>
 public void Insert(Model.Port port)
 {
     //
     // todo:add other logic here
     //
     accessor.Insert(port);
 }
Beispiel #3
0
        public bool ExistsExcept(Model.Port e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.PortId) == null?null:Get(e.PortId).Id);
            return(sqlmapper.QueryForObject <bool>("Port.existsexcept", paras));
        }
Beispiel #4
0
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.bindingSource1.Current != null)
            {
                if (MessageBox.Show("確定刪除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    Model.Port port = this.bindingSource1.Current as Model.Port;

                    portManager.Delete(port.PortId);

                    this.RefreshData();
                }
            }
        }
Beispiel #5
0
        private void ControlInitial()
        {
            port = this.bindingSource1.Current as Model.Port;

            if (port != null)
            {
                this.txt_Id.Text       = port.Id;
                this.txt_PortName.Text = port.PortName;
            }
            else
            {
                this.txt_Id.Text       = "";
                this.txt_PortName.Text = "";
            }
        }
Beispiel #6
0
        private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (string.IsNullOrEmpty(this.txt_PortName.Text.Trim()) || string.IsNullOrEmpty(this.txt_Id.Text.Trim()))
            {
                MessageBox.Show("編號,名稱不能為空!", "提示", MessageBoxButtons.OK);
                return;
            }

            try
            {
                BL.V.BeginTransaction();

                if (this.State == "insert")
                {
                    port          = new Book.Model.Port();
                    port.PortId   = Guid.NewGuid().ToString();
                    port.Id       = this.txt_Id.Text;
                    port.PortName = this.txt_PortName.Text;

                    this.portManager.Insert(port);
                }
                else if (this.State == "update")
                {
                    port.Id       = this.txt_Id.Text;
                    port.PortName = this.txt_PortName.Text;

                    this.portManager.Update(port);
                }

                BL.V.CommitTransaction();

                MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                BL.V.RollbackTransaction();
                MessageBox.Show(ex.Message, "錯誤", MessageBoxButtons.OK);
                return;
            }

            this.State = "view";
            this.StateChanged();

            this.RefreshData();
        }
Beispiel #7
0
 public bool ExistsExcept(Model.Port e)
 {
     return(accessor.ExistsExcept(e));
 }
Beispiel #8
0
 public void Update(Model.Port e)
 {
     this.Update <Model.Port>(e);
 }
Beispiel #9
0
 public void Insert(Model.Port e)
 {
     this.Insert <Model.Port>(e);
 }