Esempio n. 1
0
    public ReturnData AJAX_Update(int idAddress, int idCustomer, int idCountry, int idProvince, int idCity, int idDistrict, string peopleName, string name, string address, string phone, string postalCode, string additionalInformation, bool active)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            TBAddress data            = db.TBAddresses.Where(x => !x.Deflag && x.IDCustomer == idCustomer && x.IDAddress == idAddress).FirstOrDefault();
            if (data == null)
            {
                return(ReturnData.MessageFailed("Data not found", null));
            }
            data.IDCountry             = idCountry;
            data.IDProvince            = idProvince;
            data.IDCity                = idCity;
            data.IDDistrict            = idDistrict;
            data.Name                  = name;
            data.Address               = address;
            data.Phone                 = phone;
            data.PeopleName            = peopleName;
            data.PostalCode            = postalCode;
            data.AdditionalInformation = additionalInformation;
            data.Active                = active;
            data.DateLastUpdate        = DateTime.Now;

            db.SubmitChanges();
            return(ReturnData.MessageSuccess("Address has been updated successfully", null));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
Esempio n. 2
0
    public dynamic Dynamic_GetAll_ByIDCustomer(int idCustomer)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            return(db.TBAddresses.Where(x => !x.Deflag && x.IDCustomer == idCustomer && !x.TBCustomer.Deflag).Select(x => new
            {
                x.IDCustomer,
                x.IDAddress,
                x.Address,
                x.IDCity,
                x.IDCountry,
                x.IDDistrict,
                x.IDProvince,
                x.Name,
                x.Phone,
                x.PostalCode,
                x.PeopleName,
                CityName = x.TBCity.Name,
                DistrictName = x.TBDistrict.Name,
                ProvinceName = x.TBProvince.Name,
                CountryName = x.TBCountry.Name
            }));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Esempio n. 3
0
    public dynamic Dynamic_GetDetail_ByIDPaymentConfirmation(int idPaymentConfirmation)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            return(db.TBPayment_Confirmations.Where(x => x.IDPaymentConfirmation == idPaymentConfirmation).Select(x => new
            {
                x.IDPaymentConfirmation,
                x.Image,
                x.Name,
                x.Email,
                x.Amount,
                x.Bank,
                x.Notes,
                x.PaymentDate,
                x.PhoneNumber,
                x.ReferenceNumber,
            }).FirstOrDefault());
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }