Exemplo 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));
        }
    }
Exemplo n.º 2
0
    public ReturnData AJAX_BE_Insert(int idRole, string name, string email, string password)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            if (IsExists(db, email))
            {
                return(ReturnData.MessageFailed("Email is already registered", null));
            }
            TBEmployee emp = new TBEmployee();
            emp.IDRole         = idRole;
            emp.Name           = name;
            emp.Email          = email;
            emp.Active         = true;
            emp.Password       = EncryptPassword(password);
            emp.DateInsert     = DateTime.Now;
            emp.DateLastUpdate = DateTime.Now;
            db.TBEmployees.InsertOnSubmit(emp);
            db.SubmitChanges();

            return(ReturnData.MessageSuccess("New employee was added", null));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
Exemplo n.º 3
0
    public dynamic Dynamic_GetAllMenu_ParentNull()
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            return(db.TBMenus.Where(x => x.IDMenuParent == null).Select(x => new
            {
                x.IDMenu,
                x.IDMenuParent,
                x.Name,
                x.Link,
                x.DateInsert,
                x.DateLastUpdate,
                x.Icon,
                AttributeValue = x.Name.Replace(" ", "_").ToLower(),
                SubMenu = Dynamic_GetDataBy_IDMenuParent(db, x.IDMenu)
            }));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 4
0
    public IEnumerable <dynamic> FE_MultiplePost_SinglePhoto_MultipleCategory(int idPage)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            var Post = db.TBPageCategory_Posts.Where(x => x.TBPost.IDPage == idPage && !x.TBPost.Deflag).Select(x => new
            {
                IDPost           = x.IDPost,
                Photo            = x.TBPost.TBPostMedias.FirstOrDefault().MediaUrl,
                Title            = x.TBPost.Post_Title,
                PageTitle        = x.TBPost.TBPage.Page_Title,
                Description      = x.TBPost.Post_Content,
                ShortDescription = x.TBPost.Post_ShortContent,
                Category         = x.TBPageCategory.Name,
                Date             = x.TBPost.DateInsert,
            }).OrderByDescending(x => x.IDPost);

            if (Post != null)
            {
                return(Post);
            }
            else
            {
                return(null);
            }
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 5
0
    public IEnumerable <dynamic> FE_GetAll_PageCategory(int idPage)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            var PageCategory          = db.TBPageCategories.Where(x => x.IDPage == idPage && !x.Deflag).OrderByDescending(x => x.IDPageCategory).AsEnumerable().Select(x => new
            {
                IDPageCategory = x.IDPageCategory,
                IDPage         = x.IDPage,
                Name           = x.Name,
                Description    = x.Description
            });

            if (PageCategory != null)
            {
                return(PageCategory);
            }
            else
            {
                return(null);
            }
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 6
0
    public IEnumerable <dynamic> Dynamic_GetAll(DataClassesDataContext db)
    {
        try
        {
            return(db.TBPosts.Where(x => !x.Deflag).AsEnumerable().Select(x => new
            {
                x.IDPost,
                x.IDPage,
                x.Post_Title,
                x.TBPage.Page_Title,
                x.Post_ShortContent,
                x.Post_Content,
                x.Deflag,
                x.Active,
                x.DateInsert,
                x.DateLastUpdate,
            }).ToArray());
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 7
0
    public dynamic Dynamic_FE_GetPost_ByIDPageCategory(DataClassesDataContext db, int idPageCategory)
    {
        try
        {
            return(db.TBPageCategory_Posts.Where(x => x.IDPageCategory == idPageCategory).AsEnumerable().Select(x => new
            {
                x.IDPost,
                x.TBPost.IDPage,
                x.TBPost.Post_Title,
                x.TBPost.Post_ShortContent,
                x.TBPost.Post_Content,
                x.TBPost.Deflag,
                x.TBPost.Active,
                x.TBPost.DateInsert,
                x.TBPost.DateLastUpdate,
                Media = x.TBPost.TBPostMedias.Where(y => y.IDPost == x.IDPost).Select(y => y.MediaUrl)
            }).FirstOrDefault());
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 8
0
    public dynamic Dynamic_GetAll(DataClassesDataContext db)
    {
        try
        {
            return(db.TBVouchers.Where(x => !x.Deflag).Select(x => new
            {
                x.IDVoucher,
                x.Name,
                x.Code,
                x.Description,
                x.VoucherType,
                x.Value,
                x.TotalAvailable,
                x.Used,
                x.MinimumAmount,
                x.StartDate,
                x.EndDate,
                x.Active
            }));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            throw;
        }
    }
Exemplo n.º 9
0
    public ReturnData AJAX_BE_Login(string email, string password)
    {
        try
        {
            using (DataClassesDataContext db = new DataClassesDataContext())
            {
                var data = db.TBCustomers.Where(x => !x.Deflag && x.Email == email && x.Password == EncryptPassword(password)).FirstOrDefault();
                if (data == null)
                {
                    return(ReturnData.MessageFailed("Username/password is incorrect", null));
                }
                else
                {
                    var token = EncryptToken(email, password);
                    HttpContext.Current.Response.Cookies.Add(new HttpCookie(System.Configuration.ConfigurationManager.AppSettings["cookieUser"].ToString(), token));
                    HttpContext.Current.Response.Cookies[System.Configuration.ConfigurationManager.AppSettings["cookieUser"].ToString()].Expires = DateTime.Now.AddMinutes(120);
                    return(ReturnData.MessageSuccess("OK", token));
                }
            }
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
Exemplo n.º 10
0
    public dynamic Dynamic_GetData_ByIDCustomer(int IDCustomer)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            return(db.TBVouchers.Where(x => !x.Deflag && x.IDCustomer == IDCustomer).Select(x => new
            {
                x.IDVoucher,
                x.Code,
                x.Description,
                x.EndDate,
                x.MinimumAmount,
                x.Name,
                x.StartDate,
                x.Value,
                x.VoucherType
            }));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 11
0
    public dynamic Dynamic_FE_GetDetail(int idVoucher)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            dynamic result            = db.TBVouchers.Where(x => !x.Deflag && x.IDVoucher == idVoucher).Select(x => new
            {
                x.IDCustomer,
                x.IDVoucher,
                x.Name,
                x.Code,
                x.Description,
                x.VoucherType,
                Value = Class_Currency.GetPriceConversionCurrency(x.Value),
                x.TotalAvailable,
                x.Used,
                MinimumAmount = Class_Currency.GetPriceConversionCurrency(x.MinimumAmount),
                x.StartDate,
                x.EndDate,
                x.Active
            }).FirstOrDefault();
            if (result == null)
            {
                return(ReturnData.MessageFailed("Data not found", null));
            }
            return(result);
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 12
0
    //public Datatable AJAX_GetTable_CustomerAddress(int iDisplayLength, int iDisplayStart, int sEcho, int iSortingCols, int iSortCol, string sSortDir, string search)
    //{
    //    try
    //    {
    //        IEnumerable<dynamic> data = Dynamic_GetAll_ByEmail();
    //        int count = data.Count();
    //        if (!string.IsNullOrEmpty(search))
    //            data = data.Where(x =>
    //                x.FirstName.ToLower().Contains(search.ToLower()) ||
    //        x.LastName.ToLower().Contains(search.ToLower()) ||
    //                x.Email.ToLower().Contains(search.ToLower())
    //                ).ToArray();
    //        List<Dictionary<string, dynamic>> resultList = new List<Dictionary<string, dynamic>>();
    //        foreach (dynamic currData in data)
    //        {
    //            Dictionary<string, dynamic> newData = new Dictionary<string, dynamic>();
    //            newData.Add("IDCustomer", currData.IDCustomer);
    //            newData.Add("Name", currData.FirstName + ' ' + currData.LastName);
    //            newData.Add("Email", currData.Email);
    //            newData.Add("Active", currData.Active);
    //            newData.Add("PhoneNumber", currData.PhoneNumber);
    //            resultList.Add(newData);
    //        }
    //        return OurClass.ParseTable(resultList, count, iDisplayLength, iDisplayStart, sEcho, iSortingCols, iSortCol, sSortDir);
    //    }
    //    catch (Exception ex)
    //    {
    //        throw;
    //    }
    //}

    public ReturnData AJAX_Insert(int idCustomer, int idCountry, int idProvince, int idCity, int idDistrict, string peoplename, string name, string address, string phone, string postalCode, string additionalInformation)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            TBAddress _newAddress     = new TBAddress
            {
                IDCustomer            = idCustomer,
                IDCountry             = idCountry,
                IDProvince            = idProvince,
                IDCity                = idCity,
                IDDistrict            = idDistrict,
                PeopleName            = peoplename,
                Name                  = name,
                Address               = address,
                Phone                 = phone,
                PostalCode            = postalCode,
                AdditionalInformation = additionalInformation,
                Active                = true,
                Deflag                = false,
                DateInsert            = DateTime.Now,
                DateLastUpdate        = DateTime.Now
            };
            db.TBAddresses.InsertOnSubmit(_newAddress);
            db.SubmitChanges();
            return(ReturnData.MessageSuccess("Address submit successfully", _newAddress.IDAddress));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
Exemplo n.º 13
0
    public dynamic Dynamic_GetDetail_ByIDAddress_OrderDetail(int idAddress)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            return(db.TBAddresses.Where(x => x.IDAddress == idAddress && !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,
                x.AdditionalInformation,
                CityName = x.TBCity.Name,
                DistrictName = x.TBDistrict.Name,
                ProvinceName = x.TBProvince.Name,
                CountryName = x.TBCountry.Name
            }).FirstOrDefault());
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 14
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);
        }
    }
Exemplo n.º 15
0
    public ReturnData AJAX_Updates(int idPost, string postTitle, string postShortContent, string postContent)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            TBPost post = db.TBPosts.Where(x => !x.Deflag && x.IDPost == idPost).FirstOrDefault();
            if (post == null)
            {
                return(ReturnData.MessageFailed("Post not found", null));
            }
            post.Post_Title        = postTitle;
            post.Post_ShortContent = postShortContent;
            post.Post_Content      = postContent;
            post.DateLastUpdate    = DateTime.Now;
            db.SubmitChanges();

            return(ReturnData.MessageSuccess("Data 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));
        }
    }
Exemplo n.º 16
0
    public ReturnData AJAX_FE_Logout(string token)
    {
        try
        {
            using (DataClassesDataContext db = new DataClassesDataContext())
            {
                if (HttpContext.Current.Request.Cookies[System.Configuration.ConfigurationManager.AppSettings["cookieUser"].ToString()].Value != token)
                {
                    return(ReturnData.MessageFailed("Invalid token!", null));
                }
                else
                {
                    HttpContext.Current.Response.Cookies[System.Configuration.ConfigurationManager.AppSettings["cookieUser"].ToString()].Expires = DateTime.Now.AddDays(-1);
                    return(ReturnData.MessageSuccess("OK", null));
                }
            }
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
Exemplo n.º 17
0
    public ReturnData AJAX_Delete_Photo(int idPostMedia)
    {
        try
        {
            using (DataClassesDataContext db = new DataClassesDataContext())
            {
                TBPostMedia _deleteData = GetDetail_Photo(db, idPostMedia);
                if (_deleteData == null)
                {
                    return(ReturnData.MessageFailed("The requested resource does not exist.", null));
                }
                string _nameBefore = _deleteData.MediaUrl;

                db.TBPostMedias.DeleteOnSubmit(_deleteData);
                db.SubmitChanges();

                OurClass.DeleteFile(_deleteData.MediaUrl, "post");
                Dictionary <string, dynamic> _result = new Dictionary <string, dynamic>();
                _result.Add("Photos", Dynamic_GetData_Photo_ByIDPost(db, _deleteData.IDPost));
                return(ReturnData.MessageSuccess(_nameBefore + " has been successfully deleted.", _result));
            }
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
Exemplo n.º 18
0
    public ReturnData AJAX_Delete(int id)
    {
        try
        {
            using (DataClassesDataContext db = new DataClassesDataContext())
            {
                TBLog_Error _deleteData = db.TBLog_Errors.Where(x => x.ID == id).FirstOrDefault();
                if (_deleteData == null)
                {
                    return(ReturnData.MessageFailed("The requested resource does not exist.", null));
                }

                db.TBLog_Errors.DeleteOnSubmit(_deleteData);
                db.SubmitChanges();
                return(ReturnData.MessageSuccess("Log has been successfully deleted.", null));
            }
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
Exemplo n.º 19
0
    public dynamic Dynamic_GetDetail(DataClassesDataContext db, int idPost)
    {
        try
        {
            return(db.TBPosts.Where(x => x.IDPost == idPost).AsEnumerable().Select(x => new
            {
                x.IDPost,
                x.IDPage,
                x.Post_Title,
                x.Post_ShortContent,
                x.Post_Content,
                x.Deflag,
                x.Active,
                x.DateInsert,
                x.DateLastUpdate
            }).FirstOrDefault());
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 20
0
    public ReturnData AJAX_Delete(int idAttribute)
    {
        try
        {
            using (DataClassesDataContext db = new DataClassesDataContext())
            {
                TBAttribute _deleteData = GetDetail(db, idAttribute);
                if (_deleteData == null)
                {
                    return(ReturnData.MessageFailed("The requested resource does not exist.", null));
                }

                string _nameBefore = _deleteData.Name;
                _deleteData.Deflag         = true;
                _deleteData.DateLastUpdate = DateTime.Now;
                db.SubmitChanges();
                if (_deleteData != null)
                {
                    return(ReturnData.MessageSuccess(_nameBefore + " has been successfully deleted.", null));
                }
                return(ReturnData.MessageFailed(_nameBefore + " failed to delete.", null));
            }
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
Exemplo n.º 21
0
    public IEnumerable <dynamic> Dynamic_GetData_Photo_ByIDPost(DataClassesDataContext db, int idPost)
    {
        try
        {
            return(Dynamic_Func_GetData_ByIDPost_Photo(db, idPost).AsEnumerable().Select(x => new
            {
                x.IDPostMedia,
                x.IDPost,
                x.Title,
                x.Description,
                Preview = OurClass.ImageExists(x.MediaUrl, "post") ? x.MediaUrl : "noimage.jpg",
                x.Active,
                x.Deflag,
                x.DateInsert,
                x.DateLastUpdate
            }).ToArray());
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 22
0
    public dynamic Dynamic_GetDetail(int idCurrency)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            return(db.TBCurrencies.Where(x => x.IDCurrency == idCurrency).AsEnumerable().Select(x => new
            {
                x.IDCurrency,
                x.Name,
                x.ISOCode,
                x.ISOCodeNumeric,
                x.Sign,
                x.blank,
                x.Format,
                x.Decimal,
                x.ConversionRate,
                x.IsDefault,
                x.Active,
                x.Deflag,
                x.DateInsert,
                x.DateLastUpdate
            }).FirstOrDefault());
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 23
0
    public IEnumerable <TBPostMedia> FE_DetailPost_AllPhoto(int idPost)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            var Post = db.TBPageCategory_Posts.Where(x => x.IDPost == idPost && !x.TBPost.Deflag).OrderByDescending(x => x.IDPost).FirstOrDefault();

            var Media = db.TBPostMedias.Where(x => x.IDPost == Post.IDPost).AsEnumerable();

            if (Post != null)
            {
                return(Media);
            }
            else
            {
                return(null);
            }
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 24
0
    public IEnumerable <dynamic> Dynamic_GetAll(DataClassesDataContext db)
    {
        try
        {
            return(db.TBCurrencies.Where(x => !x.Deflag).AsEnumerable().Select(x => new
            {
                x.IDCurrency,
                x.Name,
                x.ISOCode,
                x.ISOCodeNumeric,
                x.Sign,
                x.blank,
                x.Format,
                x.Decimal,
                x.ConversionRate,
                x.IsDefault,
                x.Active,
                x.Deflag,
                x.DateInsert,
                x.DateLastUpdate
            }).ToArray());
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 25
0
    public ReturnData AJAX_GetAll_ByIDRole(int idRole)
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            dynamic data = db.TBRole_OrderStatus.Where(x => x.IDRole == idRole && !x.TBOrder_Status.Deflag).Select(x => new
            {
                Name          = x.TBOrder_Status.Name,
                IDOrderStatus = x.TBOrder_Status.IDOrderStatus,
                Color         = x.TBOrder_Status.Color,
                Delivery      = x.TBOrder_Status.Delivery,
                Logable       = x.TBOrder_Status.Logable,
                Paid          = x.TBOrder_Status.Paid,
                SendEmail     = x.TBOrder_Status.SendEmail,
                Shipped       = x.TBOrder_Status.Shipped
            });
            return(ReturnData.MessageSuccess("OK", data));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
Exemplo n.º 26
0
    public ReturnData AJAX_BE_Updates(int idCurrency, string name, string isoCode, string isoCodeNumeric, string sign, decimal conversionRate)
    {
        try
        {
            DataClassesDataContext db       = new DataClassesDataContext();
            TBCurrency             currency = db.TBCurrencies.Where(x => !x.Deflag && x.IDCurrency == idCurrency).FirstOrDefault();
            if (currency == null)
            {
                return(ReturnData.MessageFailed("Page not found", null));
            }
            currency.Name           = name;
            currency.ISOCode        = isoCode;
            currency.ISOCodeNumeric = isoCodeNumeric;
            currency.Sign           = sign;
            currency.ConversionRate = conversionRate;
            currency.DateLastUpdate = DateTime.Now;
            db.SubmitChanges();

            return(ReturnData.MessageSuccess("Data 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));
        }
    }
Exemplo n.º 27
0
    public dynamic Init_Admin()
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            if (IsExists(db, "*****@*****.**"))
            {
                return(ReturnData.MessageFailed("Email is already registered", null));
            }
            TBEmployee emp = new TBEmployee();
            emp.IDRole         = 1;
            emp.Name           = "Admin WIT";
            emp.Email          = "*****@*****.**";
            emp.Active         = true;
            emp.Password       = EncryptPassword("asdasd");
            emp.DateInsert     = DateTime.Now;
            emp.DateLastUpdate = DateTime.Now;
            db.TBEmployees.InsertOnSubmit(emp);
            db.SubmitChanges();

            return(ReturnData.MessageSuccess("New employee was added", null));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
Exemplo n.º 28
0
    public ReturnData AJAX_Updates(int idPostMedia, string title, string description)
    {
        try
        {
            DataClassesDataContext db        = new DataClassesDataContext();
            TBPostMedia            postMedia = db.TBPostMedias.Where(x => !x.Deflag && x.IDPostMedia == idPostMedia).FirstOrDefault();
            if (postMedia == null)
            {
                return(ReturnData.MessageFailed("Page Media not found", null));
            }
            postMedia.Title          = title;
            postMedia.Description    = description;
            postMedia.DateLastUpdate = DateTime.Now;
            db.SubmitChanges();

            return(ReturnData.MessageSuccess("Data 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));
        }
    }
Exemplo n.º 29
0
    public dynamic Dynamic_GetData_AvailableQuantity()
    {
        try
        {
            DataClassesDataContext db = new DataClassesDataContext();
            return(db.TBProduct_Combinations.Where(x => !x.Deflag && x.Quantity > 0).Select(x => new
            {
                x.IDProduct_Combination,
                ProductName = x.TBProduct.Name,
                CombinationName = x.Name,
                x.Discount,
                x.Price,
                x.Quantity,
                x.Weight,
                x.ReferenceCode,
                Active = x.TBProduct.Active
            }));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(null);
        }
    }
Exemplo n.º 30
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);
        }
    }