protected void btndeletePurchaseItem_Click(object sender, ImageClickEventArgs e) { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.DeliveryDataDetail PurcahseOrderdetaildr = Mdb.DeliveryDataDetails.Single(a => a.Id == long.Parse(hfPurchaseDetailsId.Value)); if (PurcahseOrderdetaildr.Status > 1) { Response.Write("<script>alert('لا يمكن حذف هذا الصنف حيث انه قد تم تسليمه')</script>"); return; } else { Mdb.DeliveryDataDetails.Remove(PurcahseOrderdetaildr); Mdb.SaveChanges(); gvDeliveryData.DataBind(); var PurchaseOrderHeaderRows = from a in Mdb.DeliveryDataDetails where a.DeliveryDataHeaderId == long.Parse(hfId.Value) select a; if (PurchaseOrderHeaderRows.Count() <= 0) { ADAM.DataBase.DeliveryDataHeader PurchaseHeadedr = Mdb.DeliveryDataHeaders.Single(a => a.Id == long.Parse(hfId.Value)); Mdb.DeliveryDataHeaders.Remove(PurchaseHeadedr); Mdb.SaveChanges(); btnNew_Click(sender, e); } } }
private void DeleteData() { try { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.SupplyOrderHeader dr = Mdb.SupplyOrderHeaders.Single(a => a.SupplyOrderNo == long.Parse(txtSupplyOrderNo.Text)); var SupplyOrderDetailsRows = from a in Mdb.SupplyOrderDetails where a.SupplyOrderHeaderId == dr.Id select a; foreach (ADAM.DataBase.SupplyOrderDetail ddr in SupplyOrderDetailsRows) { ADAM.DataBase.PurchaseOredrDetail pdr = Mdb.PurchaseOredrDetails.Single(a => a.Id == ddr.PurchaseOrderDetailsId); if (pdr.IsChecked != 5) { Response.Write("<script>alert('لا يمكن الحذف الان لانه اصبح في مرحلة غير امر التوريد')</script>"); return; } } foreach (ADAM.DataBase.SupplyOrderDetail ddr in SupplyOrderDetailsRows) { Mdb.SupplyOrderDetails.Remove(ddr); ADAM.DataBase.PurchaseOredrDetail pdr = Mdb.PurchaseOredrDetails.Single(a => a.Id == ddr.PurchaseOrderDetailsId); pdr.IsChecked = 0; Mdb.SaveChanges(); } Mdb.SupplyOrderHeaders.Remove(dr); Mdb.SaveChanges(); txtDate.Text = txtSupplierCode.Text = txtSupplyOrderNo.Text = ""; ddlSupplier.SelectedValue = "0"; Response.Write("<script>alert('تمت عملية الحذف نجاح')</script>"); } catch { Response.Write("<script>alert('خطأ أثناء الحذف من فضلك تأكد من ادخال البيانات بشكل صحيح او من الاتصال بقاعدة البيانات')</script>"); } }
protected void btnDelete_Click(object sender, ImageClickEventArgs e) { if (Session["UserID"] == null) { Response.Redirect("~/BasicData/webLogIn.aspx"); } int userid = int.Parse(Session["UserID"].ToString()); int operationid = 6; csGetPermission Per = new csGetPermission(); if (!Per.getPermission(userid, pageid, operationid)) { Response.Redirect("~/BasicData/webHomePage.aspx"); } ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.RefluxDetailsData ddr = mdb.RefluxDetailsDatas.Single(a => a.Id == long.Parse(RefluxDetailsId.Value)); long HeaderId = ddr.RefluxHeaderId; mdb.RefluxDetailsDatas.Remove(ddr); mdb.SaveChanges(); var Rows = from a in mdb.RefluxHeaderDatas where a.Id == HeaderId select a; if (Rows.Count() <= 0) { ADAM.DataBase.RefluxHeaderData dr = mdb.RefluxHeaderDatas.Single(a => a.Id == HeaderId); mdb.RefluxHeaderDatas.Remove(dr); mdb.SaveChanges(); } }
private void SaveData() { try { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.ExchangeRequestHeaderData dr = new DataBase.ExchangeRequestHeaderData(); dr.ClientId = long.Parse(ddlClient.SelectedValue); dr.DivisionId = long.Parse(ddlDivision.SelectedValue); dr.EmpId = long.Parse(ddlEmployee.SelectedValue); dr.ExchangeRequestDate = DateTime.Parse(txtDate.Text); dr.ExchangeRequestNo = long.Parse(txtExchangeRequestNo.Text); dr.RecoredDate = DateTime.Now; dr.OrderType = int.Parse(ddlExchangeRequestType.SelectedValue); dr.Posted = 0; Mdb.ExchangeRequestHeaderDatas.Add(dr); Mdb.SaveChanges(); hfId.Value = dr.Id.ToString(); Mdb.SaveChanges(); disableControl(); } catch { Response.Write("<script>alert('خطأ أثناء الحفظ من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات')</script>"); } }
private void DeleteData() { try { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.PurchaseOrderHeader dr = Mdb.PurchaseOrderHeaders.Single(a => a.PurchaseOrderNo == long.Parse(txtPurchaseOrderNo.Text)); var PurchaseOrderDetailsRows = from a in Mdb.PurchaseOredrDetails where a.PurchaseOredeHeaderId == dr.Id select a; foreach (ADAM.DataBase.PurchaseOredrDetail ddr in PurchaseOrderDetailsRows) { if (ddr.Status != 1) { Response.Write("<script>alert('لا يمكن الحذف الان لانه اصبح في مرحلة غير مرحلة الانشاء')</script>"); return; } } foreach (ADAM.DataBase.PurchaseOredrDetail ddr in PurchaseOrderDetailsRows) { if (ddr.Status == 1) { Mdb.PurchaseOredrDetails.Remove(ddr); } Mdb.SaveChanges(); } Mdb.PurchaseOrderHeaders.Remove(dr); Mdb.SaveChanges(); txtDate.Text = txtNote.Text = txtPurchaseOrderNo.Text = ""; ddlEmployee.SelectedValue = ddlDepartment.SelectedValue = ddlDivision.SelectedValue = ddlItemType.SelectedValue = "0"; Response.Write("<script>alert('تمت عملية الحذف نجاح')</script>"); } catch { Response.Write("<script>alert('خطأ أثناء الحذف من فضلك تأكد من ادخال البيانات بشكل صحيح او من الاتصال بقاعدة البيانات')</script>"); } }
private void DeleteData() { try { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.DeliveryDataHeader dr = Mdb.DeliveryDataHeaders.Single(a => a.DeliveryNo == long.Parse(txtDeliveryOrderNo.Text)); var DeliveryDetailsRows = from a in Mdb.DeliveryDataDetails where a.DeliveryDataHeaderId == dr.Id select a; foreach (ADAM.DataBase.DeliveryDataDetail ddr in DeliveryDetailsRows) { if (ddr.Status == 1) { Response.Write("<script>alert('لا يمكن الحذف الان لانه قد تم تسليم هذه الكمية')</script>"); return; } } foreach (ADAM.DataBase.DeliveryDataDetail ddr in DeliveryDetailsRows) { if (ddr.Status == 0) { Mdb.DeliveryDataDetails.Remove(ddr); } Mdb.SaveChanges(); } Mdb.DeliveryDataHeaders.Remove(dr); Mdb.SaveChanges(); txtDate.Text = txtDeliveryOrderNo.Text = ""; ddlItemType.SelectedValue = ddlProductionLine.SelectedValue = "0"; Response.Write("<script>alert('تمت عملية الحذف نجاح')</script>"); } catch { Response.Write("<script>alert('خطأ أثناء الحذف من فضلك تأكد من ادخال البيانات بشكل صحيح او من الاتصال بقاعدة البيانات')</script>"); } }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { try { ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString(); for (int Row = 0; Row < gvItemContent.Rows.Count; Row++) { CheckBox chkChoose = gvItemContent.Rows[Row].FindControl("chkChoose") as CheckBox; if (chkChoose.Checked) { decimal Qty = decimal.Parse(gvItemContent.Rows[Row].Cells[8].Text); long ItemMoveId = long.Parse(gvItemContent.DataKeys[Row][0].ToString()); long ProductionDetailsOrderId = long.Parse(gvItemContent.DataKeys[Row][1].ToString()); hfProductionDetailsOrderId.Value = ProductionDetailsOrderId.ToString(); ADAM.DataBase.ItemMovement itmMovementdr = mdb.ItemMovements.Single(a => a.Id == ItemMoveId); itmMovementdr.MainQtyOut = itmMovementdr.MainQtyOut + Qty; var Rows = from a in mdb.ItemMovements where a.MovmentnameId == 21 && a.ItemColorId == itmMovementdr.ItemColorId && a.ItemId == itmMovementdr.ItemId && a.DocmentId == ProductionDetailsOrderId select a; if (Rows.Count() > 0) { continue; } ADAM.DataBase.ItemMovement Nmovedr = new DataBase.ItemMovement(); Nmovedr.AdditionalQty = 0; Nmovedr.AdditionalQtyOut = 0; Nmovedr.AuditDetailsId = 0; Nmovedr.DocmentId = ProductionDetailsOrderId; Nmovedr.IncommingOrderNo = itmMovementdr.IncommingOrderNo; Nmovedr.ItemColorId = itmMovementdr.ItemColorId; Nmovedr.ItemId = itmMovementdr.ItemId; Nmovedr.ItemUnitId = itmMovementdr.ItemUnitId; Nmovedr.LocatioId = itmMovementdr.LocatioId; Nmovedr.MainQty = Qty * -1; Nmovedr.MainQtyOut = 0; Nmovedr.MovementDate = DateTime.Now; Nmovedr.MovmentnameId = 21; Nmovedr.RecDate = DateTime.Now; Nmovedr.StoreId = itmMovementdr.StoreId; Nmovedr.SupplyOrderDetailsId = 0; Nmovedr.ParentItemMoveMentId = itmMovementdr.Id; mdb.ItemMovements.Add(Nmovedr); mdb.SaveChanges(); } } ADAM.DataBase.ProductionDetailsOrder Proddr = mdb.ProductionDetailsOrders.Single(a => a.Id == long.Parse(hfProductionDetailsOrderId.Value)); Proddr.Status = 1; mdb.SaveChanges(); } catch { } }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { if (Session["UserID"] == null) { Response.Redirect("~/BasicData/webLogIn.aspx"); } int userid = int.Parse(Session["UserID"].ToString()); int operationid = 1; csGetPermission Per = new csGetPermission(); if (!Per.getPermission(userid, pageid, operationid)) { Response.Redirect("~/BasicData/webHomePage.aspx"); } ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.ProductionHeaderOrder headerdr = new DataBase.ProductionHeaderOrder(); if (hfHeaderId.Value != "0") { headerdr = mdb.ProductionHeaderOrders.Single(a => a.Id == long.Parse(hfHeaderId.Value)); } else { headerdr.ProductionDate = DateTime.Now; headerdr.ProductionNo = long.Parse(txtOrderNo.Text); mdb.ProductionHeaderOrders.Add(headerdr); mdb.SaveChanges(); hfHeaderId.Value = headerdr.Id.ToString(); } for (int GRow = 0; GRow < gvProductionOrderData.Rows.Count; GRow++) { TextBox txtQty = gvProductionOrderData.Rows[GRow].FindControl("txtQty") as TextBox; if (!string.IsNullOrEmpty(txtQty.Text)) { if (decimal.Parse(txtQty.Text) <= 0) { Response.Write("<script>alert('من فضلك يجب ان تكون الكمية اكبر من الصفر')</script>"); return; } long ItemContentHeaderId = long.Parse(gvProductionOrderData.DataKeys[GRow].Value.ToString()); ADAM.DataBase.ProductionDetailsOrder detailsdr = new DataBase.ProductionDetailsOrder(); detailsdr.ProductionHeaderOrderId = long.Parse(hfHeaderId.Value); detailsdr.ContentHeaderId = ItemContentHeaderId; detailsdr.Qty = decimal.Parse(txtQty.Text); detailsdr.Status = 0; mdb.ProductionDetailsOrders.Add(detailsdr); } } mdb.SaveChanges(); btnNew_Click(sender, e); }
private void SaveData(string Qty, long ItemId, int ItemColorId) { if (Session["UserID"] == null) { Response.Redirect("~/BasicData/webLogIn.aspx"); } int userid = int.Parse(Session["UserID"].ToString()); int operationid = 1; csGetPermission Per = new csGetPermission(); if (!Per.getPermission(userid, pageid, operationid)) { Response.Redirect("~/BasicData/webHomePage.aspx"); } ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString(); if (hfItemContentHeaderId.Value == "0") { ADAM.DataBase.ItemContentHeader Hdr = new DataBase.ItemContentHeader(); Hdr.ProductionLineId = long.Parse(ddlProductProductionLine.SelectedValue); Hdr.ProductItemColor = int.Parse(ddlProductionItemcolor.SelectedValue); Hdr.ProductItemId = long.Parse(ddlProductionItem.SelectedValue); Hdr.ItemType = int.Parse(ddlProductionItemType.SelectedValue); mdb.ItemContentHeaders.Add(Hdr); mdb.SaveChanges(); hfItemContentHeaderId.Value = Hdr.Id.ToString(); } var Rows = from a in mdb.ItemContentDetails where a.ItemId == ItemId && a.ItemColorId == ItemColorId select a; if (Rows.Count() > 0) { Response.Write("<script>alert('لا يمكن ادخال نفس الصنف واللون اكثر من مرة في التركيبة الواحدة')</script>"); return; } ADAM.DataBase.ItemContentDetail ddr = new DataBase.ItemContentDetail(); ddr.ItemColorId = ItemColorId; ddr.ItemContentHeaderId = long.Parse(hfItemContentHeaderId.Value); ddr.ItemId = ItemId; ddr.ItemTypeId = long.Parse(ddlItemType.SelectedValue); ddr.ProductionLineId = long.Parse(ddlProductionLine.SelectedValue); ddr.Qty = decimal.Parse(Qty); mdb.ItemContentDetails.Add(ddr); mdb.SaveChanges(); gvItemContentData.DataBind(); }
private void SaveData() { try { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.SupplyOrderHeader dr = new DataBase.SupplyOrderHeader(); dr.RecDate = DateTime.Now; dr.SupplierId = long.Parse(ddlSupplier.SelectedValue); dr.SupplyOrderDate = DateTime.Parse(txtDate.Text); dr.SupplyOrderNo = long.Parse(txtSupplyOrderNo.Text); dr.Posted = 0; dr.CostCenter = long.Parse(ddlHeaderCostCenter.SelectedValue); Mdb.SupplyOrderHeaders.Add(dr); Mdb.SaveChanges(); for (int Row = 0; Row < gvSupplyOrder.Rows.Count; Row++) { CheckBox chkChoose = gvSupplyOrder.Rows[Row].FindControl("chkChoose") as CheckBox; if (chkChoose.Checked) { TextBox txtNote = gvSupplyOrder.Rows[Row].FindControl("txtNote") as TextBox; TextBox txtItemPrice = gvSupplyOrder.Rows[Row].FindControl("txtItemPrice") as TextBox; if (string.IsNullOrEmpty(txtNote.Text)) { txtNote.Text = "لا يوجد"; } ADAM.DataBase.SupplyOrderDetail ddr = new DataBase.SupplyOrderDetail(); if (string.IsNullOrEmpty(txtItemPrice.Text)) { ddr.ItemPrice = 0; } else { ddr.ItemPrice = decimal.Parse(txtItemPrice.Text); } ddr.Note = txtNote.Text; ADAM.DataBase.PurchaseOredrDetail Pdr = Mdb.PurchaseOredrDetails.Single(a => a.Id == long.Parse(gvSupplyOrder.DataKeys[Row].Value.ToString())); ddr.PurchaseOrderDetailsId = Pdr.Id; Pdr.IsChecked = 5; ddr.SupplyOrderHeaderId = dr.Id; Mdb.SupplyOrderDetails.Add(ddr); } } Mdb.SaveChanges(); Response.Redirect("~/PurchaseData/webSupplyOrderData.aspx"); } catch { Response.Write("<script>alert('خطأ أثناء الحفظ من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات')</script>"); } }
private void EditData() { try { if (hfID.Value != "0") { ADAM.DataBase.ADAMConnectionString db = new DataBase.ADAMConnectionString(); ADAM.DataBase.Account dr = db.Accounts.Single(a => a.Id == long.Parse(hfID.Value)); if (dr.ParentId == 0) { Response.Write("<script>alert('لا يمكن تعديل هذا الحساب')</script>"); return; } dr.AccountName = txtAccountName.Text; dr.AccountType = int.Parse(ddlAccountType.SelectedValue); dr.AccountCurrency = long.Parse(ddlCurrency.SelectedValue); dr.AccountCode = long.Parse(txtAccountCode.Text); db.SaveChanges(); gvDataBind(); } } catch { } }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { if (Session["UserID"] == null) { Response.Redirect("~/BasicData/webLogIn.aspx"); } int userid = int.Parse(Session["UserID"].ToString()); int operationid = 1; csGetPermission Per = new csGetPermission(); if (!Per.getPermission(userid, pageid, operationid)) { Response.Redirect("~/BasicData/webHomePage.aspx"); } try { ADAM.DataBase.ADAMConnectionString db = new DataBase.ADAMConnectionString(); long SupplierAccount = db.SupplierDatas.Single(a => a.Id == long.Parse(ddlVendorName.SelectedValue)).AccountId; long BoxAccount = long.Parse(ddlBoxName.SelectedValue); csJournal csAddjournal = new csJournal(); long JournalHeaderId = csAddjournal.InsertIntoJournalHeader(0, DateTime.Now, 15, "قيد فاتورة شراء", 0, long.Parse(hfSupplyheaderId.Value)); csAddjournal.InsertIntoJournalDetails(SupplierAccount, long.Parse(ddlCostCenterName.SelectedValue), decimal.Parse(lblBillPrice.Text), 0, JournalHeaderId, "من حـ / المورد"); csAddjournal.InsertIntoJournalDetails(BoxAccount, long.Parse(ddlCostCenterName.SelectedValue), 0, decimal.Parse(lblBillPrice.Text), JournalHeaderId, "الي حـ / الصندوق"); ADAM.DataBase.SupplyOrderHeader SOHdr = db.SupplyOrderHeaders.Single(a => a.Id == long.Parse(hfSupplyheaderId.Value.ToString())); SOHdr.Posted = 1; db.SaveChanges(); } catch { } }
private void SaveExchangeRequestDetailsData(long ExchangeRequestHeaderID) { if (ExchangeRequestHeaderID == 0) { return; } ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.ExchangeRequestDetailsData Detailsdr = new DataBase.ExchangeRequestDetailsData(); Detailsdr.ExchangeRequestHeaderDataId = ExchangeRequestHeaderID; Detailsdr.ItemId = long.Parse(ddlItemName.SelectedValue); Detailsdr.Qty = decimal.Parse(txtQty.Text); Detailsdr.FreeQty = decimal.Parse(txtFreeQty.Text); Detailsdr.Note = txtExchangeRequestNote.Text; Detailsdr.Status = 0; Detailsdr.IncommingOrderId = 0; Detailsdr.LocationId = 0; Detailsdr.ItemTypeId = long.Parse(ddlItemType.SelectedValue); Detailsdr.Bounce = decimal.Parse(txtBounce.Text); Detailsdr.ItemColorId = int.Parse(ddlItemColor.Text); Detailsdr.ProdctionLineId = int.Parse(ddlProdctionLine.SelectedValue); if (chkPrice.Checked) { Detailsdr.PriceTester = 1; } else { Detailsdr.PriceTester = 0; } Mdb.ExchangeRequestDetailsDatas.Add(Detailsdr); Mdb.SaveChanges(); gvExchangeRequestData.DataBind(); }
private void SaveData() { try { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.SupplierType dr = new DataBase.SupplierType(); dr.SupplierTypeCode = int.Parse(txtCode.Text); dr.SupplierTypeName = txtName.Text; var AccountRow = from a in Mdb.Accounts where a.AccountCode == long.Parse(txtAccountCode.Text) select a; if (AccountRow.Count() > 0) { ADAM.DataBase.Account accdr = Mdb.Accounts.Single(a => a.AccountCode == long.Parse(txtAccountCode.Text)); dr.AccountId = accdr.Id; } else { Response.Write("<script>alert('نوع الموردين ليس له حساب من فضلك تأكد من انشاء حساب اولا قبل الحفظ')</script>"); return; } Mdb.SupplierTypes.Add(dr); Mdb.SaveChanges(); Response.Redirect("~/MainData/webSupplierTypeData.aspx"); } catch { Response.Write("<script>alert('خطأ أثناء الحفظ من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات')</script>"); } }
private void EditData() { try { if (string.IsNullOrEmpty(txtName.Text) || string.IsNullOrEmpty(txtPrice.Text) || string.IsNullOrEmpty(txtStyle.Text) || ddlType.SelectedValue == "0") { Response.Write("<script>alert('من فضلك تأكد من ادخال كل البيانات بشكل صحيح')</script>"); return; } ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.CurrencyData dr = Mdb.CurrencyDatas.Single(a => a.Id == long.Parse(hfCurrenyId.Value)); if (Validation()) { dr.CurrencyName = txtName.Text; dr.CurrencyPrice = decimal.Parse(txtPrice.Text); dr.CurrencyStyle = txtStyle.Text; dr.CurrencyType = int.Parse(ddlType.SelectedValue); Mdb.SaveChanges(); Response.Redirect("~/Account/webCurrencyData.aspx"); } else { Response.Write("<script>alert('هذا الكود غير موجود بقاعدة البيانات')</script>"); } } catch { Response.Write("<script>alert('خطأ أثناء التعديل من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات ')</script>"); } }
private void SaveItempurcahseDetailsData(long PurchaseHeaderID) { if (PurchaseHeaderID == 0) { return; } if (decimal.Parse(txtQty.Text) > decimal.Parse(lblCurrentBalance.Text)) { Response.Write("<script>alert('لا يمكن ان تكون الكمية المصروفة اكبر من رصيد المخزن')</script>"); return; } ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.DierctSellDetail Detailsdr = new DataBase.DierctSellDetail(); Detailsdr.DirectSellHeaderId = PurchaseHeaderID; Detailsdr.ItemColorId = int.Parse(ddlItemColor.SelectedValue); Detailsdr.ItemId = long.Parse(ddlItemName.SelectedValue); Detailsdr.Note = txtPurchaseNote.Text; Detailsdr.Qty = decimal.Parse(txtQty.Text); Mdb.DierctSellDetails.Add(Detailsdr); Mdb.SaveChanges(); gvPurchaseDetailsData.DataBind(); }
private void EditData() { try { if (string.IsNullOrEmpty(txtDate.Text) || string.IsNullOrEmpty(txtDirectSellOrderNo.Text) || ddlDivision.SelectedValue == "0" || ddlDepartment.SelectedValue == "0" || ddlEmployee.SelectedValue == "0" || ddlItemType.SelectedValue == "0") { Response.Write("<script>alert('من فضلك تأكد من ادخال كل البيانات بشكل صحيح')</script>"); return; } ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.DirectSellData dr = Mdb.DirectSellDatas.Single(a => a.DirectSellNo == long.Parse(txtDirectSellOrderNo.Text)); if (Validation()) { dr.DirectSellDate = DateTime.Parse(txtDate.Text); dr.DirectSellNo = long.Parse(txtDirectSellOrderNo.Text); dr.EmpId = long.Parse(ddlEmployee.SelectedValue); Mdb.SaveChanges(); Response.Write("<script>alert('تمت عملية التعديل بنجاح')</script>"); } else { Response.Write("<script>alert('هذا الكود غير موجود بقاعدة البيانات')</script>"); } } catch { Response.Write("<script>alert('خطأ أثناء التعديل من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات ')</script>"); } }
protected void btnEdit_Click(object sender, ImageClickEventArgs e) { if (Session["UserID"] == null) { Response.Redirect("~/BasicData/webLogIn.aspx"); } int userid = int.Parse(Session["UserID"].ToString()); int operationid = 2; csGetPermission Per = new csGetPermission(); if (!Per.getPermission(userid, pageid, operationid)) { Response.Redirect("~/BasicData/webHomePage.aspx"); } try { ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.ItemContentDetail details = mdb.ItemContentDetails.Single(a => a.Id == long.Parse(hfItemContentDetailsId.Value)); details.ItemColorId = int.Parse(ddlItemColor.SelectedValue); details.ItemContentHeaderId = long.Parse(hfItemContentHeaderId.Value); details.ItemId = long.Parse(ddlItemName.SelectedValue); details.ItemTypeId = long.Parse(ddlItemType.SelectedValue); details.ProductionLineId = long.Parse(ddlProductionLine.SelectedValue); details.Qty = decimal.Parse(txtQty.Text); mdb.SaveChanges(); gvItemContentData.DataBind(); } catch { } }
private void SaveData() { try { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.BoxData dr = new DataBase.BoxData(); dr.BoxCode = int.Parse(txtCode.Text); dr.BoxName = txtName.Text; dr.Note = txtNote.Text; var Rows = from a in Mdb.Accounts where a.AccountCode == long.Parse(txtAccount.Text) select a; if (Rows.Count() > 0) { ADAM.DataBase.Account accdr = Mdb.Accounts.Single(a => a.AccountCode == long.Parse(txtAccount.Text)); dr.AccountId = accdr.Id; } else { Response.Write("<script>alert('من فضلك تأكد من رقم الحساب')</script>"); return; } Mdb.BoxDatas.Add(dr); Mdb.SaveChanges(); Response.Redirect("~/Account/webBox.aspx"); } catch { Response.Write("<script>alert('خطأ أثناء الحفظ من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات')</script>"); } }
private void SaveData() { try { if (hfID.Value == "0") { ADAM.DataBase.ADAMConnectionString db = new DataBase.ADAMConnectionString(); ADAM.DataBase.Account olddr = db.Accounts.Single(a => a.Id == long.Parse(hfParentId.Value)); ADAM.DataBase.Account dr = new DataBase.Account(); dr.AccountCode = long.Parse(txtAccountCode.Text); dr.AccountName = txtAccountName.Text; dr.AccountType = int.Parse(ddlAccountType.SelectedValue); dr.AccountLevel = olddr.AccountLevel + 1; dr.ParentId = olddr.Id; dr.AccountCurrency = long.Parse(ddlCurrency.SelectedValue); dr.MasterCode = olddr.MasterCode; dr.Mezania3momia = 0; dr.Reb7and5sara = 0; dr.H7sabElMotagra = 0; db.Accounts.Add(dr); db.SaveChanges(); gvDataBind(); } } catch { } }
private void EditData() { try { if (string.IsNullOrEmpty(txtCode.Text) || string.IsNullOrEmpty(txtName.Text) || ddlCountry.SelectedValue == "0" || ddlCity.SelectedValue == "0") { Response.Write("<script>alert('من فضلك تأكد من ادخال كل البيانات بشكل صحيح')</script>"); return; } ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.GovernorateData dr = Mdb.GovernorateDatas.Single(a => a.GovernorateCode == long.Parse(txtCode.Text)); if (Validation()) { dr.CityId = long.Parse(ddlCity.SelectedValue); dr.GovernorateName = txtName.Text; Mdb.SaveChanges(); Response.Write("<script>alert('تمت عملية التعديل بنجاح')</script>"); } else { Response.Write("<script>alert('هذا الكود غير موجود بقاعدة البيانات')</script>"); } } catch { Response.Write("<script>alert('خطأ أثناء التعديل من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات ')</script>"); } }
private void EditData() { try { if (string.IsNullOrEmpty(txtNickName.Text) || string.IsNullOrEmpty(txtPassword.Text) || ddlEmployee.SelectedValue == "0" || ddlIsLock.SelectedValue == "0") { Response.Write("<script>alert('من فضلك تأكد من ادخال كل البيانات بشكل صحيح')</script>"); return; } ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.UserData dr = Mdb.UserDatas.Single(a => a.UserID == long.Parse(ddlEmployee.SelectedValue)); if (Validation()) { dr.NickName = txtNickName.Text; dr.Password = txtPassword.Text; dr.IsLock = int.Parse(ddlIsLock.SelectedValue); Mdb.SaveChanges(); Response.Write("<script>alert('تمت عملية التعديل بنجاح')</script>"); } else { Response.Write("<script>alert('هذا الكود غير موجود بقاعدة البيانات')</script>"); } } catch { Response.Write("<script>alert('خطأ أثناء التعديل من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات ')</script>"); } }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { if (Session["UserID"] == null) { Response.Redirect("~/BasicData/webLogIn.aspx"); } int userid = int.Parse(Session["UserID"].ToString()); int operationid = 1; csGetPermission Per = new csGetPermission(); if (!Per.getPermission(userid, pageid, operationid)) { Response.Redirect("~/BasicData/webHomePage.aspx"); } try { ADAM.DataBase.ADAMConnectionString db = new DataBase.ADAMConnectionString(); ADAM.DataBase.JournalHeader dr = db.JournalHeaders.Single(a => a.Id == long.Parse(gvJorunal.SelectedDataKey.Value.ToString())); dr.Posted = 1; db.SaveChanges(); gvJorunal.DataBind(); hfJournalHeaderId.Value = "0"; gvJorunalDetails.DataBind(); } catch { } }
private void DeleteData() { try { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.Department dr = Mdb.Departments.Single(a => a.Code == long.Parse(txtCode.Text)); var DivisionRows = from a in Mdb.divisions where a.DepartmentId == dr.Id select a; if (DivisionRows.Count() > 0) { Response.Write("<script>alert('لا يمكن حذف الادارة لوجود اقسام تابعه لها')</script>"); return; } var EmployeeRows = from a in Mdb.EmployeeDatas where a.DepartmentId == dr.Id select a; if (EmployeeRows.Count() > 0) { Response.Write("<script>alert('لا يمكن الحذف لوجود موظفين مرتبطين بها')</script>"); return; } Mdb.Departments.Remove(dr); Mdb.SaveChanges(); txtName.Text = txtCode.Text = ""; Response.Write("<script>alert('تمت عملية الحذف نجاح')</script>"); } catch { Response.Write("<script>alert('خطأ أثناء الحذف من فضلك تأكد من ادخال البيانات بشكل صحيح او من الاتصال بقاعدة البيانات')</script>"); } }
private void EditData() { try { if (string.IsNullOrEmpty(txtCode.Text) || string.IsNullOrEmpty(txtName.Text)) { Response.Write("<script>alert('من فضلك تأكد من ادخال كل البيانات بشكل صحيح')</script>"); return; } ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.Department dr = Mdb.Departments.Single(a => a.Code == long.Parse(txtCode.Text)); if (Validation()) { dr.Name = txtName.Text; Mdb.SaveChanges(); Response.Write("<script>alert('تمت عملية التعديل بنجاح')</script>"); } else { Response.Write("<script>alert('هذا الكود غير موجود بقاعدة البيانات')</script>"); } } catch { Response.Write("<script>alert('خطأ أثناء التعديل من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات ')</script>"); } }
protected void gvItemTypeProductionLine_SelectedIndexChanged(object sender, EventArgs e) { ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.ItemTypeProdcutionLine dr = mdb.ItemTypeProdcutionLines.Single(a => a.Id == long.Parse(gvItemTypeProductionLine.SelectedDataKey.Value.ToString())); mdb.ItemTypeProdcutionLines.Remove(dr); mdb.SaveChanges(); }
protected void btnShowReport_Click(object sender, ImageClickEventArgs e) { if (Session["UserID"] == null) { Response.Redirect("~/BasicData/webLogIn.aspx"); } int userid = int.Parse(Session["UserID"].ToString()); int operationid = 7; csGetPermission Per = new csGetPermission(); if (!Per.getPermission(userid, pageid, operationid)) { Response.Redirect("~/BasicData/webHomePage.aspx"); } ADAM.DataBase.ADAMConnectionString db = new DataBase.ADAMConnectionString(); for (int Row = 0; Row < gvSupplyOrder.Rows.Count; Row++) { TextBox txtPrice = gvSupplyOrder.Rows[Row].FindControl("txtPrice") as TextBox; if (!string.IsNullOrEmpty(txtPrice.Text)) { long SupplyOrderDetailsId = long.Parse(gvSupplyOrder.DataKeys[Row].Value.ToString()); ADAM.DataBase.SupplyOrderDetail dr = db.SupplyOrderDetails.Single(a => a.Id == SupplyOrderDetailsId); dr.ItemPrice = decimal.Parse(txtPrice.Text); } } db.SaveChanges(); gvSupplyOrder.DataBind(); }
private void SaveData() { try { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.EmployeeData dr = new DataBase.EmployeeData(); dr.Code = long.Parse(txtCode.Text); dr.Address = txtAddress.Text; dr.BirthDate = DateTime.Parse(txtBirthDate.Text); dr.Email = txtEmail.Text; dr.FaxNo = txtFaxNo.Text; dr.FirstMobileNo = txtFirstMobileNo.Text; dr.FirstName = txtFirstName.Text; dr.FirstPhone = txtFirstPhone.Text; dr.IdNo = txtIdNo.Text; dr.LastName = txtLastName.Text; dr.SecondMobileNo = txtSecondMobileNo.Text; dr.SecondPhone = txtSecondPhone.Text; dr.StartJobDate = DateTime.Parse(txtStartJobDate.Text); dr.ContractType = int.Parse(ddlContractType.SelectedValue); dr.DepartmentId = long.Parse(ddlDepartment.SelectedValue); dr.DivisionId = long.Parse(ddlDivision.SelectedValue); dr.InsuranceStatus = int.Parse(ddlInsuranceStatus.SelectedValue); dr.JobId = long.Parse(ddlJob.SelectedValue); dr.MaritalStatus = int.Parse(ddlMaritalStatus.SelectedValue); dr.MilitaryStatus = int.Parse(ddlMilitaryStatus.SelectedValue); dr.QualificationId = long.Parse(ddlQualification.SelectedValue); dr.Religion = int.Parse(ddlReligion.SelectedValue); dr.Sex = int.Parse(ddlSex.SelectedValue); dr.CountryId = long.Parse(ddlCountry.SelectedValue); dr.CityId = long.Parse(ddlCity.SelectedValue); dr.GovernorateId = long.Parse(ddlGovernorate.SelectedValue); dr.AreaId = long.Parse(ddlArea.SelectedValue); if (chkISSalesRepresentative.Checked) { dr.ISSalesRepresentative = true; } else { dr.ISSalesRepresentative = false; } var AccountRow = from a in Mdb.Accounts where a.AccountCode == long.Parse(txtAccountCode.Text) select a; if (AccountRow.Count() > 0) { ADAM.DataBase.Account accdr = Mdb.Accounts.Single(a => a.AccountCode == long.Parse(txtAccountCode.Text)); dr.AccountId = accdr.Id; } else { Response.Write("<script>alert('هذا الموظف ليس له حساب من فضلك تأكد من انشاء حساب اولا قبل الحفظ')</script>"); return; } Mdb.EmployeeDatas.Add(dr); Mdb.SaveChanges(); Response.Redirect("~/MainData/webEmployeeData.aspx"); } catch { Response.Write("<script>alert('خطأ أثناء الحفظ من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات')</script>"); } }
protected void btndeletePurchaseItem_Click(object sender, ImageClickEventArgs e) { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.DierctSellDetail PurcahseOrderdetaildr = Mdb.DierctSellDetails.Single(a => a.Id == long.Parse(hfPurchaseDetailsId.Value)); Mdb.DierctSellDetails.Remove(PurcahseOrderdetaildr); Mdb.SaveChanges(); gvPurchaseDetailsData.DataBind(); var PurchaseOrderHeaderRows = from a in Mdb.DierctSellDetails where a.DirectSellHeaderId == long.Parse(hfId.Value) select a; if (PurchaseOrderHeaderRows.Count() <= 0) { ADAM.DataBase.DirectSellData PurchaseHeadedr = Mdb.DirectSellDatas.Single(a => a.Id == long.Parse(hfId.Value)); Mdb.DirectSellDatas.Remove(PurchaseHeadedr); Mdb.SaveChanges(); btnNew_Click(sender, e); } }
private void EditData() { try { if (ValidationData()) { ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString(); ADAM.DataBase.Item dr = Mdb.Items.Single(a => a.Code == long.Parse(txtCode.Text) && a.ItemTypeId == long.Parse(ddlItemType.SelectedValue)); if (Validation()) { #region InsertImgIntoSql string filePath = fulImage.PostedFile.FileName; string filename = Path.GetFileName(filePath); string ext = Path.GetExtension(filename); Stream fs = fulImage.PostedFile.InputStream; BinaryReader br = new BinaryReader(fs); Byte[] bytes = br.ReadBytes((Int32)fs.Length); #endregion if (bytes.Count() != 0) { dr.Image = bytes; } dr.ItemStatus = int.Parse(ddlItemStatus.SelectedValue); dr.ItemTypeId = long.Parse(ddlItemType.SelectedValue); dr.ItemunitId = long.Parse(ddlItemUnit.SelectedValue); dr.LimitQty = decimal.Parse(txtLimitQty.Text); dr.Note = txtNote.Text; dr.Sex = int.Parse(ddlSex.SelectedValue); dr.Specification = txtSpecification.Text; dr.ProductionLineId = int.Parse(ddlProductionLine.SelectedValue); dr.Name = txtName.Text; Mdb.SaveChanges(); #region showImg if (bytes.Count() != 0) { Binary binary = dr.Image; byte[] Nbytes; string Base64String = string.Empty; Nbytes = binary.ToArray(); Base64String = Convert.ToBase64String(bytes, 0, Nbytes.Length); ImgItem.ImageUrl = "data:image/png;base64," + Base64String; } #endregion Response.Write("<script>alert('تمت عملية التعديل بنجاح')</script>"); } else { Response.Write("<script>alert('هذا الكود غير موجود بقاعدة البيانات')</script>"); } } } catch { Response.Write("<script>alert('خطأ أثناء التعديل من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات ')</script>"); } }