Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }