// - code for update protected void btnUpdate_Click(object sender, EventArgs e) { if (tbxGroupItem.Text.Equals(string.Empty)) { showMessageBox _MsgBox = new showMessageBox(this.Page, "Error no item", "Please enter a Group Item Name"); } else { TrackerDotNet.control.ItemTypeTbl _ITT = new ItemTypeTbl(); SysDataTbl _SysData = new SysDataTbl(); _ITT.ItemDesc = tbxGroupItem.Text; _ITT.ItemDetail = tbxGroupDesc.Text; _ITT.ItemEnabled = true; _ITT.ItemsCharacteritics = "Group Item-update"; _ITT.ItemShortName = tbxGroupShortName.Text; _ITT.ServiceTypeID = _SysData.GetGroupItemTypeID(); _ITT.SortOrder = ItemTypeTbl.CONST_NEEDDESCRIPTION_SORT_ORDER + 5; _ITT.ItemTypeID = Convert.ToInt32(lblGroupItemID.Text); bool _success = _ITT.UpdateItem(_ITT); showMessageBox _MsgBox = new showMessageBox(this.Page, "Status", _success ? "Group item update" : "Error updating group item"); ReturnToPrevPage(); } }
protected void btnAdd_Click(object sender, EventArgs e) { if (tbxGroupItem.Text.Equals(string.Empty)) { showMessageBox _MsgBox = new showMessageBox(this.Page, "Error no item", "Please enter a Group Item Name"); } else { TrackerDotNet.control.ItemTypeTbl _ITT = new ItemTypeTbl(); if (_ITT.GroupOfThisNameExists(tbxGroupItem.Text)) { showMessageBox _MsgBox = new showMessageBox(this.Page, "name exists", "Group Name: " + tbxGroupItem.Text + " Exists. Please enter a different Group Item Name"); } else { SysDataTbl _SysData = new SysDataTbl(); _ITT.ItemDesc = tbxGroupItem.Text; _ITT.ItemDetail = tbxGroupDesc.Text; _ITT.ItemEnabled = true; _ITT.ItemsCharacteritics = "Group Item"; _ITT.ItemShortName = tbxGroupShortName.Text; _ITT.ServiceTypeID = _SysData.GetGroupItemTypeID(); _ITT.SortOrder = ItemTypeTbl.CONST_NEEDDESCRIPTION_SORT_ORDER + 5; bool _success = _ITT.InsertItem(_ITT); showMessageBox _MsgBox = new showMessageBox(this.Page, "Status", _success ? "Group item added" : "Error adding group item"); ReturnToPrevPage(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // check if name passed in and populate. Session[CONST_SESSION_RETURNURL] = (Request.UrlReferrer == null) ? "" : Request.UrlReferrer.OriginalString.ToString(); if (Request.QueryString[CONST_QRYSTR_GROUPITEMID] != null) { // this is an edit not a add ItemTypeTbl _Item = new ItemTypeTbl(); _Item = _Item.GetItemTypeFromID(Convert.ToInt32(Request.QueryString[CONST_QRYSTR_GROUPITEMID].ToString())); if (!_Item.ItemTypeID.Equals(TrackerDb.CONST_INVALIDID)) { lblGroupItemID.Visible = true; btnAdd.Visible = false; btnUpdate.Visible = true; lblGroupItemID.Text = _Item.ItemTypeID.ToString(); tbxGroupItem.Text = _Item.ItemDesc; tbxGroupDesc.Text = _Item.ItemDetail; tbxGroupShortName.Text = _Item.ItemShortName; // upnlGroupDetail.Update(); } } } }
/// <summary> /// From the client selected create a temporary table from the items in the order /// Then diosplay another for for the user to select how to close the order /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOrderDelivered_Click(object sender, EventArgs e) { // General VARs OrderHeaderData _OrderHeaderData = Get_dvOrderHeaderData(false); TempOrdersData _TempOrdersData = new TempOrdersData(); TempOrdersDAL _TempOrdersDAL = new TempOrdersDAL(); // DELETE data from TempOrdersHeaderTblData if (!_TempOrdersDAL.KillTempOrdersData()) { ltrlStatus.Text = "Error deleting Temp Table"; } // add parameters in the order they appear in the update command // first summary / header data _TempOrdersData.HeaderData.CustomerID = _OrderHeaderData.CustomerID; _TempOrdersData.HeaderData.OrderDate = _OrderHeaderData.OrderDate; _TempOrdersData.HeaderData.RoastDate = _OrderHeaderData.RoastDate; _TempOrdersData.HeaderData.RequiredByDate = _OrderHeaderData.RequiredByDate; _TempOrdersData.HeaderData.ToBeDeliveredByID = Convert.ToInt32(_OrderHeaderData.ToBeDeliveredBy); _TempOrdersData.HeaderData.Confirmed = _OrderHeaderData.Confirmed; _TempOrdersData.HeaderData.Done = _OrderHeaderData.Done; _TempOrdersData.HeaderData.Notes = _OrderHeaderData.Notes; //_TempOrdersData.HeaderData.CustomerID = Convert.ToInt32(dvOrderHeaderGetDDLControlSelectedValue("ddlContacts")); //_TempOrdersData.HeaderData.OrderDate = Convert.ToDateTime(dvOrderHeaderGetLabelValue("lblOrderDate")); //_TempOrdersData.HeaderData.RoastDate = Convert.ToDateTime(dvOrderHeaderGetLabelValue("lblRoastDate")); //_TempOrdersData.HeaderData.RequiredByDate = Convert.ToDateTime(dvOrderHeaderGetLabelValue("lblRequiredByDate")); //_TempOrdersData.HeaderData.ToBeDeliveredByID = Convert.ToInt32(dvOrderHeaderGetDDLControlSelectedValue("ddlToBeDeliveredBy")); //_TempOrdersData.HeaderData.Confirmed = dvOrderHeaderGetCheckBoxValue("cbxConfirmed"); //_TempOrdersData.HeaderData.Done = dvOrderHeaderGetCheckBoxValue("cbxDone"); //_TempOrdersData.HeaderData.Notes = dvOrderHeaderGetLabelValue("lblNotes"); // now the line data (the TO header is set when we add both using the one class TempOrders ItemTypeTbl _ItemType = new ItemTypeTbl(); foreach (GridViewRow _gv in gvOrderLines.Rows) { TempOrdersLinesTbl _LineData = new TempOrdersLinesTbl(); DropDownList _gvItemDesc = (DropDownList)_gv.FindControl("ddlItemDesc"); Label _gvItemQty = (Label)_gv.FindControl("lblQuantityOrdered"); DropDownList _gvItemPackaging = (DropDownList)_gv.FindControl("ddlPackaging"); Label _gvOrderID = (Label)_gv.FindControl("lblOrderID"); _LineData.ItemID = Convert.ToInt32(_gvItemDesc.SelectedValue); _LineData.Qty = Convert.ToDouble(_gvItemQty.Text); _LineData.PackagingID = Convert.ToInt32(_gvItemPackaging.SelectedValue); _LineData.ServiceTypeID = _ItemType.GetServiceID(_LineData.ItemID); _LineData.OriginalOrderID = Convert.ToInt64(_gvOrderID.Text); _TempOrdersData.OrdersLines.Add(_LineData); } // now add all the data to the database _TempOrdersDAL.Insert(_TempOrdersData); // open new form with database, p Response.Redirect("OrderDone.aspx"); }
public string GetItemUoM(int pItemID) { if (pItemID > 0) { ItemTypeTbl _ItemType = new ItemTypeTbl(); return(_ItemType.GetItemUnitOfMeasure(pItemID)); } else { return(String.Empty); } }
/// <summary> /// Display rotuines to dispay items in a gridview /// </summary> /// <param name="pItemID"></param> /// <returns></returns> public string GetItemDesc(int pItemID) { if (pItemID > 0) { ItemTypeTbl _ItemType = new ItemTypeTbl(); return(_ItemType.GetItemTypeDesc(pItemID)); } else { return(String.Empty); } }
int GetItemSortOrderID(string pItemTypeID) { ItemTypeTbl _ITT = new ItemTypeTbl(); return(_ITT.GetItemSortOrder(Convert.ToInt32(pItemTypeID))); }
private void SetListOfContactsToSendReminderTo() // ref List<string> strs, ref List<DateTime> dts) { // strs.Add("first get a list of contact that are on the reoccuringlist"); // dts.Add(DateTime.Now); // first get a list of contact that are on the reoccuringlist List <ContactToRemindWithItems> _ContactsToRemind = GetReocurringContacts(); // strs.Add("add the clients to that list that probably need in the next sechduled delivery period"); // dts.Add(DateTime.Now); // now add the clients to that list that probably need in the next sechduled delivery period AddAllContactsToRemind(ref _ContactsToRemind); //, ref strs, ref dts); _ContactsToRemind.Sort((a, b) => String.Compare(a.CompanyName, b.CompanyName)); // need to sort by name // strs.Add("write data to the table so it can be displayed"); // dts.Add(DateTime.Now); /// write data to the table so it can be displayed TempCoffeeCheckup _TempCoffeeCheckup = new TempCoffeeCheckup(); bool _CouldDelete = (_TempCoffeeCheckup.DeleteAllContactRecords()) && (_TempCoffeeCheckup.DeleteAllContactItems()); if (!_CouldDelete) { showMessageBox _smb = new showMessageBox(this.Page, "Old Temp Table delete", "Error deleting old temp tables"); } else { ItemTypeTbl _ITT = new ItemTypeTbl(); List <int> _OnlyCoffeeItems = _ITT.GetAllItemIDsofServiceType(TrackerTools.CONST_SERVTYPECOFFEE); // also the group items - since they are coffee too. _OnlyCoffeeItems.AddRange(_ITT.GetAllItemIDsofServiceType(TrackerTools.CONST_SERVTYPEGROUPITEM)); bool _AllAdded = false; bool _DoAdd = false; int j = 0; for (int i = 0; i < _ContactsToRemind.Count; i++) { // only insert client if the contain coffee item _DoAdd = false; j = 0; while ((j < _ContactsToRemind[i].ItemsContactRequires.Count) && (!_DoAdd)) { _DoAdd = _OnlyCoffeeItems.Contains(_ContactsToRemind[i].ItemsContactRequires[j].ItemID); j++; } if (_DoAdd) { _AllAdded = _TempCoffeeCheckup.InsertContacts(_ContactsToRemind[i]) || _AllAdded; foreach (ItemContactRequires _Item in _ContactsToRemind[i].ItemsContactRequires) // (int j = 0; j < _ContactsToRemind[i].ItemsContactRequires.Count; j++) { _AllAdded = _TempCoffeeCheckup.InsertContactItems(_Item) || _AllAdded; } } } if (!_AllAdded) { showMessageBox _smb = new showMessageBox(this.Page, "Not all records added to Temp Table", "Error adding some records added to Temp Table"); } } // gvCustomerCheckup.DataSource = _ContactsToRemind; // gvCustomerCheckup.DataBind(); }