Example #1
0
        public virtual bool EditContractInvoice(ContractInvoiceInfo entity)
        {
            string    SqlAdd = null;
            DataTable DtAdd  = null;
            DataRow   DrAdd  = null;

            SqlAdd = "SELECT * FROM Contract_Invoice WHERE Invoice_ID = " + entity.Invoice_ID;
            DtAdd  = DBHelper.Query(SqlAdd);
            try
            {
                if (DtAdd.Rows.Count > 0)
                {
                    DrAdd = DtAdd.Rows[0];
                    DrAdd["Invoice_ID"]              = entity.Invoice_ID;
                    DrAdd["Invoice_ContractID"]      = entity.Invoice_ContractID;
                    DrAdd["Invoice_Type"]            = entity.Invoice_Type;
                    DrAdd["Invoice_Title"]           = entity.Invoice_Title;
                    DrAdd["Invoice_Content"]         = entity.Invoice_Content;
                    DrAdd["Invoice_FirmName"]        = entity.Invoice_FirmName;
                    DrAdd["Invoice_VAT_FirmName"]    = entity.Invoice_VAT_FirmName;
                    DrAdd["Invoice_VAT_Code"]        = entity.Invoice_VAT_Code;
                    DrAdd["Invoice_VAT_RegAddr"]     = entity.Invoice_VAT_RegAddr;
                    DrAdd["Invoice_VAT_RegTel"]      = entity.Invoice_VAT_RegTel;
                    DrAdd["Invoice_VAT_Bank"]        = entity.Invoice_VAT_Bank;
                    DrAdd["Invoice_VAT_BankAccount"] = entity.Invoice_VAT_BankAccount;
                    DrAdd["Invoice_VAT_Content"]     = entity.Invoice_VAT_Content;
                    DrAdd["Invoice_Address"]         = entity.Invoice_Address;
                    DrAdd["Invoice_Name"]            = entity.Invoice_Name;
                    DrAdd["Invoice_ZipCode"]         = entity.Invoice_ZipCode;
                    DrAdd["Invoice_Tel"]             = entity.Invoice_Tel;
                    DrAdd["Invoice_Status"]          = entity.Invoice_Status;
                    DrAdd["Invoice_PersonelName"]    = entity.Invoice_PersonelName;
                    DrAdd["Invoice_PersonelCard"]    = entity.Invoice_PersonelCard;
                    DrAdd["Invoice_VAT_Cert"]        = entity.Invoice_VAT_Cert;

                    DBHelper.SaveChanges(SqlAdd, DtAdd);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DtAdd.Dispose();
            }
            return(true);
        }
Example #2
0
        public virtual ContractInvoiceInfo GetContractInvoiceByContractID(int ID)
        {
            ContractInvoiceInfo entity  = null;
            SqlDataReader       RdrList = null;

            try
            {
                string SqlList;
                SqlList = "SELECT * FROM Contract_Invoice WHERE Invoice_ContractID = " + ID;
                RdrList = DBHelper.ExecuteReader(SqlList);
                if (RdrList.Read())
                {
                    entity = new ContractInvoiceInfo();

                    entity.Invoice_ID              = Tools.NullInt(RdrList["Invoice_ID"]);
                    entity.Invoice_ContractID      = Tools.NullInt(RdrList["Invoice_ContractID"]);
                    entity.Invoice_Type            = Tools.NullInt(RdrList["Invoice_Type"]);
                    entity.Invoice_Title           = Tools.NullStr(RdrList["Invoice_Title"]);
                    entity.Invoice_Content         = Tools.NullInt(RdrList["Invoice_Content"]);
                    entity.Invoice_FirmName        = Tools.NullStr(RdrList["Invoice_FirmName"]);
                    entity.Invoice_VAT_FirmName    = Tools.NullStr(RdrList["Invoice_VAT_FirmName"]);
                    entity.Invoice_VAT_Code        = Tools.NullStr(RdrList["Invoice_VAT_Code"]);
                    entity.Invoice_VAT_RegAddr     = Tools.NullStr(RdrList["Invoice_VAT_RegAddr"]);
                    entity.Invoice_VAT_RegTel      = Tools.NullStr(RdrList["Invoice_VAT_RegTel"]);
                    entity.Invoice_VAT_Bank        = Tools.NullStr(RdrList["Invoice_VAT_Bank"]);
                    entity.Invoice_VAT_BankAccount = Tools.NullStr(RdrList["Invoice_VAT_BankAccount"]);
                    entity.Invoice_VAT_Content     = Tools.NullStr(RdrList["Invoice_VAT_Content"]);
                    entity.Invoice_Address         = Tools.NullStr(RdrList["Invoice_Address"]);
                    entity.Invoice_Name            = Tools.NullStr(RdrList["Invoice_Name"]);
                    entity.Invoice_ZipCode         = Tools.NullStr(RdrList["Invoice_ZipCode"]);
                    entity.Invoice_Tel             = Tools.NullStr(RdrList["Invoice_Tel"]);
                    entity.Invoice_Status          = Tools.NullInt(RdrList["Invoice_Status"]);
                    entity.Invoice_PersonelName    = Tools.NullStr(RdrList["Invoice_PersonelName"]);
                    entity.Invoice_PersonelCard    = Tools.NullStr(RdrList["Invoice_PersonelCard"]);
                    entity.Invoice_VAT_Cert        = Tools.NullStr(RdrList["Invoice_VAT_Cert"]);
                }

                return(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RdrList != null)
                {
                    RdrList.Close();
                    RdrList = null;
                }
            }
        }
Example #3
0
 public virtual bool EditContractInvoice(ContractInvoiceInfo entity)
 {
     return(MyDAL.EditContractInvoice(entity));
 }