Пример #1
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);
            }
        }
Пример #2
0
        //// データ追加
        //// in   : M_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_Hattyuデータ
        public string PostT_Hattyu(T_Hattyu regHattyu)
        {
            using (var db1 = new SalesManagement_DevContext())
            {
                db1.T_Hattyus.Add(regHattyu);
                db1.Entry(regHattyu).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);
        }