public void AddRow(BigRow bigRow) { KeyCount += 1; bool added = false; foreach (var family in bigRow.GetFamilyNames()) { foreach (var field in bigRow.GetFields(family)) { AddRow(bigRow.KeyString, family, field.ColumnName, field.StringValue, field.Timestamp); added = true; } } if (!added) { // No data for this key? Add an entry anyway... AddRow(bigRow.KeyString, null, null, null, null); } }
private void displayRetreivalForm(int retrievalNo) { // Set Session Value Session["RetrievalNo"] = retrievalNo; // Set Editable Session["Editable"] = RetrievalFormController.IsRetrievalFormEditable(retrievalNo); // Get Retreival Details var retreivalDetails = RetrievalFormController.GetRetrievalDetailsOf(retrievalNo); data.Clear(); // Create the Big and Small Row Objects to display { // Get the list of items var items = retreivalDetails.Select(retDet => retDet.StationeryCatalogue).Distinct().ToList(); // To track CSS bool isAlternate = false; // For each item, create the big row and populate the values using retreival details foreach (var item in items) { BigRow temp = new BigRow() { Bin = item.Bin, ItemCode = item.ItemNo, Description = item.Description, Needed = 0, Backlog = 0, Reterived = 0, Maximum = item.CurrentQty ?? 0, Breakdown = new List <SmallRow>(), DepartmentCount = 0, CssClass = isAlternate ? "active" : "default", }; var itemSpecificDetails = retreivalDetails.Where(retDet => retDet.ItemNo.Equals(item.ItemNo)).ToList(); foreach (var detail in itemSpecificDetails) { SmallRow smallTemp = new SmallRow() { Department = detail.DeptCode, Needed = detail.Needed ?? 0, Backlog = detail.BackLogQty ?? 0, Actual = detail.Actual ?? 0, CssClass = isAlternate ? "active" : "default", ItemNo = item.ItemNo }; temp.Needed += smallTemp.Needed; temp.Backlog += smallTemp.Backlog; temp.Breakdown.Add(smallTemp); } isAlternate = !isAlternate; // Toggle CSS temp.DepartmentCount = temp.Breakdown.Count; data.Add(temp); } } // Display the Data BigRepeater.DataSource = data; BigRepeater.DataBind(); // Save the Data Session["DisplayedData"] = data; }
protected void SaveFormButton_Click(object sender, EventArgs e) { int retrievalNo = (int)Session["RetrievalNo"]; List <String> deptCodes = new List <string>(); List <String> itemNos = new List <string>(); List <int> actualList = new List <int>(); if (!IsValid) { // Page Validation failed somewhere, don't do anything return; } if (Session["RetrievalNo"] == null) { Session["Error"] = "No Retrieval detected, please select one first."; return; } // Save values to data int i = 0, j = 0; bool allZeroes = true; data = (List <BigRow>)Session["DisplayedData"]; foreach (RepeaterItem item in BigRepeater.Items) { Repeater SmallRepeater = (Repeater)item.FindControl("SmallRepeater"); BigRow bigRow = data[i]; j = 0; foreach (RepeaterItem smallItem in SmallRepeater.Items) { TextBox inputTextBox = (TextBox)smallItem.FindControl("ActualTextBox"); bigRow.Breakdown[j].Actual = Convert.ToInt32(inputTextBox.Text); allZeroes = allZeroes && (bigRow.Breakdown[j].Actual == 0); j++; } i++; } if (allZeroes) { Session["Error"] = "At least one item must be retrieved in order to submit."; return; } // Fill the arguments foreach (BigRow row in data) { foreach (SmallRow detail in row.Breakdown) { deptCodes.Add(detail.Department); itemNos.Add(row.ItemCode); actualList.Add(detail.Actual); } } // Submit the arguments to the controller if (RetrievalController.SubmitRetrieval( (int)Session["RetrievalNo"], deptCodes, itemNos, actualList )) { Session["RetrievalProcessed"] = "Retrieval #" + (int)Session["RetrievalNo"] + " Submitted."; } else { Session["Error"] = "An error has occured. Please try again after sometime."; } displayRetreivalForm((int)Session["RetrievalNo"]); }
protected T Inflate <T>(BigRow row) { return((T)ReflectionCache.For <T>().CreateInstance(row.Key, row.GetValues)); }
protected T Inflate <T>(BigRow row, T prototype) { return((T)ReflectionCache.For <T>().PopulateInstance(row.Key, row.GetValues, prototype)); }
protected T Inflate <T>(BigRow row) { throw new NotImplementedException(); }
public void SetFamily <T>(BigRow row) { }