private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (dsPurchase1.PURCHASEREQUEST.Rows.Count == 0)
     {
         XtraMessageBox.Show("Nothing to save", "Material Issue");
         return;
     }
     gridView1.PostEditor();
     gridView1.UpdateCurrentRow();
     foreach (DsPurchase.PURCHASEREQUESTRow dr in dsPurchase1.PURCHASEREQUEST)
     {
         if (!dr.IsISSUEDNull())
         {
             if (dr.ISSUED > 0)
             {
                 dr.UPLOAD = true;
                 //  dr.INORDER = true;
             }
         }
     }
     var dm = new PrDataManager {Purchaserequest = dsPurchase1.PURCHASEREQUEST};
     var changes = (DsPurchase.PURCHASEREQUESTDataTable) dsPurchase1.PURCHASEREQUEST.GetChanges();
     var retval = dm.DoSave();
     if (retval == "1")
     {
         LoadPurchaseReq(_prno);
     }
 }
Esempio n. 2
0
 private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e)
 {
     var f = new PurchaseOrder();
     gridView1.PostEditor();
     gridView1.UpdateCurrentRow();
     f.GeneratePOFrmPR(dsPurchase1.PURCHASEREQUEST);
     var dm = new PrDataManager { Purchaserequest = dsPurchase1.PURCHASEREQUEST };
     var changes = (DsPurchase.PURCHASEREQUESTDataTable)dsPurchase1.PURCHASEREQUEST.GetChanges();
     var retval = dm.DoSave();
     if (retval == "1")
     {
         var addedRows = from row in dsPurchase1.PURINVDETAIL
                         where row.RowState == DataRowState.Added
                         select row;
         foreach (var row in addedRows.ToArray())
         {
             row.Delete();
         }
         if (changes != null) dsPurchase1.Merge(changes);
         dsPurchase1.AcceptChanges();
     }
 }
Esempio n. 3
0
 void DoPurchaseSave()
 {
     var dm = new PrDataManager { Purchaserequest = dsPurchase1.PURCHASEREQUEST };
     var changes = (DsPurchase.PURCHASEREQUESTDataTable)dsPurchase1.PURCHASEREQUEST.GetChanges();
     var retval = dm.DoSave();
     if (retval == "1")
     {
         XtraMessageBox.Show("Purchase request created", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
         var addedRows = from row in dsPurchase1.PURINVDETAIL
                         where row.RowState == DataRowState.Added
                         select row;
         foreach (var row in addedRows.ToArray())
         {
             row.Delete();
         }
         //dsPurchase1.PURCHASEREQUEST.Merge(dm.GetPurchaseRequest(prno));
         if (changes != null) dsPurchase1.Merge(changes);
         dsPurchase1.AcceptChanges();
     }
 }
Esempio n. 4
0
 private void barButtonItem3_ItemClick(object sender, ItemClickEventArgs e)
 {
  
     foreach (DsPurchase.PURCHASEREQUESTRow dr in dsPurchase1.PURCHASEREQUEST)
     {
         if (!dr.IsISSUEDNull())
         {
             if (dr.ISSUED > 0)
             {
                 dr.UPLOAD = true;
                 dr.INORDER = true;
             }
         }
     }
     var dm = new PrDataManager { Purchaserequest = dsPurchase1.PURCHASEREQUEST };
     var changes = (DsPurchase.PURCHASEREQUESTDataTable)dsPurchase1.PURCHASEREQUEST.GetChanges();
     var retval = dm.DoSave();
     if (retval == "1")
     {
         var addedRows = from row in dsPurchase1.PURCHASEREQUEST
                         where row.RowState == DataRowState.Added
                         select row;
         foreach (var row in addedRows.ToArray())
         {
             row.Delete();
         }
         if (changes != null) dsPurchase1.Merge(changes);
         dsPurchase1.AcceptChanges();
     }
     dsPurchase1.Merge(new PrDataManager().GetPurchaseRequestList(lookupfrom.EditValue.ToString()));
     var f = new ItemMove();
     gridView1.PostEditor();
     gridView1.UpdateCurrentRow();
     f.CreateItemMoveFrmPr(dsPurchase1.PURCHASEREQUEST, lookupfrom.EditValue.ToString());
     f.Show();
 }
        void SaveRequest()
        {
            if(XtraMessageBox.Show("Do you want to save the request","POS",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes)
            {
                if(dsPurchase1.PURCHASEREQUEST.Rows.Count==0)
                {
                    XtraMessageBox.Show("Nothing to save", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                foreach(DataRow dr in dsPurchase1.PURCHASEREQUEST.Rows)
                {
                    string qty = dr["QTY"].ToString();
                    if(string.IsNullOrEmpty(dr["QTY"].ToString()))
                    {
                        dr.SetColumnError("QTY","Please check Qty");    
                    }
                    else if(int.Parse(dr["QTY"].ToString())==0)
                    {
                        dr.SetColumnError("QTY", "Please check Qty");    
                    }
                    else
                    {
                        dr.SetColumnError("QTY",null);  
                    }
                }
                if(dsPurchase1.PURCHASEREQUEST.HasErrors)
                {
                    XtraMessageBox.Show("Purchase request not saved due to errors", "POS", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    return;
                }
                var dm = new PrDataManager {Purchaserequest = dsPurchase1.PURCHASEREQUEST};
                var changes = (DsPurchase.PURCHASEREQUESTDataTable)dsPurchase1.PURCHASEREQUEST.GetChanges();
                var retval =   dm.DoSave();
                if(retval=="1")
                {
                    XtraMessageBox.Show("Purchase request created", "POS", MessageBoxButtons.OK,MessageBoxIcon.Information);
                    var addedRows = from row in dsPurchase1.PURINVDETAIL
                                    where row.RowState == DataRowState.Added
                                    select row;
                    foreach (var row in addedRows.ToArray())
                    {
                        row.Delete();
                    }
                    
                    if (changes != null) dsPurchase1.Merge(changes);
                    dsPurchase1.AcceptChanges();
                    dsPurchase1.Clear();
                    dsPurchase1.PURCHASEREQUEST.Merge(dm.GetPurchaseRequest(prno));
                }


            }
        }