/// <summary> /// Handles the RowUpdating event of the gridConsumables control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridViewUpdateEventArgs" /> instance containing the event data.</param> /// <exception cref="System.NotImplementedException"></exception> void gridConsumables_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { Label lblUpdateDate = (Label)gridConsumables.Rows[e.RowIndex].FindControl("lblEditDate"); // TextBox txtUpdateDescription = (TextBox)gridConsumables.Rows[e.RowIndex].FindControl("txtEditDescription"); TextBox txtUpdateQuantity = (TextBox)gridConsumables.Rows[e.RowIndex].FindControl("txtEditQuantity"); // DropDownList ddlUpdatePaymentMode = (DropDownList)gridConsumables.Rows[e.RowIndex].FindControl("ddlEditPaymentMode"); TextBox txtEdititemId = (TextBox)gridConsumables.Rows[e.RowIndex].FindControl("txtEdititemId"); Label lblUpdateUnitPrice = (Label)gridConsumables.Rows[e.RowIndex].FindControl("lblEditUnitPrice"); Label labelItemName = (Label)gridConsumables.Rows[e.RowIndex].FindControl("labelItemName"); string itemName = labelItemName.Text; float sellingPrice = float.Parse(lblUpdateUnitPrice.Text); string billItemID = gridConsumables.DataKeys[e.RowIndex].Values["billitemid"].ToString(); int itemID = int.Parse(gridConsumables.DataKeys[e.RowIndex].Values["item_pk"].ToString()); //txtUpdateDescription.Text.Trim() == "" || if (txtUpdateQuantity.Text.Trim() == "" || txtUpdateQuantity.Text.Trim() == "0") { return; } int quantity = int.Parse(txtUpdateQuantity.Text.Trim()); int itemType = int.Parse(gridConsumables.DataKeys[e.RowIndex].Values["ItemType"].ToString()); #region ToReDO IConsumable _consumablemManager = (IConsumable)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BConsumable, BusinessProcess.Clinical"); _consumablemManager.ItemID = itemID; _consumablemManager.ItemTypeID = itemType; _consumablemManager.SellingPrice = sellingPrice; _consumablemManager.IssueConsumable(itemID, itemType, itemName, sellingPrice, this.PatientID, this.LocationID, this.SelectedDate, this.UserID, quantity, this.ModuleID); #endregion gridConsumables.EditIndex = -1; this.PopulateItems(this.SelectedDate, true); } catch (Exception ex) { this.showErrorMessage(ref ex); } }
/// <summary> /// Handles the RowCommand event of the gridConsumables control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridViewCommandEventArgs"/> instance containing the event data.</param> void gridConsumables_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName.Equals("AddItem")) { TextBox textDescription = (TextBox)gridConsumables.FooterRow.FindControl("txtNewDescription"); TextBox textQuantity = (TextBox)gridConsumables.FooterRow.FindControl("txtNewQuantity"); Label labelUnitPrice = (Label)gridConsumables.FooterRow.FindControl("lblNewUnitPrice"); //TextBox txtNewitemId = (TextBox)grdCurrentBill.FooterRow.FindControl("txtNewitemId"); // TextBox txtNewItemType = (TextBox)grdCurrentBill.FooterRow.FindControl("txtNewItemType"); if (textDescription.Text.Trim() == "" || textQuantity.Text.Trim() == "" || textQuantity.Text.Trim() == "0") { return; } int quantity = int.Parse(textQuantity.Text); #region ToRedo IConsumable _consumablemManager = (IConsumable)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BConsumable, BusinessProcess.Clinical"); _consumablemManager.ItemName = textDescription.Text.Trim(); _consumablemManager.ItemID = this.ItemID; _consumablemManager.ItemTypeID = this.ItemTypeID; _consumablemManager.SellingPrice = float.Parse(labelUnitPrice.Text); //string h = HSelectedDate.Value; _consumablemManager.IssueConsumable(this.ItemID, this.ItemTypeID, textDescription.Text.Trim(), float.Parse(labelUnitPrice.Text), this.PatientID, this.LocationID, this.SelectedDate, this.UserID, quantity, this.ModuleID, true); #endregion this.PopulateItems(this.SelectedDate); } } catch (Exception ex) { this.isError = true; this.showErrorMessage(ref ex); } }