protected void btnSaveQBCodeAs_Click(object sender, EventArgs e) { AdminController aCont = new AdminController(); QBCodeInfo QBCode = new QBCodeInfo(); QBCode.PortalId = PortalId; QBCode.LastModifiedById = UserId; QBCode.LastModifiedDate = DateTime.Now; QBCode.CreatedById = UserId; QBCode.DateCreated = DateTime.Now; QBCode.QBCode = txtQBCode.Text; QBCode.Type = (GroupTypeEnum)Convert.ToInt32(ddlQBCodeType.SelectedValue); QBCode.MediaType = (MediaTypeEnum)Convert.ToInt32(ddlMediaType.SelectedValue); if (ddlQBCodeType.SelectedValue == "1" || ddlQBCodeType.SelectedValue == "2" || ddlQBCodeType.SelectedValue == "0") { QBCode.MinLength = aCont.fixLength(txtMinLength.Text); QBCode.MaxLength = aCont.fixLength(txtMaxLength.Text); } //save new code QBCode.Id = aCont.Add_QBCode(QBCode); //save delivery methods, tape formats and services if (ddlQBCodeType.SelectedValue == "1" || ddlQBCodeType.SelectedValue == "0") { aCont.DeleteQBCodeDeliveryMethodsByQBCodeId(QBCode.Id); foreach (ListItem li in lbxStationDeliveryMethod.Items) { if (li.Selected) { aCont.AddQBCodeDeliveryMethod(QBCode.Id, Convert.ToInt32(li.Value)); } } aCont.DeleteQBCodeTapeFormatsByQBCodeId(QBCode.Id); foreach (ListItem li in lbxQBCodeTapeFormat.Items) { if (li.Selected) { aCont.AddQBCodeTapeFormat(QBCode.Id, Convert.ToInt32(li.Value)); } } } if (ddlQBCodeType.SelectedValue == "3" || ddlQBCodeType.SelectedValue == "2" || ddlQBCodeType.SelectedValue == "1") { aCont.DeleteQBCodeServicesByQBCodeId(QBCode.Id); foreach (ListItem li in cklServices.Items) { if (li.Selected) { aCont.AddQBCodeService(QBCode.Id, Convert.ToInt32(li.Value)); } } } lblQBCodesMessage.Text = "QuickBooks Code Saved."; fillQBCodes(); }
protected void btnDeleteQBCode_Click(object sender, EventArgs e) { AdminController aCont = new AdminController(); QBCodeInfo QBCode = new QBCodeInfo(); QBCode.Id = Convert.ToInt32(txtSelectedQBCode.Value); aCont.Delete_QBCode(QBCode); lblQBCodesMessage.Text = "QuickBooks Code Deleted."; fillQBCodes(); clearQBCOde(); }
protected void gvQBCodes_SelectedIndexChanged(object sender, EventArgs e) { AdminController aCont = new AdminController(); txtSelectedQBCode.Value = (gvQBCodes.SelectedRow.FindControl("hdngvQBCodeId") as HiddenField).Value; QBCodeInfo QBCode = aCont.Get_QBCodeById(Convert.ToInt32(txtSelectedQBCode.Value)); if (QBCode.Id != -1) { btnDeleteQBCode.Enabled = true; btnSaveQBCodeAs.Enabled = true; txtQBCodeCreatedBy.Value = QBCode.CreatedById.ToString(); txtQBCodeCreatedDate.Value = QBCode.DateCreated.Ticks.ToString(); txtQBCode.Text = QBCode.QBCode; ddlQBCodeType.ClearSelection(); ddlMediaType.ClearSelection(); lbxStationDeliveryMethod.ClearSelection(); lbxQBCodeTapeFormat.ClearSelection(); foreach (ListItem li in ddlQBCodeType.Items) { if (Convert.ToInt32(li.Value) == (int)QBCode.Type) { li.Selected = true; } } if (QBCode.Type == GroupTypeEnum.Bundle || QBCode.Type == GroupTypeEnum.Delivery) { pnlDelivery.Visible = true; pnlNonDelivery.Visible = false; foreach (ListItem li in ddlMediaType.Items) { if (Convert.ToInt32(li.Value) == (int)QBCode.MediaType) { li.Selected = true; } } foreach (DeliveryMethodInfo dm in QBCode.DeliveryMethods) { foreach (ListItem li in lbxStationDeliveryMethod.Items) { if (li.Value == dm.Id.ToString()) { li.Selected = true; } } } foreach (TapeFormatInfo tf in QBCode.TapeFormats) { foreach (ListItem li in lbxQBCodeTapeFormat.Items) { if (li.Value == tf.Id.ToString()) { li.Selected = true; } } } txtMaxLength.Text = QBCode.MaxLength; txtMinLength.Text = QBCode.MinLength; txtQBCode.Text = QBCode.QBCode; } else if (QBCode.Type == GroupTypeEnum.Non_Deliverable || QBCode.Type == GroupTypeEnum.Customized) { pnlDelivery.Visible = false; pnlNonDelivery.Visible = true; cklServices.ClearSelection(); foreach (ServiceInfo serv in QBCode.Services) { foreach (ListItem li in cklServices.Items) { if (li.Value == serv.Id.ToString()) { li.Selected = true; } } } } else { pnlDelivery.Visible = false; pnlNonDelivery.Visible = false; clearQBCOde(); } lblQBCodesMessage.Text = ""; } else { btnDeleteQBCode.Enabled = false; btnSaveQBCodeAs.Enabled = false; clearQBCOde(); lblQBCodesMessage.Text = "There was an error loading this QuickBooks Code."; } fillQBCodes(); }
public abstract void Delete_QBCode(QBCodeInfo QBCode);
public abstract void Update_QBCode(QBCodeInfo QBCode);
public abstract int Add_QBCode(QBCodeInfo QBCode);