public void CustomDocumentToLuceneDocumentForClass() { //test AddDocumentFields var customSandoDocument = new ClassDocument(MyCustomClassForTesting.GetClassElement()); var luceneDocumentWithCustomFields = customSandoDocument.GetDocument(); Assert.IsTrue(luceneDocumentWithCustomFields != null); Assert.IsTrue(luceneDocumentWithCustomFields.GetField("Bam") != null); Assert.IsTrue(luceneDocumentWithCustomFields.GetField("Bam").StringValue().Equals("Zaow")); }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtIMGid.Text.Equals("") && picImage.Image != null) { int addIMG = ClassDocument.insertImgToDoc(arr, int.Parse(DocID)); dt = ClassDocument.selectImgForOneDoc(int.Parse(DocID)); MessageBox.Show("Done . ."); numOfImag = dt.Rows.Count; btnFirstIMG_Click(null, null); } } catch (Exception) { } }
private void dgvDoc_DoubleClick(object sender, EventArgs e) { try { DocID = dgvDoc.CurrentRow.Cells[0].Value.ToString(); dt = ClassDocument.selectImgForOneDoc(int.Parse(dgvDoc.CurrentRow.Cells[0].Value.ToString())); byte[] arr = (byte[])(dt.Rows[0][1]); MemoryStream ms = new MemoryStream(arr); pic1.Image = Image.FromStream(ms); byte[] arr1 = (byte[])(dt.Rows[1][1]); MemoryStream ms1 = new MemoryStream(arr1); pic2.Image = Image.FromStream(ms1); } catch (Exception) { } }
private void btnDelete_Click(object sender, EventArgs e) { if (txtIMGid.Text.Equals("")) { picImage.Image = null; } else { int delImage = ClassDocument.DeleteImg(int.Parse(txtIMGid.Text)); dt = ClassDocument.selectImgForOneDoc(int.Parse(DocID)); MessageBox.Show("Done . ."); txtIMGid.Text = ""; picImage.Image = null; } numOfImag = dt.Rows.Count; btnFirstIMG_Click(null, null); }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (txtID.Text.Equals("")) { MessageBox.Show("الرجاء تحديد مستند"); } else { int i = ClassDocument.updateDocDetails(int.Parse(txtID.Text), txtType.Text, txtOwnDoc.Text, txtNumber.Text, dtpDoc.Value, rtxtNote.Text); txtID.Text = txtNumber.Text = txtOwnDoc.Text = txtType.Text = rtxtNote.Text = ""; MessageBox.Show("تمت العملية بنجاح"); display(); } } catch (Exception) { } }
public Frm_ImgDoc(string id, string Rep_status) { InitializeComponent(); DocID = id; if (Rep_status.Equals("Report")) { btnSave.Visible = btnDelete.Visible = btnSelectOne.Visible = false; } dt = ClassDocument.selectImgForOneDoc(int.Parse(DocID)); numOfImag = dt.Rows.Count; try { txtIMGid.Text = dt.Rows[0][0].ToString(); byte[] arr = (byte[])(dt.Rows[0][1]); MemoryStream ms = new MemoryStream(arr); picImage.Image = Image.FromStream(ms); } catch (Exception) { } }
private void btnSearch_Click(object sender, EventArgs e) { pic1.Image = null; pic2.Image = null; if (cmbDate.Text.Equals("قبل")) { dgvDoc.DataSource = ClassDocument.SearchBeforDate(dtpSearch.Value); } if (cmbDate.Text.Equals("بعد")) { dgvDoc.DataSource = ClassDocument.SearchAfterDate(dtpSearch.Value); } if (cmbDate.Text.Equals("يساوي")) { dgvDoc.DataSource = ClassDocument.SearchEqualDate(dtpSearch.Value); } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (txtID.Text.Equals("")) { MessageBox.Show("الرجاء اختيار مستند محدد"); } else { int DelImgWith = ClassDocument.DeleteImgWithDelDoc(int.Parse(txtID.Text)); int i = ClassDocument.DeleteDoc(int.Parse(txtID.Text)); txtID.Text = txtNumber.Text = txtOwnDoc.Text = txtType.Text = rtxtNote.Text = ""; MessageBox.Show("تمت عملية الحذف بنجاح"); display(); } } catch (Exception) { } }
public void AssignDocumentClassTotal(ClassDocument tObject) { if (tObject.GetType() == typeof(PurchaseRequest)) { ((PurchaseRequest)tObject).DocB4Total = ((PurchaseRequest)tObject).PurchaseRequestDetail.Sum(pp => pp.LineTotal); } else if (tObject.GetType() == typeof(PurchaseOrder)) { ((PurchaseOrder)tObject).DocB4Total = ((PurchaseOrder)tObject).PurchaseOrderDetail.Sum(pp => pp.LineTotal); } else if (tObject.GetType() == typeof(PurchaseDelivery)) { ((PurchaseDelivery)tObject).DocB4Total = ((PurchaseDelivery)tObject).PurchaseDeliveryDetail.Sum(pp => pp.LineTotal); } else if (tObject.GetType() == typeof(PurchaseReturn)) { ((PurchaseReturn)tObject).DocB4Total = ((PurchaseReturn)tObject).PurchaseReturnDetail.Sum(pp => pp.LineTotal); } else if (tObject.GetType() == typeof(PurchaseQuotation)) { ((PurchaseQuotation)tObject).DocB4Total = ((PurchaseQuotation)tObject).PurchaseQuotationDetail.Sum(pp => pp.LineTotal); } }
public void AddDetailClassFromDocumentClass(ClassDocument tObject, ClassDocumentDetail tDtl) { if (tObject.GetType() == typeof(PurchaseRequest)) { ((PurchaseRequest)tObject).PurchaseRequestDetail.Add((PurchaseRequestDetail)tDtl); } else if (tObject.GetType() == typeof(PurchaseOrder)) { ((PurchaseOrder)tObject).PurchaseOrderDetail.Add((PurchaseOrderDetail)tDtl); } else if (tObject.GetType() == typeof(PurchaseDelivery)) { ((PurchaseDelivery)tObject).PurchaseDeliveryDetail.Add((PurchaseDeliveryDetail)tDtl); } else if (tObject.GetType() == typeof(PurchaseReturn)) { ((PurchaseReturn)tObject).PurchaseReturnDetail.Add((PurchaseReturnDetail)tDtl); } else if (tObject.GetType() == typeof(PurchaseQuotation)) { ((PurchaseQuotation)tObject).PurchaseQuotationDetail.Add((PurchaseQuotationDetail)tDtl); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtType.Text.Equals("") || txtOwnDoc.Text.Equals("")) { MessageBox.Show("الرجاء ملئ الحقول الضرورية"); } else { int addDoc = ClassDocument.AddDoc(txtType.Text, txtOwnDoc.Text, txtNumber.Text, dtpDoc.Value, rtxtNote.Text); if (NumOfImage > 0) { DataTable LastOne = ClassDocument.SelectLastDoc(); for (int i = 0; i < images.Count; i++) { int AddImg = ClassDocument.AddDocImage(images[i], int.Parse(LastOne.Rows[0][0].ToString())); } } txtNumber.Text = txtOwnDoc.Text = txtType.Text = rtxtNote.Text = ""; lbNumIMG.Text = "0"; NumOfImage = 0; images.Clear(); MessageBox.Show("تمت عملية الحفظ بنجاح"); } }
public async void Put([FromBody] ClassDocument classDoc) { await ClassRepository.UpdateAsync(classDoc, classDoc.Id); }
private void txtSearch_TextChanged(object sender, EventArgs e) { dgvDoc.DataSource = ClassDocument.searchForDoc(txtSearch.Text); pic1.Image = null; pic2.Image = null; }
void display() { dgvDoc.DataSource = ClassDocument.selectAllDoc(); }
public bool CopyToDocument(ClassDocument sObject, ClassDocument tObject, IObjectSpace ios, DetailView sDetailView) { if (sObject == null) { return(false); } if (tObject == null) { return(false); } bool added = false; int minvalue = 0; int maxvisorder = 0; //GetDetailClassVisOrder(tObject, ref minvalue, ref maxvisorder); if (sDetailView != null) { if (sObject.CardCode != null) { tObject.CardCode = ios.FindObject <vwBusinessPartners>(CriteriaOperator.Parse("BoKey=?", sObject.CardCode.BoKey)); } tObject.CardName = sObject.CardName; if (sObject.CncttCode != null) { tObject.CncttCode = ios.FindObject <vwContactPersons>(CriteriaOperator.Parse("BoKey=?", sObject.CncttCode.BoKey)); } if (sObject.DocCur != null) { tObject.DocCur = ios.FindObject <vwCurrency>(CriteriaOperator.Parse("BoKey=?", sObject.DocCur.BoKey)); } if (sObject.ShipToCode != null) { tObject.ShipToCode = ios.FindObject <vwShipToAddress>(CriteriaOperator.Parse("BoKey=?", sObject.ShipToCode.BoKey)); } tObject.Address2 = sObject.Address2; if (sObject.BillToCode != null) { tObject.BillToCode = ios.FindObject <vwBillToAddress>(CriteriaOperator.Parse("BoKey=?", sObject.BillToCode.BoKey)); } tObject.Address = sObject.Address; if (sObject.SlpCode != null) { tObject.SlpCode = ios.FindObject <vwSalesPersons>(CriteriaOperator.Parse("BoKey=?", sObject.SlpCode.BoKey)); } tObject.JrnMemo = sObject.JrnMemo; tObject.Comments = sObject.Comments; #region assign udf header ClassUDFHeader sClass = getUDFHeaderClass(sObject); ClassUDFHeader tClass = getUDFHeaderClass(tObject); AssignUDFHeaderValues(ref sClass, ref tClass); #endregion } ListPropertyEditor listviewDetail = null; foreach (ViewItem item in sDetailView.Items) { if ((item is ListPropertyEditor)) { if (item.Id == "PurchaseRequestDetail" || item.Id == "PurchaseOrderDetail" || item.Id == "PurchaseDeliveryDetail" || item.Id == "PurchaseReturnDetail" || item.Id == "PurchaseQuotationDetail") { listviewDetail = item as ListPropertyEditor; } } } if (listviewDetail != null && listviewDetail.ListView != null) { foreach (ClassDocumentDetail dtl in listviewDetail.ListView.CollectionSource.List) { if (dtl.OpenQty > dtl.CopyQty && dtl.LineStatus == LineStatusEnum.Open) { //if (added) //{ minvalue--; maxvisorder++; //} added = true; #region create object by type ClassDocumentDetail tDtl = CreateDetailClassFromDocumentClass(ios, tObject); #endregion #region assign udf detail ClassUDFDetail sClassD = getUDFDetailClass(dtl); ClassUDFDetail tClassD = getUDFDetailClass(tDtl); AssignUDFDetailValues(ref sClassD, ref tClassD); #endregion tDtl.Oid = minvalue; tDtl.VisOrder = maxvisorder; CopyGenDocumentValues(ios, dtl, tDtl); //tDtl.Quantity = dtl.OpenQty; //if (dtl.DocCur != null) // tDtl.DocCur = ios.FindObject<vwCurrency>(CriteriaOperator.Parse("BoKey=?", dtl.DocCur.BoKey)); //if (dtl.ItemCode != null) // tDtl.ItemCode = ios.FindObject<vwItemMasters>(CriteriaOperator.Parse("BoKey=?", dtl.ItemCode.BoKey)); //tDtl.Dscription = dtl.Dscription; //if (dtl.WhsCode != null) // tDtl.WhsCode = ios.FindObject<vwWarehouses>(CriteriaOperator.Parse("BoKey=?", dtl.WhsCode.BoKey)); //if (dtl.BinCode != null) // tDtl.BinCode = ios.FindObject<vwWarehouseBins>(CriteriaOperator.Parse("BoKey=?", dtl.BinCode.BoKey)); //if (dtl.OcrCode != null) // tDtl.OcrCode = ios.FindObject<vwDimension1>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode.BoKey)); //if (dtl.OcrCode2 != null) // tDtl.OcrCode2 = ios.FindObject<vwDimension2>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode2.BoKey)); //if (dtl.OcrCode3 != null) // tDtl.OcrCode3 = ios.FindObject<vwDimension3>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode3.BoKey)); //if (dtl.OcrCode4 != null) // tDtl.OcrCode4 = ios.FindObject<vwDimension4>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode4.BoKey)); //if (dtl.OcrCode5 != null) // tDtl.OcrCode5 = ios.FindObject<vwDimension5>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode5.BoKey)); //if (dtl.PrjCode != null) // tDtl.PrjCode = ios.FindObject<vwProjects>(CriteriaOperator.Parse("BoKey=?", dtl.PrjCode.BoKey)); //if (dtl.AcctCode != null) // tDtl.AcctCode = ios.FindObject<vwAccounts>(CriteriaOperator.Parse("BoKey=?", dtl.AcctCode.BoKey)); //if (dtl.TaxCode != null) // tDtl.TaxCode = ios.FindObject<vwTaxes>(CriteriaOperator.Parse("BoKey=?", dtl.TaxCode.BoKey)); //if (dtl.FreightCharge != null) // tDtl.FreightCharge = ios.FindObject<vwExpenses>(CriteriaOperator.Parse("BoKey=?", dtl.FreightCharge.BoKey)); //tDtl.BatchNumber = dtl.BatchNumber; //tDtl.UnitMsr = dtl.UnitMsr; //tDtl.UnitPrice = dtl.UnitPrice; //tDtl.TaxPerc = dtl.TaxPerc; //tDtl.TaxAmt = dtl.TaxAmt; //tDtl.DiscountAmt = dtl.DiscountAmt; //tDtl.FreightAmt = dtl.FreightAmt; //if (dtl.ObjType != null) // tDtl.BaseType = ios.GetObjectByKey<DocType>(dtl.ObjType.Oid); //tDtl.Baseline = dtl.Oid; //tDtl.SAPBaseType = dtl.SAPObjType; //tDtl.SAPBaseEntry = dtl.SAPDocEntry; //tDtl.SAPBaseLine = dtl.SAPLineNum; #region create object by type AddDetailClassFromDocumentClass(tObject, tDtl); #endregion } } } #region assign total AssignDocumentClassTotal(tObject); #endregion return(added); }
public async void Post([FromBody] ClassDocument classDoc) { await ClassRepository.AddAsync(classDoc); }
public ClassDocumentDetail CreateDetailClassFromDocumentClass(IObjectSpace ios, ClassDocument tObject) { if (tObject.GetType() == typeof(PurchaseRequest)) { return(ios.CreateObject <PurchaseRequestDetail>()); } else if (tObject.GetType() == typeof(PurchaseOrder)) { return(ios.CreateObject <PurchaseOrderDetail>()); } else if (tObject.GetType() == typeof(PurchaseDelivery)) { return(ios.CreateObject <PurchaseDeliveryDetail>()); } else if (tObject.GetType() == typeof(PurchaseReturn)) { return(ios.CreateObject <PurchaseReturnDetail>()); } else if (tObject.GetType() == typeof(PurchaseQuotation)) { return(ios.CreateObject <PurchaseQuotationDetail>()); } return(null); }
public void GetDetailClassVisOrder(ClassDocument tObject, ref int minvalue, ref int maxvisorder) { int comparevalue = 0; int comparevisorder = 0; if (tObject.GetType() == typeof(PurchaseRequest)) { PurchaseRequest masterobject = (PurchaseRequest)tObject; if (masterobject.PurchaseRequestDetail.Count > 0) { comparevalue = masterobject.PurchaseRequestDetail.Min(pp => pp.Oid); comparevisorder = masterobject.PurchaseRequestDetail.Max(pp => pp.VisOrder); } if (comparevalue <= minvalue) { minvalue = comparevalue - 1; } if (comparevisorder >= maxvisorder) { maxvisorder = comparevisorder + 1; } } else if (tObject.GetType() == typeof(PurchaseOrder)) { PurchaseOrder masterobject = (PurchaseOrder)tObject; if (masterobject.PurchaseOrderDetail.Count > 0) { comparevalue = masterobject.PurchaseOrderDetail.Min(pp => pp.Oid); comparevisorder = masterobject.PurchaseOrderDetail.Max(pp => pp.VisOrder); } if (comparevalue <= minvalue) { minvalue = comparevalue - 1; } if (comparevisorder >= maxvisorder) { maxvisorder = comparevisorder + 1; } } else if (tObject.GetType() == typeof(PurchaseDelivery)) { PurchaseDelivery masterobject = (PurchaseDelivery)tObject; if (masterobject.PurchaseDeliveryDetail.Count > 0) { comparevalue = masterobject.PurchaseDeliveryDetail.Min(pp => pp.Oid); comparevisorder = masterobject.PurchaseDeliveryDetail.Max(pp => pp.VisOrder); } if (comparevalue <= minvalue) { minvalue = comparevalue - 1; } if (comparevisorder >= maxvisorder) { maxvisorder = comparevisorder + 1; } } else if (tObject.GetType() == typeof(PurchaseReturn)) { PurchaseReturn masterobject = (PurchaseReturn)tObject; if (masterobject.PurchaseReturnDetail.Count > 0) { comparevalue = masterobject.PurchaseReturnDetail.Min(pp => pp.Oid); comparevisorder = masterobject.PurchaseReturnDetail.Max(pp => pp.VisOrder); } if (comparevalue <= minvalue) { minvalue = comparevalue - 1; } if (comparevisorder >= maxvisorder) { maxvisorder = comparevisorder + 1; } } else if (tObject.GetType() == typeof(PurchaseQuotation)) { PurchaseQuotation masterobject = (PurchaseQuotation)tObject; if (masterobject.PurchaseQuotationDetail.Count > 0) { comparevalue = masterobject.PurchaseQuotationDetail.Min(pp => pp.Oid); comparevisorder = masterobject.PurchaseQuotationDetail.Max(pp => pp.VisOrder); } if (comparevalue <= minvalue) { minvalue = comparevalue - 1; } if (comparevisorder >= maxvisorder) { maxvisorder = comparevisorder + 1; } } }
public bool CopyFromDocument(ClassDocument tObject, ListView sListView, IObjectSpace ios) { if (tObject == null) { return(false); } bool added = false; int minvalue = 0; int maxvisorder = 0; GetDetailClassVisOrder(tObject, ref minvalue, ref maxvisorder); foreach (ClassDocumentDetail dtl in sListView.SelectedObjects) { if (dtl.OpenQty > 0 && dtl.LineStatus == LineStatusEnum.Open) { if (added) { minvalue--; maxvisorder++; } added = true; #region create object by type ClassDocumentDetail tDtl = CreateDetailClassFromDocumentClass(ios, tObject); #endregion #region assign udf detail ClassUDFDetail sClassD = getUDFDetailClass(dtl); ClassUDFDetail tClassD = getUDFDetailClass(tDtl); AssignUDFDetailValues(ref sClassD, ref tClassD); #endregion tDtl.Oid = minvalue; tDtl.VisOrder = maxvisorder; CopyGenDocumentValues(ios, dtl, tDtl); //tDtl.Quantity = dtl.OpenQty; //if (dtl.DocCur != null) // tDtl.DocCur = ios.FindObject<vwCurrency>(CriteriaOperator.Parse("BoKey=?", dtl.DocCur.BoKey)); //if (dtl.ItemCode != null) // tDtl.ItemCode = ios.FindObject<vwItemMasters>(CriteriaOperator.Parse("BoKey=?", dtl.ItemCode.BoKey)); //tDtl.Dscription = dtl.Dscription; //if (dtl.WhsCode != null) // tDtl.WhsCode = ios.FindObject<vwWarehouses>(CriteriaOperator.Parse("BoKey=?", dtl.WhsCode.BoKey)); //if (dtl.BinCode != null) // tDtl.BinCode = ios.FindObject<vwWarehouseBins>(CriteriaOperator.Parse("BoKey=?", dtl.BinCode.BoKey)); //if (dtl.OcrCode != null) // tDtl.OcrCode = ios.FindObject<vwDimension1>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode.BoKey)); //if (dtl.OcrCode2 != null) // tDtl.OcrCode2 = ios.FindObject<vwDimension2>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode2.BoKey)); //if (dtl.OcrCode3 != null) // tDtl.OcrCode3 = ios.FindObject<vwDimension3>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode3.BoKey)); //if (dtl.OcrCode4 != null) // tDtl.OcrCode4 = ios.FindObject<vwDimension4>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode4.BoKey)); //if (dtl.OcrCode5 != null) // tDtl.OcrCode5 = ios.FindObject<vwDimension5>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode5.BoKey)); //if (dtl.PrjCode != null) // tDtl.PrjCode = ios.FindObject<vwProjects>(CriteriaOperator.Parse("BoKey=?", dtl.PrjCode.BoKey)); //if (dtl.AcctCode != null) // tDtl.AcctCode = ios.FindObject<vwAccounts>(CriteriaOperator.Parse("BoKey=?", dtl.AcctCode.BoKey)); //if (dtl.TaxCode != null) // tDtl.TaxCode = ios.FindObject<vwTaxes>(CriteriaOperator.Parse("BoKey=?", dtl.TaxCode.BoKey)); //if (dtl.FreightCharge != null) // tDtl.FreightCharge = ios.FindObject<vwExpenses>(CriteriaOperator.Parse("BoKey=?", dtl.FreightCharge.BoKey)); //tDtl.BatchNumber = dtl.BatchNumber; //tDtl.UnitMsr = dtl.UnitMsr; //tDtl.UnitPrice = dtl.UnitPrice; //tDtl.TaxPerc = dtl.TaxPerc; //tDtl.TaxAmt = dtl.TaxAmt; //tDtl.DiscountAmt = dtl.DiscountAmt; //tDtl.FreightAmt = dtl.FreightAmt; //if (dtl.ObjType != null) // tDtl.BaseType = ios.GetObjectByKey<DocType>(dtl.ObjType.Oid); //tDtl.Baseline = dtl.Oid; //tDtl.SAPBaseType = dtl.SAPObjType; //tDtl.SAPBaseEntry = dtl.SAPDocEntry; //tDtl.SAPBaseLine = dtl.SAPLineNum; #region create object by type AddDetailClassFromDocumentClass(tObject, tDtl); #endregion } } #region assign total AssignDocumentClassTotal(tObject); #endregion return(added); }