Esempio n. 1
0
        protected void SaveData()
        {
            try
            {
                if (vID != null)
                {
                    //Edit on the object.
                    int Id;
                    if (int.TryParse(vID.ToString(), out Id))
                    {
                        SizeInfo obj = SizeManager.Select(Id);
                        obj.Sizename = txtName.Text;
                        obj.Status   = int.Parse(txtOrder.Text);
                        SizeManager.Update(obj);
                    }
                }
                else
                {
                    //this is a new object.
                    SizeInfo obj = new SizeInfo();
                    obj.Sizename = txtName.Text;
                    obj.Status   = int.Parse(txtOrder.Text);
                    SizeManager.Insert(obj);
                }

                lblMessage.Text   = "Đã lưu dữ liệu thành công!";
                EditPanel.Enabled = false;
                BindData();
                vID = null;
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Esempio n. 2
0
        private void EditData(int Id)
        {
            SizeInfo obj = SizeManager.Select((int)Id);

            txtName.Text      = obj.Sizename;
            txtOrder.Text     = obj.Status.ToString();
            vID               = obj.SizeID;
            EditPanel.Enabled = true;
        }