Exemplo n.º 1
0
 public int EditRecpayDetailsCustR(int recpayid, decimal amount)
 {
     using (Entities1 Context1 = new Entities1())
     {
         var obj = (from t in Context1.RecPayDetails where t.RecPayID == recpayid && t.InvoiceID == 0 && t.AcOPInvoiceDetailID == 0 select t).FirstOrDefault();
         //var obj = Context1.RecPayDetails.Find(recpayid,0);
         if (obj != null)
         {
             RecPayDetail recpdetail = new RecPayDetail();
             recpdetail.RecPayDetailID = obj.RecPayDetailID;
             recpdetail.Amount         = -(amount);
             // recpdetail.CurrencyID = cueencyid;
             //recpd.InvDate = item.InvoiceDate.Value;
             recpdetail.RecPayID = obj.RecPayID;
             // recpdetail.Remarks = remark;
             recpdetail.InvoiceID     = 0;
             recpdetail.StatusInvoice = obj.StatusInvoice;
             recpdetail.InvDate       = obj.InvDate;
             recpdetail.InvNo         = obj.InvNo;
             recpdetail.Lock          = false;
             Context1.Entry(obj).CurrentValues.SetValues(recpdetail);
             // Context1.Entry(recpdetail).State = EntityState.Modified;
             Context1.SaveChanges();
             return(1);
         }
         else
         {
             return(0);
         }
     }
 }
Exemplo n.º 2
0
        public int EditSupplierRecieptDetails(List <RecPayDetail> rpayDetails, int recpayID)
        {
            //code for edit
            try
            {
                foreach (var CU in rpayDetails)
                {
                    if (recpayID > 0)
                    {
                        RecPayDetail objrpayDetails = Context1.RecPayDetails.Where(item => item.RecPayDetailID == CU.RecPayDetailID).FirstOrDefault();
                        objrpayDetails.Amount     = CU.Amount;
                        objrpayDetails.CurrencyID = CU.CurrencyID;
                        objrpayDetails.InvDate    = CU.InvDate;

                        objrpayDetails.InvNo = CU.InvNo;

                        objrpayDetails.InvoiceID = CU.InvoiceID;

                        objrpayDetails.Remarks = CU.Remarks;
                        Context1.Entry(objrpayDetails).State = EntityState.Modified;
                    }
                    Context1.SaveChanges();
                }
                return(1);
            }
            catch (Exception)
            {
                return(0);
            }
        }