public int Save(Models.MPayments model) { Common.Logger l = new Common.Logger(); string ClassName = "CPayment"; try { DB.Payment bs = new DB.Payment(); bs.ClientId = Convert.ToInt32(model.ClientId); bs.VendorId = model.VendorId; bs.OrderId = model.OrderId; bs.TransactionId = model.TransactionId; bs.Paid = model.Paid; bs.TotalCost = model.TotalCost; bs.PaymentType = model.PaymentType; bs.PaymentState = model.Paymentstate; l.Print(ClassName, Common.LogPointer.Info.ToString(), "Model Values id[" + model.id + "] ClientId[" + model.ClientId + "] VendorId[" + model.VendorId + "] OrderId[" + model.OrderId + "] TransactionId [ " + model.TransactionId + "] Paid [ " + model.Paid + " ] PaymentType[ " + model.PaymentType + " ] PaymentState [ " + model.Paymentstate + " ]"); obj.Payments.InsertOnSubmit(bs); obj.SubmitChanges(); l.Print(ClassName, Common.LogPointer.Info.ToString(), "Record Inserted Successfully"); return(1); } catch (Exception ex) { l.Print(ClassName, Common.LogPointer.Error.ToString(), ex.ToString()); return(-1); } }
public KeyValuePair <long, short>[] InsertPayment(params PaymentContract[] d) { lock (MDB) { try { foreach (var x in d) { var xx = new DB.Payment(); x.Payment.CopyTo(xx); MDB.Payments.InsertOnSubmit(xx); } var payments = MDB.GetChangeSet().Inserts.OfType <DB.Payment>(); MDB.SubmitChanges(); var paymentsIds = payments.Select(l => new KeyValuePair <long, short>(l.CreditTransactionId, l.Sequence)).ToArray(); return(paymentsIds); } catch (Exception ex) { HandleMyException(ex); return(new KeyValuePair <long, short>[] { }); } } }