/// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public List <CUSTOMER_RECEIPT> SearchDSCUSTOMER_DEBT(CUSTOMER_RECEIPT obj)
        {
            DataTable dt = new DataTable();

            try
            { // lấy dsNV hien thi len luoi voi dieu kien DaXoa = false, TragThai != Nghi Viec
                DataProvider.FillDataTable(DataProvider.ConnectionString, dt, "CUSTOMER_RECEIPT_Search",
                                           obj.RefDate,
                                           obj.RefOrgNo,
                                           obj.RefType,
                                           obj.RefStatus,
                                           obj.PaymentMethod,
                                           obj.Barcode,
                                           obj.ExchangeRate,
                                           obj.CustomerName,
                                           obj.CustomerAddress,
                                           obj.CustomerTax,
                                           obj.ContactName,
                                           obj.Amount,
                                           obj.FAmount,
                                           obj.Discount,
                                           obj.FDiscount,
                                           obj.Reconciled,
                                           obj.Description
                                           );
                return(MapCUSTOMER_RECEIPT(dt));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int rs_customer_receipt, rs_customer_receipt_detail;

            rs_customer_receipt        = -1;
            rs_customer_receipt_detail = -1;
            CUSTOMER_RECEIPT        _customer_receipt        = new CUSTOMER_RECEIPT();
            CUSTOMER_RECEIPT_DETAIL _customer_receipt_detail = new CUSTOMER_RECEIPT_DETAIL();

            if (MessageBox.Show("Bạn Muốn Xóa Phiếu Thu Này?", "Cảnh Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                if (gridView1.RowCount > 0)
                {
                    string id = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]).ToString();
                    _customer_receipt          = new CUSTOMER_RECEIPTController().CUSTOMER_RECEIPT_GetbyRefID(id.Trim());
                    _customer_receipt_detail   = new CUSTOMER_RECEIPT_DETAILController().CUSTOMER_RECEIPT_DETAIL_GetbyReceiptID(_customer_receipt.ID);
                    rs_customer_receipt        = new CUSTOMER_RECEIPTController().CUSTOMER_RECEIPT_Delete2011(_customer_receipt.ID, _customer_receipt.RefOrgNo);
                    rs_customer_receipt_detail = new CUSTOMER_RECEIPT_DETAILController().XoaCUSTOMER_RECEIPT_DETAIL(_customer_receipt_detail.ID);
                    if ((rs_customer_receipt > -1) && (rs_customer_receipt_detail > -1))
                    {
                        MessageBox.Show("Phiếu thu đã được xóa", "Thông báo");
                    }
                    else
                    {
                        MessageBox.Show("Phiếu thu không được xóa", "Thông báo");
                    }
                    gridControl1.DataSource = new CUSTOMER_RECEIPTController().LayDSCUSTOMER_RECEIPT();
                }
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="ID"></param>
 /// <returns></returns>
 public int CapNhatCUSTOMER_RECEIPT(CUSTOMER_RECEIPT obj, string ID)
 {
     try
     {
         return(DataProvider.ExecuteNonquery(DataProvider.ConnectionString, "CUSTOMER_RECEIPT_Update",
                                             ID,
                                             obj.RefID,
                                             obj.RefDate,
                                             obj.RefOrgNo,
                                             obj.RefType,
                                             obj.RefStatus,
                                             obj.PaymentMethod,
                                             obj.Barcode,
                                             obj.CurrencyID,
                                             obj.ExchangeRate,
                                             obj.BranchID,
                                             obj.ContractID,
                                             obj.CustomerID,
                                             obj.CustomerName,
                                             obj.CustomerAddress,
                                             obj.CustomerTax,
                                             obj.ContactName,
                                             obj.Amount,
                                             obj.FAmount,
                                             obj.Discount,
                                             obj.FDiscount,
                                             obj.Reconciled,
                                             obj.IsPublic,
                                             obj.CreatedBy,
                                             obj.CreatedDate,
                                             obj.ModifiedBy,
                                             obj.ModifiedDate,
                                             obj.OwnerID,
                                             obj.Description,
                                             obj.Sorted,
                                             obj.Active
                                             ));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private List <CUSTOMER_RECEIPT> MapCUSTOMER_RECEIPT(DataTable dt)
        {
            List <CUSTOMER_RECEIPT> rs = new List <CUSTOMER_RECEIPT>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CUSTOMER_RECEIPT obj = new CUSTOMER_RECEIPT();
                if (dt.Columns.Contains("ID"))
                {
                    obj.ID = new Guid(dt.Rows[i]["ID"].ToString());
                }
                if (dt.Columns.Contains("RefID"))
                {
                    obj.RefID = dt.Rows[i]["RefID"].ToString();
                }
                if (dt.Columns.Contains("RefDate"))
                {
                    obj.RefDate = DateTime.Parse(dt.Rows[i]["RefDate"].ToString());
                }
                if (dt.Columns.Contains("RefOrgNo"))
                {
                    obj.RefOrgNo = dt.Rows[i]["RefOrgNo"].ToString();
                }
                if (dt.Columns.Contains("RefID"))
                {
                    obj.RefID = dt.Rows[i]["RefID"].ToString();
                }
                if (dt.Columns.Contains("RefType"))
                {
                    obj.RefType = int.Parse(dt.Rows[i]["RefType"].ToString());
                }
                if (dt.Columns.Contains("RefStatus"))
                {
                    obj.RefStatus = int.Parse(dt.Rows[i]["RefStatus"].ToString());
                }
                if (dt.Columns.Contains("PaymentMethod"))
                {
                    obj.PaymentMethod = new Guid(dt.Rows[i]["PaymentMethod"].ToString());
                }
                if (dt.Columns.Contains("Barcode"))
                {
                    obj.Barcode = dt.Rows[i]["Barcode"].ToString();
                }
                if (dt.Columns.Contains("CurrencyID"))
                {
                    obj.CurrencyID = dt.Rows[i]["CurrencyID"].ToString();
                }
                if (dt.Columns.Contains("ExchangeRate"))
                {
                    obj.ExchangeRate = double.Parse(dt.Rows[i]["ExchangeRate"].ToString());
                }
                if (dt.Columns.Contains("BranchID"))
                {
                    obj.BranchID = dt.Rows[i]["BranchID"].ToString();
                }
                if (dt.Columns.Contains("ContractID"))
                {
                    obj.ContractID = dt.Rows[i]["ContractID"].ToString();
                }
                if (dt.Columns.Contains("CustomerID"))
                {
                    obj.CustomerID = dt.Rows[i]["CustomerID"].ToString();
                }
                if (dt.Columns.Contains("CustomerName"))
                {
                    obj.CustomerName = dt.Rows[i]["CustomerName"].ToString();
                }
                if (dt.Columns.Contains("CustomerAddress"))
                {
                    obj.CustomerAddress = dt.Rows[i]["CustomerAddress"].ToString();
                }
                if (dt.Columns.Contains("CustomerTax"))
                {
                    obj.CustomerTax = dt.Rows[i]["CustomerTax"].ToString();
                }
                if (dt.Columns.Contains("ContactName"))
                {
                    obj.ContactName = dt.Rows[i]["ContactName"].ToString();
                }
                if (dt.Columns.Contains("Amount"))
                {
                    obj.Amount = double.Parse(dt.Rows[i]["Amount"].ToString());
                }
                if (dt.Columns.Contains("FAmount"))
                {
                    obj.FAmount = double.Parse(dt.Rows[i]["FAmount"].ToString());
                }
                if (dt.Columns.Contains("Discount"))
                {
                    obj.Discount = double.Parse(dt.Rows[i]["Discount"].ToString());
                }
                if (dt.Columns.Contains("FDiscount"))
                {
                    obj.FDiscount = double.Parse(dt.Rows[i]["FDiscount"].ToString());
                }
                if (dt.Columns.Contains("Reconciled"))
                {
                    obj.Reconciled = bool.Parse(dt.Rows[i]["Reconciled"].ToString());
                }
                if (dt.Columns.Contains("IsPublic"))
                {
                    obj.IsPublic = bool.Parse(dt.Rows[i]["IsPublic"].ToString());
                }
                if (dt.Columns.Contains("CreatedBy"))
                {
                    obj.CreatedBy = dt.Rows[i]["CreatedBy"].ToString();
                }
                if (dt.Columns.Contains("CreatedDate"))
                {
                    obj.CreatedDate = DateTime.Parse(dt.Rows[i]["CreatedDate"].ToString());
                }
                if (dt.Columns.Contains("ModifiedBy"))
                {
                    obj.ModifiedBy = dt.Rows[i]["ModifiedBy"].ToString();
                }
                if (dt.Columns.Contains("ModifiedDate"))
                {
                    obj.ModifiedDate = DateTime.Parse(dt.Rows[i]["ModifiedDate"].ToString());
                }
                if (dt.Columns.Contains("OwnerID"))
                {
                    obj.OwnerID = dt.Rows[i]["OwnerID"].ToString();
                }
                if (dt.Columns.Contains("Description"))
                {
                    obj.Description = dt.Rows[i]["Description"].ToString();
                }
                if (dt.Columns.Contains("Sorted"))
                {
                    obj.Sorted = long.Parse(dt.Rows[i]["Sorted"].ToString());
                }
                if (dt.Columns.Contains("Active"))
                {
                    obj.Active = bool.Parse(dt.Rows[i]["Active"].ToString());
                }
                rs.Add(obj);
            }
            return(rs);
        }