Esempio n. 1
0
            /// <summary>
            /// Insert Prodcuto File Manager Information
            /// </summary>
            /// <param name="data">Product FileManager INformaation</param>
            /// <returns>Product File Manager ID</returns>
            public static Tuple <ErrorObject, int> ProductFileManager(tblProductFileManager data)
            {
                erros = new ErrorObject();
                try
                {
                    using (HSCMEntities db = new HSCMEntities())
                    {
                        int propertyFind = db.tblProductFileManager.Count();
                        if (propertyFind > 0)
                        {
                            data.id = db.tblProductFileManager.Max(s => s.id);
                        }
                        else
                        {
                            data.id = 1;
                        }
                        db.tblProductFileManager.Add(data);
                        result = db.SaveChanges();

                        if (result > 0)
                        {
                            return(new Tuple <ErrorObject, int>(erros.IfError(false), data.id));
                        }
                        else
                        {
                            return(new Tuple <ErrorObject, int>(erros.IfError(false), result));
                        }
                    }
                }
                catch (Exception ex)
                {
                    erros.InfoError(ex);
                    return(new Tuple <ErrorObject, int>(erros, 0));
                }
            }
Esempio n. 2
0
            /// <summary>
            /// Insert Product Type Information
            /// </summary>
            /// <param name="data">Product Type Information</param>
            /// <returns>Number Affected Row</returns>
            public static Tuple <ErrorObject, string> ProductType(tblProductType data)
            {
                erros = new ErrorObject();
                try
                {
                    using (HSCMEntities db = new HSCMEntities())
                    {
                        int propertyFind = db.tblProductType.Count();
                        if (propertyFind > 0)
                        {
                            data.id = db.tblCellarArea.Max(s => s.id);
                        }
                        else
                        {
                            data.id = 1;
                        }
                        db.tblProductType.Add(data);
                        result  = db.SaveChanges();
                        Message = "Affected Row: " + result.ToString();

                        return(new Tuple <ErrorObject, string>(erros.IfError(false), Message));
                    }
                }
                catch (Exception ex)
                {
                    erros.InfoError(ex);
                    return(new Tuple <ErrorObject, string>(erros, String.Empty));
                }
            }
Esempio n. 3
0
            /// <summary>
            /// Update Users Information
            /// </summary>
            /// <param name="data">Users Information</param>
            /// <returns>Number Affected Row</returns>
            public static Tuple <ErrorObject, string> Users(tblUser data)
            {
                erros = new ErrorObject();
                try
                {
                    using (HSCMEntities db = new HSCMEntities())
                    {
                        var row = db.tblUser.Single(p => p.id == data.id);
                        if (!String.IsNullOrEmpty(data.password))
                        {
                            row.password = data.password;
                        }
                        row.user       = data.user;
                        row.upDateDate = DateTime.Now;
                        result         = db.SaveChanges();

                        Message     = "Affected Row: " + result.ToString();
                        erros.Error = false;
                        return(new Tuple <ErrorObject, string>(erros.IfError(false), Message));
                    }
                }
                catch (Exception ex)
                {
                    erros.InfoError(ex);
                    return(new Tuple <ErrorObject, string>(erros, String.Empty));
                }
            }
Esempio n. 4
0
 /// <summary>
 /// Insert TransactionType Information
 /// </summary>
 /// <param name="data">Transaction Information</param>
 /// <returns>Number Affected Row</returns>
 public static Tuple <ErrorObject, int> Transaction(tblTransaction data)
 {
     erros = new ErrorObject();
     try
     {
         using (HSCMEntities db = new HSCMEntities())
         {
             int propertyFind = db.tblTransaction.Count();
             if (propertyFind > 0)
             {
                 data.id = db.tblTransaction.Max(s => s.id);
             }
             else
             {
                 data.id = 1;
             }
             db.tblTransaction.Add(data);
             result  = db.SaveChanges();
             Message = "Affected Row: " + result.ToString();
             if (result > 0)
             {
                 return(new Tuple <ErrorObject, int>(erros.IfError(false), data.id));
             }
             else
             {
                 return(new Tuple <ErrorObject, int>(erros.IfError(false), result));
             }
         }
     }
     catch (Exception ex)
     {
         erros.InfoError(ex);
         return(new Tuple <ErrorObject, int>(erros, 0));
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Update Cellar Information
 /// </summary>
 /// <param name="data">Cellar Information</param>
 /// <returns>Number Affected Row</returns>
 public static Tuple <ErrorObject, string> Cellar(tblCellar data)
 {
     erros = new ErrorObject();
     try
     {
         using (HSCMEntities db = new HSCMEntities())
         {
             db.Entry(data).State = EntityState.Modified;
             result  = db.SaveChanges();
             Message = "Affected Row: " + result.ToString();
             return(new Tuple <ErrorObject, string>(erros.IfError(false), Message));
         }
     }
     catch (Exception ex)
     {
         erros.InfoError(ex);
         return(new Tuple <ErrorObject, string>(erros, String.Empty));
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Update Cellar Amount TO Specific Cellar ID
 /// </summary>
 /// <param name="CellarID">Cellar ID</param>
 /// <param name="CellarAmount">Cellar Amount</param>
 /// <returns>Number Affected Row</returns>
 public static Tuple <ErrorObject, string> CellarAmoun(int CellarID, int CellarAmount)
 {
     erros = new ErrorObject();
     try
     {
         using (HSCMEntities db = new HSCMEntities())
         {
             var row = db.tblCellar.Single(p => p.id == CellarID);
             row.amount     = CellarAmount;
             row.upDateDate = DateTime.Now;
             result         = db.SaveChanges();
             Message        = "Affected Row: " + result.ToString();
             return(new Tuple <ErrorObject, string>(erros.IfError(false), Message));
         }
     }
     catch (Exception ex)
     {
         erros.InfoError(ex);
         return(new Tuple <ErrorObject, string>(erros, String.Empty));
     }
 }
Esempio n. 7
0
            /// <summary>
            /// Update State Fields To Specific CellarAreaID ID
            /// </summary>
            /// <param name="ProductTypeID">Cellar Area ID</param>
            /// <param name="state">Active Or Disable</param>
            /// <returns>ID Department ID</returns>
            public static Tuple <ErrorObject, string> ProductTypeDisable(int ProductTypeID, string state)
            {
                erros = new ErrorObject();
                try
                {
                    using (HSCMEntities db = new HSCMEntities())
                    {
                        var row = db.tblProductType.Single(p => p.id == ProductTypeID);
                        row.state      = state;
                        row.deleteDate = DateTime.Now;
                        result         = db.SaveChanges();

                        Message     = "Affected Row: " + result.ToString();
                        erros.Error = false;
                        return(new Tuple <ErrorObject, string>(erros.IfError(false), Message));
                    }
                }
                catch (Exception ex)
                {
                    erros.InfoError(ex);
                    return(new Tuple <ErrorObject, string>(erros, String.Empty));
                }
            }