private void lstHeadquarterRs_Click(object sender, EventArgs e)
        {
            HeadquaterReceipt headquarter = new HeadquaterReceipt();
            CMART0Entities    db          = new CMART0Entities();

            if (lstHeadquarterRs.SelectedRows.Count == 1)
            {
                var    row           = lstHeadquarterRs.SelectedRows[0];
                var    cell          = row.Cells["HeadquaterID"];
                string headquarterID = (string)cell.Value;
                headquarter         = db.HeadquaterReceipts.Single(x => x.HeadquaterID == headquarterID);
                txtHeadID.Text      = headquarter.HeadquaterID;
                cboProposed.Text    = headquarter.ProposeID;
                txtTotalAmount.Text = headquarter.TotalAmount.ToString();
                //txtAccountID.Text = headquarter.AccountID;
            }
        }
示例#2
0
        //DELETE
        public bool Delete(string headquarterID)
        {
            bool              flag        = false;
            CMART0Entities    db          = new CMART0Entities();
            HeadquaterReceipt headquarter = db.HeadquaterReceipts.Single(x => x.HeadquaterID == headquarterID);

            try
            {
                db.HeadquaterReceipts.Remove(headquarter);
                //db.usp_Account_Delete(accountID);
                db.SaveChanges();
                flag = true;
            }
            catch
            {
                flag = false;
            }
            return(flag);
        }