protected void uiGridViewItems_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditItem") { IStock.BLL.Items objData = new IStock.BLL.Items(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxName.Text = objData.Name; uiTextBoxCode.Text = objData.ItemCode; uiTextBoxDesc.Text = objData.Description; if (!objData.IsColumnNull("Quantity")) uiTextBoxQty.Text = objData.Quantity.ToString(); if(!objData.IsColumnNull("ReOrderLevel")) uiTextBoxReOrderLevel.Text = objData.ReOrderLevel.ToString(); IStock.BLL.ItemGroups group = new IStock.BLL.ItemGroups(); group.LoadByPrimaryKey(Convert.ToInt32(objData.GroupID)); uiLabelGroup.Text = group.Name; IStock.BLL.ItemCategories cat = new ItemCategories(); if (!string.IsNullOrEmpty(uiDropDownListCats.SelectedValue)) { cat.LoadByPrimaryKey(Convert.ToInt32(uiDropDownListCats.SelectedValue)); } else cat.LoadByPrimaryKey(group.ItemCategoryID); uiLabelCat.Text = cat.Name; uiPanelAllItems.Visible = false; uiPanelEditItems.Visible = true; CurrentItem = objData; BindPrices(); uiPanelActions.Visible = true; } else if (e.CommandName == "DeleteItem") { try { IStock.BLL.Items objData = new IStock.BLL.Items(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentItem = null; BindData(); } catch (Exception ex) { uipanelError.Visible = true; } } else if (e.CommandName == "GetItemBalance") { Session["Report_ItemIDForBalance"] = e.CommandArgument.ToString(); Session["CurrentReport"] = "Report_GetItemsBalances"; Response.Redirect("Reports.aspx"); } }
public string[] GetItems(string query, int ClientId) { /*string query = ""; query = Context.Request.Form["query"].ToString();*/ Clients client = new Clients(); client.LoadByPrimaryKey(ClientId); int clientTypeID = 0 ; if(client.RowCount > 0) clientTypeID= client.ClientTypeID; Items items = new Items(); List<string> listString = new List<string>(); if (clientTypeID != 0) { items.SearchItemsAjax(query, clientTypeID); if (items.RowCount > 0) { for (int i = 0; i < items.RowCount; i++) { listString.Add(items.ItemID + "##" + items.Name + "##" + items.GetColumn("Price").ToString()); //ItemsJSON += "{'Name': '" + items.ItemCode + " - " + items.Name + "' , 'ItemID': '" + items.ItemID + "'}"; items.MoveNext(); } } } else { items.SearchItems(query); if (items.RowCount > 0) { for (int i = 0; i < items.RowCount; i++) { listString.Add(items.ItemID + "##" + items.Name); //ItemsJSON += "{'Name': '" + items.ItemCode + " - " + items.Name + "' , 'ItemID': '" + items.ItemID + "'}"; items.MoveNext(); } } } string[] str = listString.ToArray(); //Context.Response.Output.Write(ItemsJSON); //Context.Response.End(); return str; }
public string GetItems(string term) { string ItemsJSON = ""; Items items = new Items(); items.SearchItems(term); if (items.RowCount > 0) { ItemsJSON = "["; for (int i = 0; i < items.RowCount; i++) { ItemsJSON += "'" + items.Name + "'"; //ItemsJSON += "{'Name': '" + items.ItemCode + " - " + items.Name + "' , 'ItemID': '" + items.ItemID + "'}"; if (items.MoveNext()) ItemsJSON += ","; } ItemsJSON += "]"; } Context.Response.Output.Write(ItemsJSON); Context.Response.End(); return string.Empty; }
private void BindData() { IStock.BLL.Items objData = new IStock.BLL.Items(); if (!string.IsNullOrEmpty(uiDropDownListGroup.SelectedValue)) objData.SearchItems(uiTextBoxSearch.Text, Convert.ToInt32(uiDropDownListGroup.SelectedValue)); else objData.SearchItems(uiTextBoxSearch.Text); uiGridViewItems.DataSource = objData.DefaultView; uiGridViewItems.DataBind(); }
protected void uiLinkButtonOK_Click(object sender, EventArgs e) { IStock.BLL.Items item = new IStock.BLL.Items(); if (CurrentItem == null) item.AddNew(); else item = CurrentItem; item.Name = uiTextBoxName.Text; item.Description = uiTextBoxDesc.Text; if(!string.IsNullOrEmpty(uiTextBoxQty.Text)) item.Quantity = Convert.ToInt32(uiTextBoxQty.Text); item.ItemCode = uiTextBoxCode.Text; item.GroupID = Convert.ToInt32(uiDropDownListGroup.SelectedValue); if (!string.IsNullOrEmpty(uiTextBoxReOrderLevel.Text)) item.ReOrderLevel = Convert.ToInt32(uiTextBoxReOrderLevel.Text); item.Save(); //ClearFields(); CurrentItem = item; uiPanelEditItems.Visible = true; uiPanelAllItems.Visible = false; BindData(); BindPrices(); uiPanelActions.Visible = true; }
protected void uiLinkButtonCancel_Click(object sender, EventArgs e) { ClearFields(); CurrentItem = null; uiGridViewPrices.DataSource = null; uiGridViewPrices.DataBind(); uiPanelEditItems.Visible = false; uiPanelAllItems.Visible = true; uiPanelActions.Visible = false; }
protected void uiLinkButtonBack_Click(object sender, EventArgs e) { ClearFields(); CurrentItem = null; uiPanelEditItems.Visible = false; uiPanelAllItems.Visible = true; uiPanelActions.Visible = false; }
protected void uiLinkButtonAdd_Click(object sender, EventArgs e) { ClearFields(); CurrentItem = null; uiGridViewPrices.DataSource = null; uiGridViewPrices.DataBind(); IStock.BLL.Items item = new IStock.BLL.Items(); uiTextBoxCode.Text = item.GenerateItemCode(Convert.ToInt32(uiDropDownListGroup.SelectedValue)).ToString(); uiPanelEditItems.Visible = true; uiPanelAllItems.Visible = false; uiPanelActions.Visible = false; IStock.BLL.ItemCategories cat = new ItemCategories(); cat.LoadByPrimaryKey(Convert.ToInt32(uiDropDownListCats.SelectedValue)); uiLabelCat.Text = cat.Name; IStock.BLL.ItemGroups group = new IStock.BLL.ItemGroups(); group.LoadByPrimaryKey(Convert.ToInt32(uiDropDownListGroup.SelectedValue)); uiLabelGroup.Text = group.Name; }
private void LoadReport() { uiReportViewerMain.LocalReport.ReportPath = BaseReportPath + CurrentReport + ".rdlc"; switch (CurrentReport) { case "Report_GetItemsBalances": if (Session["Report_ItemIDForBalance"] != null) { IStock.BLL.Items items = new IStock.BLL.Items(); items.Report_GetItemsBalances(Convert.ToInt32(Session["Report_ItemIDForBalance"].ToString())); uiReportViewerMain.LocalReport.DataSources.Clear(); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource(CurrentReport + "DataSet", items.DefaultView)); uiReportViewerMain.LocalReport.SetParameters(new ReportParameter("ItemID", Session["Report_ItemIDForBalance"].ToString())); uiReportViewerMain.LocalReport.Refresh(); } break; case "Report_GetClientCredit": if (Session["Report_ClientIDForCredit"] != null) { IStock.BLL.Clients clients = new IStock.BLL.Clients(); clients.Report_GetClientCredit(Convert.ToInt32(Session["Report_ClientIDForCredit"].ToString())); uiReportViewerMain.LocalReport.DataSources.Clear(); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource(CurrentReport + "DataSet", clients.DefaultView)); uiReportViewerMain.LocalReport.SetParameters(new ReportParameter("ClientID", Session["Report_ClientIDForCredit"].ToString())); uiReportViewerMain.LocalReport.Refresh(); } break; case "Report_DeliveryOrder": if (Session["Report_DeliveryOrderID"] != null) { IStock.BLL.DeliveryOrder order = new IStock.BLL.DeliveryOrder(); order.Report_DeliveryOrder(Convert.ToInt32(Session["Report_DeliveryOrderID"].ToString())); IStock.BLL.DeliveryOrder orderT = new IStock.BLL.DeliveryOrder(); orderT.Report_DeliveryOrder(Convert.ToInt32(Session["Report_DeliveryOrderID"].ToString())); orderT.GetDeliveryOrderTotalsForReport(orderT.DeliveryOrderID); IStock.BLL.DeliveryOrderDetails details = new DeliveryOrderDetails(); details.GetDeliveryOrderDetails(order.DeliveryOrderID); IStock.BLL.ClientReturns cr = new IStock.BLL.ClientReturns(); cr.GetClientReturnByDeliveryOrderID(order.DeliveryOrderID); uiReportViewerMain.LocalReport.DataSources.Clear(); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource(CurrentReport + "DataSet", order.DefaultView)); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource(CurrentReport + "DetailsDataSet", details.DefaultView)); if (cr.RowCount > 0) { cr.GetClientReturnTotalsForReport(cr.ClientReturnID); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource("GetClientReturnTotalDataSet", cr.DefaultView)); } else uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource("GetClientReturnTotalDataSet", new DataView())); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource("DeliveryOrderTotalDataSet", orderT.DefaultView)); uiReportViewerMain.LocalReport.SetParameters(new ReportParameter("DeliveryOrderID", Session["Report_DeliveryOrderID"].ToString())); uiReportViewerMain.LocalReport.Refresh(); } break; case "Report_ClientReturn": if (Session["Report_ClientReturnID"] != null) { IStock.BLL.ClientReturns cr = new IStock.BLL.ClientReturns(); cr.Report_ClientReturn(Convert.ToInt32(Session["Report_ClientReturnID"].ToString())); IStock.BLL.ClientReturnDetails details = new ClientReturnDetails(); details.GetClientReturnDetails(cr.ClientReturnID); uiReportViewerMain.LocalReport.DataSources.Clear(); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource(CurrentReport + "DataSet", cr.DefaultView)); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource(CurrentReport + "DetailsDataSet", details.DefaultView)); uiReportViewerMain.LocalReport.SetParameters(new ReportParameter("ClientReturn", Session["Report_ClientReturnID"].ToString())); uiReportViewerMain.LocalReport.Refresh(); } break; case "Report_PurchaseOrder": if (Session["Report_PuchaseOrderID"] != null) { IStock.BLL.PurchaseOrders pr = new IStock.BLL.PurchaseOrders(); pr.Report_PurchaseOrder(Convert.ToInt32(Session["Report_PuchaseOrderID"].ToString())); IStock.BLL.PurchaseOrderDetails details = new PurchaseOrderDetails(); details.GetPurchaseOrderDetails(pr.PurchaseOrderID); uiReportViewerMain.LocalReport.DataSources.Clear(); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource(CurrentReport + "DataSet", pr.DefaultView)); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource(CurrentReport + "DetailsDataSet", details.DefaultView)); uiReportViewerMain.LocalReport.SetParameters(new ReportParameter("PurchaseOrderID", Session["Report_PuchaseOrderID"].ToString())); uiReportViewerMain.LocalReport.Refresh(); } break; case "Report_Payment": if (Session["Report_PaymentID"] != null) { IStock.BLL.Payments payment = new IStock.BLL.Payments(); payment.Report_Payments(Convert.ToInt32(Session["Report_PaymentID"].ToString())); uiReportViewerMain.LocalReport.DataSources.Clear(); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource(CurrentReport + "DataSet", payment.DefaultView)); uiReportViewerMain.LocalReport.SetParameters(new ReportParameter("PaymentID", Session["Report_PaymentID"].ToString())); uiReportViewerMain.LocalReport.Refresh(); } break; default: break; } }