protected void txtItemName_TextChanged(object sender, EventArgs e) { int rows = Convert.ToInt32(((TextBox)sender).Attributes["Rowid"].ToString()); TextBox name = (TextBox)Gridview1.Rows[rows].FindControl("txtItemName"); TextBox dec = (TextBox)Gridview1.Rows[rows].FindControl("txtDis"); TextBox priceS = (TextBox)Gridview1.Rows[rows].FindControl("txtSaleAmount"); TextBox dicPre = (TextBox)Gridview1.Rows[rows].FindControl("txtDisPer"); TextBox disAmt = (TextBox)Gridview1.Rows[rows].FindControl("txtDisAmt"); TextBox priceC = (TextBox)Gridview1.Rows[rows].FindControl("txtCostAmount"); TextBox qut = (TextBox)Gridview1.Rows[rows].FindControl("txtQut"); string item = name.Text; Store.Item.BusinessObject.Item objItem = new Store.Item.BusinessObject.Item(); Store.Item.BusinessLogic.Item oblItem = new Store.Item.BusinessLogic.Item(); objItem = oblItem.GetAllItem(item, 0, ""); dec.Text = objItem.ItemDescription; Store.ItemPrice.BusinessObject.ItemPrice objItemPrice = new Store.ItemPrice.BusinessObject.ItemPrice(); Store.ItemPrice.BusinessLogic.ItemPrice oblItemPrice = new Store.ItemPrice.BusinessLogic.ItemPrice(); objItemPrice = oblItemPrice.GetAllItemPrice(0, 0, ""); //Cost price and sale price will come from itemPrice table priceC.Text = Convert.ToString(objItemPrice.ItemCostPricePerUnit); priceS.Text = Convert.ToString(objItemPrice.ItemSalePricePerUnit); dicPre.Text = Convert.ToString(objItemPrice.ItemDiscountPercentagePerUnit); disAmt.Text = Convert.ToString((Convert.ToDouble(priceS.Text) * Convert.ToDouble(dicPre.Text)) / 100); qut.Focus(); }
public Store.Common.MessageInfo ManageItemMaster(Store.Item.BusinessObject.Item objItem, CommandMode cmdMode) { try { return(odlItem.ManageItem(objItem, cmdMode)); } catch (Exception ex) { Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(Item).FullName, 1); return(null); } }
public Store.Common.MessageInfo ManageItem(Store.Item.BusinessObject.Item objItem, CommandMode cmdMode) { string SQL = ""; ParameterList param = new ParameterList(); DataTableReader dr; Store.Common.MessageInfo objMessageInfo = null; try { SQL = "USP_ManageItem"; param.Add(new SQLParameter("@ItemID", objItem.ItemID)); //param.Add(new SQLParameter("@ItemPriceID", objItem.ItemPriceID)); param.Add(new SQLParameter("@ItemPrefix", objItem.ItemPrefix)); param.Add(new SQLParameter("@ItemCode", objItem.ItemCode)); param.Add(new SQLParameter("@Barcode", objItem.Barcode)); param.Add(new SQLParameter("@ItemDescription", objItem.ItemDescription)); param.Add(new SQLParameter("@ItemUnitId", objItem.ItemUnitId)); //param.Add(new SQLParameter("@ItemCostPricePerUnit", objItem.ItemCostPricePerUnit)); //param.Add(new SQLParameter("@ItemSalePricePerUnit", objItem.ItemSalePricePerUnit)); //param.Add(new SQLParameter("@ItemDiscountPercentagePerUnit", objItem.ItemDiscountPercentagePerUnit)); //param.Add(new SQLParameter("@WindowFrom", objItem.WindowFrom)); //param.Add(new SQLParameter("@WindowTo", objItem.WindowTo)); //param.Add(new SQLParameter("@BatchNo", objItem.BatchNo)); param.Add(new SQLParameter("@CategoryID", objItem.CategoryID)); param.Add(new SQLParameter("@IsActive", objItem.IsActive)); param.Add(new SQLParameter("@ReferenceID", objItem.ReferenceID)); if (cmdMode == CommandMode.N) { param.Add(new SQLParameter("@UserId", objItem.CreatedBy)); } else { param.Add(new SQLParameter("@UserId", objItem.ModifiedBy)); } param.Add(new SQLParameter("@CMDMode", cmdMode)); dr = ExecuteQuery.ExecuteReader(SQL, param); if (dr.Read()) { objMessageInfo = new Store.Common.MessageInfo(); objMessageInfo.ErrorCode = Convert.ToInt32(dr["ErrorCode"]); objMessageInfo.ErrorMessage = Convert.ToString(dr["ErrorMessage"]); objMessageInfo.TranID = Convert.ToInt32(dr["TranID"]); objMessageInfo.TranCode = Convert.ToString(dr["TranCode"]); objMessageInfo.TranMessage = Convert.ToString(dr["TranMessage"]); } } catch (Exception ex) { Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(Item).FullName, 1); } return(objMessageInfo); }
protected void ddlItemId_SelectedIndexChanged(object sender, EventArgs e) { int id = Convert.ToInt32(ddlItemId.SelectedValue); Store.Item.BusinessObject.Item objItem = new Store.Item.BusinessObject.Item(); oblItem = new Store.Item.BusinessLogic.Item(); Store.ItemPrice.BusinessObject.ItemPrice objItemPrice = new Store.ItemPrice.BusinessObject.ItemPrice(); Store.ItemPrice.BusinessLogic.ItemPrice oblItemPrice = new Store.ItemPrice.BusinessLogic.ItemPrice(); objItemPrice = oblItemPrice.GetAllItemPrice(id, 0, ""); //objItem = oblItem.GetAllItem(id, 0, ""); txtItemUnit.Text = objItem.UnitName; txtDescription.Text = objItem.ItemDescription; txtItemPrice.Text = Convert.ToString(objItemPrice.ItemSalePricePerUnit); }
protected void txtItemName_TextChanged(object sender, EventArgs e) { int rows = Convert.ToInt32(((TextBox)sender).Attributes["RowId"].ToString()); TextBox name = (TextBox)Gridview1.Rows[rows].Cells[1].FindControl("txtItemName"); TextBox dec = (TextBox)Gridview1.Rows[rows].Cells[2].FindControl("txtDec"); TextBox price = (TextBox)Gridview1.Rows[rows].Cells[3].FindControl("txtPrice"); string item = name.Text; Store.Item.BusinessObject.Item objItem = new Store.Item.BusinessObject.Item(); oblItem = new Store.Item.BusinessLogic.Item(); objItem = oblItem.GetAllItem(item, 0, ""); dec.Text = objItem.ItemDescription; //sale price will come from itemPrice table. //price.Text = Convert.ToString(objItem.ItemSalePricePerUnit); }
void ManageItem() { objItem = new Store.Item.BusinessObject.Item(); oblItem = new Store.Item.BusinessLogic.Item(); try { if (cmdMode == Store.Common.CommandMode.M) { objItem.ItemID = Convert.ToInt32(txtItemId.Text); //objItem.ModifiedBy = Convert.ToInt32(Session["UserId"]); //objItem.ItemPriceID = Convert.ToInt32(txtItemPriceId.Text); } else { objItem.ItemID = 0; //objItem.CreatedBy = Convert.ToInt32(Session["UserId"]); //objItem.ItemPriceID = 0; } objItem.ItemPrefix = Convert.ToString(txtItemPrefix.Text); objItem.ItemCode = Convert.ToString(txtItemCode.Text); objItem.Barcode = Convert.ToString(txtBarcode.Text); objItem.ItemDescription = Convert.ToString(txtItemDecription.Text); objItem.ItemUnitId = Convert.ToInt32(ddlItemUnitId.SelectedItem.Value); objItem.CategoryID = Convert.ToInt32(ddlCategoryId.SelectedItem.Value); //objItem.ItemCostPricePerUnit = Convert.ToDecimal(txtCostPrice.Text); //objItem.ItemSalePricePerUnit = Convert.ToDecimal(txtSalePrice.Text); //objItem.ItemDiscountPercentagePerUnit = Convert.ToDecimal(txtItemDiscountPerUnit.Text); //objItem.WindowFrom = Convert.ToDateTime(txtFrom.Text); //objItem.WindowTo = Convert.ToDateTime(txtTo.Text); //objItem.BatchNo = Convert.ToString(txtBatchNo.Text); objMessageInfo = oblItem.ManageItemMaster(objItem, cmdMode); } catch (Exception ex) { Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(Item).FullName, 1); } finally { objItem = null; //objMessageInfo = null; oblItem = null; } }
//protected void txtTotal_TextChanged(object sender, EventArgs e) //{ // double ttl = 0; // DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"]; // for (int i = 1; i <= dtCurrentTable.Rows.Count; i++) // { // TextBox box5 = (TextBox)Gridview1.Rows[i - 1].Cells[7].FindControl("txtTotal"); // ttl += Convert.ToDouble(box5.Text); // } // txtSubTotal.Text = Convert.ToString(ttl); //} #region gridevent protected void txtItemName_TextChanged(object sender, EventArgs e) { DataTable dt = (DataTable)ViewState["CurrentTable"]; int rows = Convert.ToInt32(dt.Rows.Count); rows--; TextBox name = (TextBox)Gridview1.Rows[rows].Cells[1].FindControl("txtItemName"); TextBox dec = (TextBox)Gridview1.Rows[rows].Cells[2].FindControl("txtDec"); TextBox price = (TextBox)Gridview1.Rows[rows].Cells[3].FindControl("txtPrice"); TextBox dicPre = (TextBox)Gridview1.Rows[rows].Cells[4].FindControl("txtDisPre"); string item = name.Text; Store.Item.BusinessObject.Item objItem = new Store.Item.BusinessObject.Item(); oblItem = new Store.Item.BusinessLogic.Item(); objItem = oblItem.GetAllItem(item, 0, ""); dec.Text = objItem.ItemDescription; price.Text = Convert.ToString(objItem.ItemCostPricePerUnit); }
protected void ddlItemId_SelectedIndexChanged(object sender, EventArgs e) { int id = Convert.ToInt32(ddlItemId.SelectedValue); Store.Item.BusinessObject.Item objItem = new Store.Item.BusinessObject.Item(); oblItem = new Store.Item.BusinessLogic.Item(); Store.ItemPrice.BusinessObject.ItemPrice objItemPrice = new Store.ItemPrice.BusinessObject.ItemPrice(); Store.ItemPrice.BusinessLogic.ItemPrice oblItemPrice = new Store.ItemPrice.BusinessLogic.ItemPrice(); objItemPrice = oblItemPrice.GetAllItemPrice(id, 0, ""); //objItem = oblItem.GetAllItem(id, 0, ""); txtItemUnit.Text = objItem.UnitName; txtDescription.Text = objItem.ItemDescription; txtItemCostPrice.Text = Convert.ToString(objItemPrice.ItemCostPricePerUnit); txtItemSalePrice.Text = Convert.ToString(objItemPrice.ItemSalePricePerUnit); txtItemDiscountPercentage.Text = Convert.ToString(objItemPrice.ItemDiscountPercentagePerUnit); decimal sale = Convert.ToDecimal(objItemPrice.ItemSalePricePerUnit); decimal discp = Convert.ToDecimal(objItemPrice.ItemDiscountPercentagePerUnit); decimal discount = (sale * discp) / 100; txtItemDiscount.Text = Convert.ToString(discount); }
protected void imgbtnfrDelete_Click(object sender, ImageClickEventArgs e) { cmdMode = CommandMode.D; objItem = new Store.Item.BusinessObject.Item(); oblItem = new Store.Item.BusinessLogic.Item(); try { ImageButton btndetails = sender as ImageButton; GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; objItem.ItemID = Convert.ToInt32(dgvItem.DataKeys[gvrow.RowIndex].Value.ToString()); objItem.ItemPrefix = ""; objItem.ItemCode = ""; objItem.Barcode = ""; objItem.ItemDescription = ""; objItem.ItemUnitId = 1; objItem.CategoryID = 1; //objItem.ItemCostPricePerUnit = 1; //objItem.ItemSalePricePerUnit = 1; //objItem.ItemDiscountPercentagePerUnit = 1; //objItem.WindowFrom = DateTime.Now; //objItem.WindowTo = DateTime.Now; //objItem.BatchNo = ""; //objItem.CreatedBy = 1; objMessageInfo = oblItem.ManageItemMaster(objItem, cmdMode); BindItem(); updateItemBdInfo.Update(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "alert('" + objMessageInfo.TranMessage + "')", true); } catch (Exception ex) { Store.Common.Utility.ExceptionLog.Exceptionlogs(ex.Message, Store.Common.Utility.ExceptionLog.LineNumber(ex), typeof(Item).FullName, 1); } finally { objItem = null; objMessageInfo = null; oblItem = null; } }