// メッセージ取得
 public string GetMessage(int no)
 {
     using (var db = new SalesManagement_DevContext())
     {
         return(db.Messagess.Single(m => m.MessagesNo == no).Message);
     }
 }
Esempio n. 2
0
 // データ追加
 // in   : T_ChumonDetailデータ
 public string PostT_ChumonDetail(T_ChumonDetail regChumonDetail)
 {
     using (var db1 = new SalesManagement_DevContext())
     {
         db1.T_ChumonDetails.Add(regChumonDetail);
         db1.Entry(regChumonDetail).State = EntityState.Added;
         db1.SaveChanges();
     }
     return(string.Empty);
 }
        // データ更新
        // in   : M_Productデータ
        // out  : エラーメッセージ
        public string PutProduct(M_Product regProduct)
        {
            using (var db = new SalesManagement_DevContext())
            {
                M_Product product;
                try
                {
                    product = db.M_Products.Single(x => x.PrID == regProduct.PrID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }
                product.PrID          = regProduct.PrID;
                product.MaID          = regProduct.MaID;
                product.PrName        = regProduct.PrName;
                product.Price         = regProduct.Price;
                product.PrJCode       = regProduct.PrJCode;
                product.PrSafetyStock = regProduct.PrSafetyStock;
                product.ScID          = regProduct.ScID;
                product.PrModelNumber = regProduct.PrModelNumber;
                product.PrColor       = regProduct.PrColor;
                product.PrReleaseDate = regProduct.PrReleaseDate;
                product.PrFlag        = regProduct.PrFlag;
                product.PrMemo        = regProduct.PrMemo;
                //Timestamp = item.Timestamp,
                //LogData = item.LogData,
                db.Entry(product).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Product",
                    Command          = "Put",
                    //Data = ProductLogData(regProduct),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
        // ***** メソッド定義

        // データ取得
        // in  : shopId
        // out : shopデータ
        public T_Stock GetStock(int StID)
        {
            try
            {
                using (var db = new SalesManagement_DevContext()) return(db.T_Stocks.Single(m => m.StID == StID));
            }
            catch
            {
                return(null);
            }
        }
 // メッセージ追加
 public void PostMessage(List <Messages> messagess)
 {
     using (var db = new SalesManagement_DevContext())
     {
         foreach (Messages message in messagess)
         {
             db.Messagess.Add(message);
         }
         db.SaveChanges();
     }
 }
Esempio n. 6
0
        // ***** メソッド定義

        // データ取得
        // in  : shopId
        // out : shopデータ
        public T_Chumon GetChumon(int ChID)
        {
            try
            {
                using (var db = new SalesManagement_DevContext()) return(db.T_Chumons.Single(m => m.ChID == ChID));
            }
            catch
            {
                return(null);
                // throw new Exception(Messages.errorNotFoundProduct);
            }
        }
Esempio n. 7
0
        // ***** メソッド定義

        // データ取得
        // in  : ArID
        // out : arrivalデータ
        public T_Arrival GetArrival(int ArID)
        {
            try
            {
                using (var db = new SalesManagement_DevContext()) return(db.T_Arrivals.Single(m => m.ArID == ArID));
            }
            catch
            {
                return(null);
                // throw new Exception(Messages.errorNotFoundProduct);
            }
        }
        // ***** メソッド定義

        // データ取得
        // in  : shopId
        // out : shopデータ
        public T_Syukko GetSyukko(int SyID)
        {
            try
            {
                using (var db = new SalesManagement_DevContext()) return(db.T_Syukkos.Single(m => m.SyID == SyID));
            }
            catch
            {
                return(null);
                // throw new Exception(Messages.errorNotFoundProduct);
            }
        }
Esempio n. 9
0
        // ***** メソッド定義

        // データ取得
        // in  : shopId
        // out : shopデータ
        public T_Warehousing GetWarehousing(int WaID)
        {
            try
            {
                using (var db = new SalesManagement_DevContext()) return(db.T_Warehousings.Single(m => m.WaID == WaID));
            }
            catch
            {
                return(null);
                // throw new Exception(Messages.errorNotFoundProduct);
            }
        }
Esempio n. 10
0
        // ***** メソッド定義

        // データ取得
        // in  : hattyuID
        // out : hattyuデータ
        public T_Hattyu GetHattyu(int HaID)
        {
            try
            {
                using (var db = new SalesManagement_DevContext()) return(db.T_Hattyus.Single(m => m.HaID == HaID));
            }
            catch
            {
                return(null);
                // throw new Exception(Messages.errorNotFoundProduct);
            }
        }
        // ***** メソッド定義

        // データ取得
        // in  : shopId
        // out : shopデータ
        public M_Product GetProduct(int PrID)
        {
            try
            {
                using (var db = new SalesManagement_DevContext()) return(db.M_Products.Single(m => m.PrID == PrID));
            }
            catch
            {
                return(null);
                // throw new Exception(Messages.errorNotFoundProduct);
            }
        }
Esempio n. 12
0
        // ***** メソッド定義

        // データ取得
        // in  : shopId
        // out : shopデータ
        public T_Order GetOrder(int OrID)
        {
            try
            {
                using (var db = new SalesManagement_DevContext()) return(db.T_Orders.Single(m => m.OrID == OrID));
            }
            catch
            {
                return(null);
                // throw new Exception(Messages.errorNotFoundProduct);
            }
        }
        // データ更新
        // in   : M_Syukkoデータ
        // out  : エラーメッセージ
        public string PutSyukko(T_Syukko regSyukko)
        {
            using (var db = new SalesManagement_DevContext())
            {
                T_Syukko syukko
                ;
                try
                {
                    syukko = db.T_Syukkos.Single(x => x.SyID == regSyukko.SyID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }
                syukko.SyID        = regSyukko.SyID;
                syukko.SoID        = regSyukko.SoID;
                syukko.EmID        = regSyukko.EmID;
                syukko.ClID        = regSyukko.ClID;
                syukko.OrID        = regSyukko.OrID;
                syukko.SyDate      = regSyukko.SyDate;
                syukko.SyStateFlag = regSyukko.SyStateFlag;
                syukko.SyFlag      = regSyukko.SyFlag;
                syukko.SyHidden    = regSyukko.SyHidden;
                //Timestamp = item.Timestamp,
                //LogData = item.LogData,
                db.Entry(syukko).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Syukko",
                    Command          = "Syu",
                    //Data = ProductLogData(regChumon),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
Esempio n. 14
0
        // データ更新
        // in   : T_Orderデータ
        // out  : エラーメッセージ
        public string PutOrder(T_Order regOrder)
        {
            using (var db = new SalesManagement_DevContext())
            {
                T_Order order;
                try
                {
                    order = db.T_Orders.Single(x => x.OrID == regOrder.OrID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }
                order.OrID        = regOrder.OrID;
                order.SoID        = regOrder.SoID;
                order.EmID        = regOrder.EmID;
                order.ClID        = regOrder.ClID;
                order.ClCharge    = regOrder.ClCharge;
                order.OrDate      = regOrder.OrDate;
                order.OrStateFlag = regOrder.OrStateFlag;
                order.OrFlag      = regOrder.OrFlag;
                order.OrHidden    = regOrder.OrHidden;
                //Timestamp = item.Timestamp,
                //LogData = item.LogData,
                db.Entry(order).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Order",
                    Command          = "Put",
                    //Data = ProductLogData(regProduct),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
        // データ更新
        // in   : M_Clientデータ
        // out  : エラーメッセージ
        public string PutClient(M_Client regClient)
        {
            using (var db = new SalesManagement_DevContext())
            {
                M_Client client;
                try
                {
                    client = db.M_Clients.Single(x => x.ClID == regClient.ClID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }
                client.ClID      = regClient.ClID;
                client.SoID      = regClient.SoID;
                client.ClName    = regClient.ClName;
                client.ClAddress = regClient.ClAddress;
                client.ClPhone   = regClient.ClPhone;
                client.ClPostal  = regClient.ClPostal;
                client.ClFAX     = regClient.ClFAX;
                client.ClFlag    = regClient.ClFlag;
                client.ClHidden  = regClient.ClHidden;

                db.Entry(client).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Client",
                    Command          = "Put",
                    //Data = ProductLogData(regClient),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
Esempio n. 16
0
        // データ更新
        // in   : T_Arrivalデータ
        // out  : エラーメッセージ
        public string PutArrival(T_Arrival regArrival)
        {
            using (var db = new SalesManagement_DevContext())
            {
                T_Arrival arrival;
                try
                {
                    arrival = db.T_Arrivals.Single(x => x.ArID == regArrival.ArID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }
                arrival.ArID     = regArrival.ArID;
                arrival.SoID     = regArrival.SoID;
                arrival.EmID     = regArrival.EmID;
                arrival.ClID     = regArrival.ClID;
                arrival.OrID     = regArrival.OrID;
                arrival.ArDate   = regArrival.ArDate;
                arrival.Armemo   = regArrival.Armemo;
                arrival.ArHidden = regArrival.ArHidden;

                db.Entry(arrival).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Arrival",
                    Command          = "Put",
                    //Data = ArrivalLogData(regArrival),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
        // ***** メッセージ関係

        // メッセージチェック
        // out      true  : メッセージ無
        //          false : メッセージ有
        public bool CheckMessage()
        {
            using (var db = new SalesManagement_DevContext())
            {
                if (db.Messagess.Count() == 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        // データ更新
        // in   : T_Saleデータ
        // out  : エラーメッセージ
        public string PutSale(T_Sale regSale)
        {
            using (var db = new SalesManagement_DevContext())
            {
                T_Sale sale;
                try
                {
                    sale = db.T_Sales.Single(x => x.SaID == regSale.SaID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }
                sale.SaID     = regSale.SaID;
                sale.ClID     = regSale.ClID;
                sale.SoID     = regSale.SoID;
                sale.EmID     = regSale.EmID;
                sale.OrID     = regSale.OrID;
                sale.SaDate   = regSale.SaDate;
                sale.SaFlag   = regSale.SaFlag;
                sale.SaHidden = regSale.SaHidden;

                db.Entry(sale).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Sale",
                    Command          = "Put",
                    //Data = ProductLogData(regClient),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
Esempio n. 19
0
        // データ更新
        // in   : M_Chumonデータ
        // out  : エラーメッセージ
        public string PutWarehousing(T_Warehousing regWarehousing)
        {
            using (var db = new SalesManagement_DevContext())
            {
                T_Warehousing warehousing;
                try
                {
                    warehousing = db.T_Warehousings.Single(x => x.WaID == regWarehousing.WaID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }
                warehousing.WaID        = regWarehousing.WaID;
                warehousing.HaID        = regWarehousing.HaID;
                warehousing.EmID        = regWarehousing.EmID;
                warehousing.WaDate      = regWarehousing.WaDate;
                warehousing.WaShelfFlag = regWarehousing.WaShelfFlag;
                warehousing.WaFlag      = regWarehousing.WaFlag;
                warehousing.WaHidden    = regWarehousing.WaHidden;
                //Timestamp = item.Timestamp,
                //LogData = item.LogData,
                db.Entry(warehousing).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Warehousing",
                    Command          = "War",
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
        // データ更新
        // in   : M_Employeeデータ
        // out  : エラーメッセージ
        public string PutEmployee(M_Employee regEmployee)
        {
            using (var db = new SalesManagement_DevContext())
            {
                M_Employee employee;
                try
                {
                    employee = db.M_Employees.Single(x => x.EmID == regEmployee.EmID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }
                employee.EmID       = employee.EmID;
                employee.EmName     = employee.EmName;
                employee.SoID       = employee.SoID;
                employee.PoID       = employee.PoID;
                employee.EmHiredate = employee.EmHiredate;
                employee.EmPhone    = employee.EmPhone;
                employee.EmHidden   = employee.EmHidden;

                db.Entry(employee).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Employee",
                    Command          = "Put",
                    //Data = EmployeeLogData(regEmployee),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
        // 表示データ取得(始点・終点指定)
        // in   startRec : 配列抜出の始点
        //      endRec   : 配列抜出の終点


        public IEnumerable <T_DispStock> GetDispStock()
        {
            using (var db = new SalesManagement_DevContext())
            {
                List <T_DispStock> dispStock = new List <T_DispStock>();
                //foreach (T_Stock stock in db.T_Stocks)
                //{
                //    string maker;
                //    try
                //    {
                //        maker = (stock.StID != -1) ? db.T_Stocks.Single(m => m.StID == stock.StID).ChHidden : string.Empty;

                //        // 無効表示
                //        if (db.T_Stocks.Single(m => m.StID == stock.StID).StFlag != 0) maker = "[" + stock + "]";
                //    }
                //    catch
                //    {
                //        maker = string.Empty;
                //    }



                //    dispStock.Add(new T_DispStock()
                //    {
                //        StID = stock.StID,
                //        PrID = stock.PrID,
                //        StQuantity = stock.StQuantity,
                //        StFlag = stock.StFlag
                //        //Timestamp = item.Timestamp,
                //        //LogData = item.LogData,
                //    });
                //}
                // ソータブルリスト作成
                SortableBindingList <T_DispStock> sortableDispStock = new SortableBindingList <T_DispStock>(dispStock);
                //// ログ出力
                //var operationLog = new OperationLog()
                //{
                //    EventRaisingTime = DateTime.Now,
                //    Operator = _logonUser,
                //    Table = "Product",
                //    Command = "GetAll",
                //    Data = string.Empty,
                //    Comments = string.Empty
                //};
                //StaticCommon.PostOperationLog(operationLog);

                return(sortableDispStock);
            }
        }
        // データ更新
        // in   : M_ShipmentDetailデータ
        // out  : エラーメッセージ
        public string PutShipmentDetail(T_ShipmentDetail regShipmentDetail)
        {
            using (var db = new SalesManagement_DevContext())
            {
                T_ShipmentDetail shipmentDetail;
                try
                {
                    shipmentDetail = db.T_ShipmentDetails.Single(x => x.ShDetailID == regShipmentDetail.ShDetailID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }

                shipmentDetail.ShDetailID  = regShipmentDetail.ShDetailID;
                shipmentDetail.ShID        = regShipmentDetail.ShID;
                shipmentDetail.PrID        = regShipmentDetail.PrID;
                shipmentDetail.ShDquantity = regShipmentDetail.ShDquantity;
                //Timestamp = item.Timestamp,
                //LogData = item.LogData,
                db.Entry(shipmentDetail).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Shipment",
                    Command          = "Shi",
                    //Data = ProductLogData(regShipment),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
Esempio n. 23
0
        // データ更新
        // in   : T_Hattyuデータ
        // out  : エラーメッセージ
        public string PutHattyu(T_Hattyu regHattyu)
        {
            using (var db = new SalesManagement_DevContext())
            {
                T_Hattyu hattyu;
                try
                {
                    hattyu = db.T_Hattyus.Single(x => x.HaID == regHattyu.HaID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }
                hattyu.HaID     = regHattyu.HaID;
                hattyu.MaID     = regHattyu.MaID;
                hattyu.EmID     = regHattyu.EmID;
                hattyu.HaDate   = regHattyu.HaDate;
                hattyu.Hamemo   = regHattyu.Hamemo;
                hattyu.HaHidden = regHattyu.HaHidden;

                db.Entry(hattyu).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Hattyu",
                    Command          = "Put",
                    //Data = HattyuLogData(regHattyu),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
        // データ更新(注文)
        // in   : M_Chumonデータ
        // out  : エラーメッセージ
        public string PutStockCh(T_Stock regStock)
        {
            using (var db = new SalesManagement_DevContext())
            {
                T_Stock stock;
                try
                {
                    stock = db.T_Stocks.Single(x => x.StID == regStock.StID);
                }
                catch
                {
                    // throw new Exception(Messages.errorNotFoundItem, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                    return(_msc.GetMessage(110));
                }
                stock.StID       = regStock.StID;
                stock.PrID       = regStock.PrID;
                stock.StQuantity = regStock.StQuantity;
                stock.StFlag     = regStock.StFlag;
                //Timestamp = item.Timestamp,
                //LogData = item.LogData,
                db.Entry(stock).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Stock",
                    Command          = "Sto",
                    //Data = ProductLogData(regStock),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
Esempio n. 25
0
        // 詳細データ更新
        // in   : T_OrderDetailデータ
        // out  : エラーメッセージ

        public string PutOrderDetail(T_OrderDetail regOrderDetail)
        {
            using (var db = new SalesManagement_DevContext())
            {
                T_OrderDetail orderdetail;
                try
                {
                    orderdetail = db.T_OrderDetails.Single(x => x.OrDetailID == regOrderDetail.OrDetailID);
                }
                catch
                {
                    return(_msc.GetMessage(110));
                }
                orderdetail.OrDetailID      = regOrderDetail.OrDetailID;
                orderdetail.OrID            = regOrderDetail.OrID;
                orderdetail.PrID            = regOrderDetail.PrID;
                orderdetail.OrQuantity      = regOrderDetail.OrQuantity;
                orderdetail.OrTotalPrice    = regOrderDetail.OrTotalPrice;
                db.Entry(orderdetail).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    // throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                    return(_msc.GetMessage(100));
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "OrderDetail",
                    Command          = "Put",
                    //Data = ProductLogData(regProduct),
                };
                //StaticCommon.PostOperationLog(operationLog);

                return(string.Empty);
            }
        }
Esempio n. 26
0
        // データ削除
        // in       Arrival : 削除する入荷ID
        public void DeleteArrival(int T_ArID)
        {
            T_Arrival arrival;

            using (var db = new SalesManagement_DevContext())
            {
                try
                {
                    arrival = db.T_Arrivals.Single(x => x.ArID == T_ArID);
                }
                catch (Exception ex)
                {
                    throw new Exception(Messages.errorNotFoundArrival, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                }
                db.T_Arrivals.Remove(arrival);
                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException ex)
                {
                    throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Arrival",
                    Command          = "Delete",
                    Data             = arrival.ArID.ToString(),
                };
                //StaticCommon.PostOperationLog(operationLog);
            }
        }
        // データ削除
        // in       Product : 削除する商品ID
        public void DeleteProduct(int M_PrID)
        {
            M_Product product;

            using (var db = new SalesManagement_DevContext())
            {
                try
                {
                    product = db.M_Products.Single(x => x.PrID == M_PrID);
                }
                catch (Exception ex)
                {
                    throw new Exception(Messages.errorNotFoundProduct, ex);
                    // throw new Exception(_cm.GetMessage(110), ex);
                }
                db.M_Products.Remove(product);
                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException ex)
                {
                    throw new Exception(Messages.errorConflict, ex);
                    // throw new Exception(_cm.GetMessage(100), ex);
                }

                // ログ出力
                var operationLog = new OperationLog()
                {
                    EventRaisingTime = DateTime.Now,
                    Operator         = _logonUser,
                    Table            = "Product",
                    Command          = "Delete",
                    Data             = product.PrID.ToString(),
                };
                //StaticCommon.PostOperationLog(operationLog);
            }
        }
Esempio n. 28
0
        // データ追加
        // in   : T_ArrivalDetailデータ
        public string PostT_ArrivalDetail(T_ArrivalDetail regArrivalDetail)
        {
            using (var db1 = new SalesManagement_DevContext())
            {
                db1.T_ArrivalDetails.Add(regArrivalDetail);
                db1.Entry(regArrivalDetail).State = EntityState.Added;
                db1.SaveChanges();
            }

            //// ログ出力
            //var operationLog = new OperationLog()
            //{
            //    EventRaisingTime = DateTime.Now,
            //    Operator = _logonUser,
            //    Table = "Product",
            //    Command = "Post",
            //    Data = M_ProductLogData(regProduct),
            //    Comments = string.Empty
            //};
            //StaticCommon.PostOperationLog(operationLog);

            return(string.Empty);
        }
Esempio n. 29
0
        //// データ追加
        //// in   : T_Productデータ
        //public string PostM_Product(M_Product regM_Product)
        //{
        //    using (var db1 = new SalesManagement_DevContext())
        //    {
        //        db1.M_Products.Add(regM_Product);
        //        db1.Entry(regM_Product).State = EntityState.Added;

        //        try
        //        {
        //            db1.SaveChanges();
        //        }
        //        catch
        //        {
        //            // throw new Exception(Messages.errorConflict, ex);
        //            // throw new Exception(_cm.GetMessage(100), ex);
        //            // MessageBox.Show(_msc.GetMessage(100));
        //            return _msc.GetMessage(100);
        //        }
        //    }
        //}

        // データ追加
        // in   : T_Orderデータ
        public string PostT_Order(T_Order regOrder)
        {
            using (var db1 = new SalesManagement_DevContext())
            {
                db1.T_Orders.Add(regOrder);
                db1.Entry(regOrder).State = EntityState.Added;
                db1.SaveChanges();
            }

            //// ログ出力
            //var operationLog = new OperationLog()
            //{
            //    EventRaisingTime = DateTime.Now,
            //    Operator = _logonUser,
            //    Table = "Order",
            //    Command = "Post",
            //    Data = T_OrderLogData(regOrder),
            //    Comments = string.Empty
            //};
            //StaticCommon.PostOperationLog(operationLog);

            return(string.Empty);
        }
Esempio n. 30
0
        // 表示データ取得(始点・終点指定)
        // in   startRec : 配列抜出の始点
        //      endRec   : 配列抜出の終点

        public IEnumerable <T_DispArrival> GetDispArrivals()
        {
            using (var db = new SalesManagement_DevContext())
            {
                List <T_DispArrival> dispArrivals = new List <T_DispArrival>();
                foreach (T_Arrival arrival in db.T_Arrivals)
                {
                    string maker;
                    try
                    {
                        maker = (arrival.ArID != -1) ? db.T_Arrivals.Single(m => m.ArID == arrival.ArID).Armemo : string.Empty;

                        // 無効表示
                        if (db.T_Arrivals.Single(m => m.ArID == arrival.ArID).ArStateFlag != 0)
                        {
                            maker = "[" + maker + "]";
                        }
                    }
                    catch
                    {
                        maker = string.Empty;
                    }

                    //string category;
                    //try
                    //{
                    //    category = (item.CategoryCD != -1) ? db.M_Categorys.Single(m => m.CategoryCD == item.CategoryCD).CategoryName : string.Empty;

                    //    // 無効表示
                    //    if (db.M_Categorys.Single(m => m.CategoryCD == item.CategoryCD).DelFLG == true) category = "[" + category + "]";
                    //}
                    //catch
                    //{
                    //    category = string.Empty;
                    //}

                    dispArrivals.Add(new T_DispArrival()
                    {
                        ArID     = arrival.ArID,
                        SoID     = arrival.SoID,
                        EmID     = arrival.EmID,
                        ClID     = arrival.ClID,
                        OrID     = arrival.OrID,
                        ArDate   = arrival.ArDate,
                        Armemo   = arrival.Armemo,
                        ArHidden = arrival.ArHidden,
                    });
                }
                // ソータブルリスト作成
                SortableBindingList <T_DispArrival> sortableDispArrival = new SortableBindingList <T_DispArrival>(dispArrivals);

                //// ログ出力
                //var operationLog = new OperationLog()
                //{
                //    EventRaisingTime = DateTime.Now,
                //    Operator = _logonUser,
                //    Table = "Product",
                //    Command = "GetAll",
                //    Data = string.Empty,
                //    Comments = string.Empty
                //};
                //StaticCommon.PostOperationLog(operationLog);

                return(sortableDispArrival);
            }
        }