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); } }
public void LoadPurchaseReq(string prno) { DsPurchase.PURCHASEREQUESTDataTable ds; dsPurchase1.PURCHASEREQUEST.Rows.Clear(); _prno = prno; var dm = new PrDataManager(); ds = dm.GetPurchaseRequest(prno); var d = ds.Select("ISSUED = 0 ");// var d = from r in ds where r.ISSUED == 0 && r.UPLOAD == false select r; dsPurchase1.Merge(d); }
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(); } }
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(); } }
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 DoUploadMaterialRequest() { txtstatus.Caption = "Uploading Material Request"; Application.DoEvents(); try { var dm = new PrDataManager(); var dt = dm.GetPurchaseRequstNotSync(); var syc = new RemoteSync(); var drd = _dsdownload.NewRow(); if (dt.Rows.Count == 0) { drd[0] = ""; drd[1] = DateTime.Now.Date; drd[2] = "Material Request"; drd[3] = "Nothing to Upload "; _dsdownload.Rows.Add(drd); } else { var ret = syc.DoSavePurchaseRequestInRemote(dm.GetPurchaseRequstNotSync()); if (ret == "1") { dm.DoUpdateSync(); drd[2] = "Material Request"; drd[3] = "Uploaded"; } else { drd[3] = "Error " + ret; } _dsdownload.Rows.Add(drd); } } catch (Exception exp) { XtraMessageBox.Show(exp.ToString(), "POS", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
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)); } } }