// ログデータ作成 // in regM_Client : ログ対象データ // out string : ログ文字列 private string M_ClientLogData(M_Client regM_Client) { return(regM_Client.ClID.ToString() + ", " + regM_Client.SoID.ToString() + ", " + regM_Client.ClName + ", " + regM_Client.ClAddress + ", " + regM_Client.ClPhone + ", " + regM_Client.ClPostal.ToString() + ", " + regM_Client.ClFAX + ", " + regM_Client.ClFlag.ToString() + ", " + regM_Client.ClHidden); }
// データ更新 // 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); } }
//// データ追加 //// 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 : M_Itemデータ public string PostM_Client(M_Client regClient) { using (var db1 = new SalesManagement_DevContext()) { db1.M_Clients.Add(regClient); db1.Entry(regClient).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); }