public bool ProductOut(int iShoeId, out string sErrMessage) { try { sErrMessage = ""; dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); var products = from rsl in dbConection.ProductDetails where rsl.Id.Equals(iShoeId) select rsl; foreach (SoftBottinBD.ProductDetail item in products) { item.QuantityExisting = 0; dbConection.SubmitChanges(); } return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; return(false); } }
public bool AddEmailNewUser(string sEmail, out string sErrMessage) { try { dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); SoftBottinBD.User niUser = new SoftBottinBD.User { Email = sEmail }; dbConection.Users.InsertOnSubmit(niUser); try { dbConection.SubmitChanges(); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; return(false); } sErrMessage = ""; return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; return(false); } }
public bool EditColor(int iId, string sDescription, string sRGB, out string sErrMessage) { try { sErrMessage = ""; dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); SoftBottinBD.Color niColors = new SoftBottinBD.Color { Id = iId, Description = sDescription, RGB = sRGB }; var query = from clr in dbConection.Colors where clr.Id.Equals(iId) select clr; foreach (SoftBottinBD.Color clr in query) { clr.Description = niColors.Description; clr.RGB = niColors.RGB; } dbConection.SubmitChanges(); return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; return(false); } }
public bool EditShoeType(int iId, string sName, string sDescription, string sRef, out string sErrMessage) { try { sErrMessage = ""; dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); SoftBottinBD.ProductType niProductType = new SoftBottinBD.ProductType { Id = iId, Name = sName, Description = sDescription, Ref = sRef }; var query = from pty in dbConection.ProductTypes where pty.Id.Equals(iId) select pty; foreach (SoftBottinBD.ProductType pty in query) { pty.Name = niProductType.Name; pty.Description = niProductType.Description; pty.Ref = niProductType.Ref; } dbConection.SubmitChanges(); return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; return(false); } }
public bool AddImageShoe(string sName, string sType, byte[] btFileByte, int iProductId, bool bIsPrincipal, out string sErrMessage) { try { sErrMessage = ""; dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); SoftBottinBD.Image niImage = new SoftBottinBD.Image { Description = sName, Name = sName, Type = sType, Image1 = btFileByte, IdProduct = iProductId, isPrincipal = bIsPrincipal }; dbConection.Images.InsertOnSubmit(niImage); dbConection.SubmitChanges(); return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; return(false); } }
public bool AddShoeDetail(int iIdShoe, int iIdColor, int iSize, int iQuantity, int iQuantityExisting, int iQuantitySold, out int iIdDetailInsert, out string sErrMessage) { try { sErrMessage = ""; dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); SoftBottinBD.ProductDetail niProductDetail = new SoftBottinBD.ProductDetail { IdProduct = iIdShoe, IdColor = iIdColor, Size = iSize, Quantity = iQuantity, QuantityExisting = iQuantityExisting, QuantitySold = iQuantitySold }; dbConection.ProductDetails.InsertOnSubmit(niProductDetail); dbConection.SubmitChanges(); iIdDetailInsert = niProductDetail.Id; return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; iIdDetailInsert = -1; return(false); } }
public bool AddShoe(string sName, string sDescription, string sRef, int iQuantityExisting, int iQuantitySold, int iPurchasePrice, int iSalePrice, int iShoeType, out int iIdInsert, out string sErrMessage) { try { sErrMessage = ""; dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); SoftBottinBD.Product niProduct = new SoftBottinBD.Product { Name = sName, Description = sDescription, QuantityExisting = iQuantityExisting, QuantitySold = iQuantitySold, PurchasePrice = iPurchasePrice, SalePrice = iSalePrice, Type = iShoeType }; dbConection.Products.InsertOnSubmit(niProduct); dbConection.SubmitChanges(); iIdInsert = niProduct.Id; return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; iIdInsert = -1; return(false); } }
public bool SignIn(string sFirstName, string sLastName, string sEmail, string sPassword, out string sErrMessage) { try { sErrMessage = ""; dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); SoftBottinBD.User niUser = new SoftBottinBD.User { FirstName = sFirstName, LastName = sLastName, Email = sEmail }; dbConection.Users.InsertOnSubmit(niUser); dbConection.SubmitChanges(); SoftBottinBD.UserAccount niUserAccount = new SoftBottinBD.UserAccount { UserName = sEmail, Password = sPassword, UserId = niUser.Id, RoleId = 2 }; dbConection.UserAccounts.InsertOnSubmit(niUserAccount); dbConection.SubmitChanges(); return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; return(false); } }
public bool AddColor(string sDescription, string sRGB, out string sErrMessage) { try { sErrMessage = ""; dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); SoftBottinBD.Color niColor = new SoftBottinBD.Color { Description = sDescription, RGB = sRGB }; dbConection.Colors.InsertOnSubmit(niColor); dbConection.SubmitChanges(); return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; return(false); } }
public bool DeleteColor(int iId, out string sErrMessage) { try { sErrMessage = ""; dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); var query = from clr in dbConection.Colors where clr.Id.Equals(iId) select clr; foreach (var detail in query) { dbConection.Colors.DeleteOnSubmit(detail); } dbConection.SubmitChanges(); return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; return(false); } }
public bool AddShoeType(string sName, string sDescription, string sRef, out string sErrMessage) { try { sErrMessage = ""; dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext(); SoftBottinBD.ProductType niProductType = new SoftBottinBD.ProductType { Name = sName, Description = sDescription, Ref = sRef }; dbConection.ProductTypes.InsertOnSubmit(niProductType); dbConection.SubmitChanges(); return(true); } catch (Exception ex) { cUtilities.WriteLog(ex.Message, out sErrMsj); sErrMessage = ex.Message; return(false); } }