protected void GridViewItem_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "InsertNewItem") { GridViewRow row = GridViewItem.FooterRow; TextBox txtItemNameNew = row.FindControl("txtItemNameNew") as TextBox; TextBox txtDescription = row.FindControl("txtDescription") as TextBox; TextBox txtItemPriceNew = row.FindControl("txtItemPriceNew") as TextBox; TextBox txtItemDiscountAmountNew = row.FindControl("txtItemDiscountAmountNew") as TextBox; DropDownList ddlItemGroupNew = row.FindControl("ddlItemGroupNew") as DropDownList; CheckBox CheckBoxStatusNew = row.FindControl("CheckBoxStatusNew") as CheckBox; TextBox txtItemVatNew = row.FindControl("txtItemVatNew") as TextBox; if (txtItemNameNew != null) { LU_Tbl_Item objItem = new LU_Tbl_Item(); objItem.ItemName = txtItemNameNew.Text; objItem.Description = txtDescription.Text; objItem.Price = Convert.ToDecimal(txtItemPriceNew.Text); objItem.ItemGroupName = ddlItemGroupNew.Text; objItem.VAT = Convert.ToDecimal(txtItemVatNew.Text); objItem.DiscountAmount = Convert.ToDecimal(txtItemDiscountAmountNew.Text); objItem.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; objItem.EDIT_DATE = DateTime.Now; objItem.OCODE = ((SessionUser)Session["SessionUser"]).OCode; objItem.EDIT_DATE = DateTime.Now; bool status; if (CheckBoxStatusNew.Checked == true) { status = true; } else { status = false; } objItem.Status = status; //objDept.ItemGroupName= ((SessionUser)Session["SessionUser"]).UserId; //objDept. = DateTime.Now; //objDept.OCODE = ((SessionUser)Session["SessionUser"]).OCode; int result = objItem_BLL.InsertItem(objItem); if (result == 1) { // lblMessage.Text = "Record Added successfully!"; //lblMessage.ForeColor = System.Drawing.Color.Green; // lblMessage.Visible = true; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Record Added successfully!')", true); BindItem(); } } } }
public int InsertItem(LU_Tbl_Item objItem) { try { _context.LU_Tbl_Item.AddObject(objItem); _context.SaveChanges(); return(1); } catch (Exception ex) { throw ex; } }
protected void GridViewItem_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = GridViewItem.Rows[e.RowIndex]; TextBox txtItemName = row.FindControl("txtItemName") as TextBox; TextBox txtItemPrice = row.FindControl("txtItemPrice") as TextBox; TextBox txtItemDiscountAmount = row.FindControl("txtItemDiscountAmount") as TextBox; DropDownList ddlItemGroup = row.FindControl("ddlItemGroup") as DropDownList; CheckBox CheckBoxStatus = row.FindControl("CheckBoxStatus") as CheckBox; TextBox txtItemVatAmount = row.FindControl("txtItemVatAmount") as TextBox; if (txtItemName != null) { int itemId = Convert.ToInt32(GridViewItem.DataKeys[e.RowIndex].Value); LU_Tbl_Item objItem = new LU_Tbl_Item(); objItem.ItemName = txtItemName.Text; objItem.Price = Convert.ToDecimal(txtItemPrice.Text); objItem.ItemGroupName = ddlItemGroup.Text; objItem.DiscountAmount = Convert.ToDecimal(txtItemDiscountAmount.Text); objItem.VAT = Convert.ToDecimal(txtItemVatAmount.Text); objItem.EDIT_DATE = DateTime.Now; bool status; if (CheckBoxStatus.Checked == true) { status = true; } else { status = false; } objItem.Status = status; int result = objItem_BLL.UpdateItem(objItem, itemId); if (result == 1) { // lblMessage.Text = "Record Updated successfully!"; // lblMessage.ForeColor = System.Drawing.Color.Green; // lblMessage.Visible = true; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Record Updated successfully!')", true); GridViewItem.EditIndex = -1; BindItem(); } } }
internal int UpdateInventoryProduct(LU_Tbl_Item lutblitem, int Id) { try { LU_Tbl_Item obj = _context.LU_Tbl_Item.First(x => x.Id == Id); obj.InventoryItemID = lutblitem.InventoryItemID; _context.SaveChanges(); return(1); } catch (Exception ex) { throw ex; } }
protected void btnItemInfo_Click(object sender, EventArgs e) { try { int Id = Convert.ToInt16(ddlFoodItem.SelectedValue); LU_Tbl_Item lutblitem = new LU_Tbl_Item(); lutblitem.InventoryItemID = Convert.ToInt16(ddlInventoryItem.SelectedValue); aInfoBll.UpdateInventoryProduct(lutblitem, Id); // lblMessage.Text = "Data Updated Successfully"; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true); BindItemListInfo(); GetAllFoodItem(); } catch (Exception) { throw; } }
public int UpdateItem(LU_Tbl_Item objItem, int itemId) { try { LU_Tbl_Item obj = _context.LU_Tbl_Item.First(x => x.Id == itemId); obj.ItemName = objItem.ItemName; obj.Description = objItem.Description; obj.Price = objItem.Price; obj.ItemGroupName = objItem.ItemGroupName; obj.VAT = objItem.VAT; obj.DiscountAmount = objItem.DiscountAmount; obj.Status = objItem.Status; _context.SaveChanges(); return(1); } catch (Exception ex) { throw ex; } }
public int UpdateItem(LU_Tbl_Item objItem, int itemId) { return(objCtx_DAL.UpdateItem(objItem, itemId)); }
public int InsertItem(LU_Tbl_Item objItem) { return(objCtx_DAL.InsertItem(objItem)); }
internal int UpdateInventoryProduct(LU_Tbl_Item lutblitem, int Id) { return(aItemInfoDal.UpdateInventoryProduct(lutblitem, Id)); }