private Boolean ValidateInput() { Boolean validationResult = true; String fe = String.Empty; String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_ItemID, treeBrandItemMap.SelectedValue.ToString(), SQLMatchType.Equal); String fe2 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_BrandID, treeBrandItemMap.SelectedNode.Parent.Value.ToString(), SQLMatchType.Equal); fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); String feSupplier = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_SupplierID, SupplierID.ToString(), SQLMatchType.Equal); fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, feSupplier); if (ddlOriginRegionID.SelectedValue != "0") { String fe3 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_OriginRegionID, ddlOriginRegionID.SelectedValue.ToString(), SQLMatchType.Equal); fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe3); } if (ddlOriginCountryID.SelectedValue != "0") { String fe4 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_OriginCountryID, ddlOriginCountryID.SelectedValue.ToString(), SQLMatchType.Equal); fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe4); } IList <PRMSupplierItemMapEntity> supplierItemMapList = FCCPRMSupplierItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (supplierItemMapList != null && supplierItemMapList.Count > 0) { MiscUtil.ShowMessage(lblMessage, "Already entered the Item Price.", true); validationResult = false; } return(validationResult); }
private void GetCurrentPrice() { String fe = String.Empty; String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_ItemID, _CurrentItemID.ToString(), SQLMatchType.Equal); String fe2 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_BrandID, ddlBrandID.SelectedValue.ToString(), SQLMatchType.Equal); fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); String fe3 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_OriginRegionID, ddlOriginRegionID.SelectedValue.ToString(), SQLMatchType.Equal); String fe4 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_OriginCountryID, ddlOriginCountryID.SelectedValue.ToString(), SQLMatchType.Equal); fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe3); fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe4); String fe5 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_SupplierID, ddlSupplierID.SelectedValue.ToString(), SQLMatchType.Equal); fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe5); IList <PRMSupplierItemMapEntity> supplierItemMapList = FCCPRMSupplierItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (supplierItemMapList != null && supplierItemMapList.Count > 0) { this.txtPrice.Text = supplierItemMapList[0].Price.ToString(); } else { this.txtPrice.Text = "0"; } }
public IList <PRMSupplierItemMapEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <PRMSupplierItemMapEntity> pRMSupplierItemMapEntityList = new List <PRMSupplierItemMapEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = PRMSupplierItemMapEntity.FLD_NAME_SupplierItemMapID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; pRMSupplierItemMapEntityList = FCCPRMSupplierItemMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (pRMSupplierItemMapEntityList != null && pRMSupplierItemMapEntityList.Count > 0) { totalRowCount = pRMSupplierItemMapEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(pRMSupplierItemMapEntityList ?? new List <PRMSupplierItemMapEntity>()); }
private void SavePRMSupplierItemMapEntity() { if (IsValid) { try { PRMSupplierItemMapEntity pRMSupplierItemMapEntity = BuildPRMSupplierItemMapEntity(); Int64 result = -1; if (pRMSupplierItemMapEntity.IsNew) { result = FCCPRMSupplierItemMap.GetFacadeCreate().Add(pRMSupplierItemMapEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_SupplierItemMapID, pRMSupplierItemMapEntity.SupplierItemMapID.ToString(), SQLMatchType.Equal); result = FCCPRMSupplierItemMap.GetFacadeCreate().Update(pRMSupplierItemMapEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _SupplierItemMapID = 0; _PRMSupplierItemMapEntity = new PRMSupplierItemMapEntity(); PrepareInitialView(); BindPRMSupplierItemMapList(); if (pRMSupplierItemMapEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Vendor Item Map Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Vendor Item Map Information has been updated successfully.", false); } } else { if (pRMSupplierItemMapEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Vendor Item Map Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Vendor Item Map Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
public IList <PRMSupplierItemMapEntity> GetData() { IList <PRMSupplierItemMapEntity> pRMSupplierItemMapEntityList = new List <PRMSupplierItemMapEntity>(); try { pRMSupplierItemMapEntityList = FCCPRMSupplierItemMap.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (pRMSupplierItemMapEntityList != null && pRMSupplierItemMapEntityList.Count > 0) { totalRowCount = pRMSupplierItemMapEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(pRMSupplierItemMapEntityList ?? new List <PRMSupplierItemMapEntity>()); }
protected void lvPRMSupplierItemMap_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 SupplierItemMapID; Int64.TryParse(e.CommandArgument.ToString(), out SupplierItemMapID); if (SupplierItemMapID > 0) { LinkButton lnkBtnEdit = (LinkButton)e.Item.FindControl("lnkBtnEdit"); TextBox txtActualPriceLV = (TextBox)e.Item.FindControl("txtActualPriceLV"); TextBox txtDiscountPercentageLV = (TextBox)e.Item.FindControl("txtDiscountPercentageLV"); TextBox txtPriceLV = (TextBox)e.Item.FindControl("txtPriceLV"); TextBox txtEntryDateLV = (TextBox)e.Item.FindControl("txtEntryDateLV"); Label lblItemIDLV = (Label)e.Item.FindControl("txtItemIDLV"); Label lblBrandIDLV = (Label)e.Item.FindControl("lblBrandIDLV"); Decimal ActualPrice, DiscountPercentage, Price; Int64 ItemID, BrandID; IList <PRMSupplierItemMapEntity> supplierItemMapList = new List <PRMSupplierItemMapEntity>(); if (string.Equals(e.CommandName, "EditItem") && txtActualPriceLV.Enabled == false) { _SupplierItemMapID = SupplierItemMapID; txtActualPriceLV.Enabled = true; txtDiscountPercentageLV.Enabled = true; txtPriceLV.Enabled = false; txtEntryDateLV.Enabled = true; Int64.TryParse(lblItemIDLV.Text, out ItemID); Int64.TryParse(lblBrandIDLV.Text, out BrandID); Decimal.TryParse(txtActualPriceLV.Text.Trim(), out ActualPrice); Decimal.TryParse(txtDiscountPercentageLV.Text.Trim(), out DiscountPercentage); Decimal.TryParse(txtPriceLV.Text.Trim(), out Price); PRMSupplierItemMapEntity ent = new PRMSupplierItemMapEntity(); ent.ItemID = ItemID; ent.BrandID = BrandID; ent.ActualPrice = ActualPrice; ent.DiscountPercentage = DiscountPercentage; ent.Price = Price; if (txtEntryDateLV.Text.Trim().IsNotNullOrEmpty()) { ent.EntryDate = MiscUtil.ParseToDateTime(txtEntryDateLV.Text); } supplierItemMapList = _PRMSupplierItemMapList; supplierItemMapList.Add(ent); _PRMSupplierItemMapList = supplierItemMapList; PrepareEditView(); lnkBtnEdit.Text = "Cancel"; } else if (string.Equals(e.CommandName, "EditItem") && txtActualPriceLV.Enabled == true) { _SupplierItemMapID = SupplierItemMapID; PrepareEditView(); txtActualPriceLV.Enabled = false; txtDiscountPercentageLV.Enabled = false; txtPriceLV.Enabled = false; txtEntryDateLV.Enabled = false; Int64.TryParse(lblItemIDLV.Text, out ItemID); Int64.TryParse(lblBrandIDLV.Text, out BrandID); if (_PRMSupplierItemMapList != null && _PRMSupplierItemMapList.Count > 0) { PRMSupplierItemMapEntity supplierItemMap = (from s in _PRMSupplierItemMapList where s.ItemID == ItemID select s).First(); if (supplierItemMap != null) { txtActualPriceLV.Text = supplierItemMap.ActualPrice.ToString(); txtDiscountPercentageLV.Text = supplierItemMap.DiscountPercentage.ToString(); txtEntryDateLV.Text = supplierItemMap.EntryDate.ToString(UIConstants.SHORT_DATE_FORMAT); txtPriceLV.Text = supplierItemMap.Price.ToString(); _PRMSupplierItemMapList.Remove(supplierItemMap); } } lnkBtnEdit.Text = "Edit"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_SupplierItemMapID, SupplierItemMapID.ToString(), SQLMatchType.Equal); PRMSupplierItemMapEntity pRMSupplierItemMapEntity = new PRMSupplierItemMapEntity(); result = FCCPRMSupplierItemMap.GetFacadeCreate().Delete(pRMSupplierItemMapEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _SupplierItemMapID = 0; _PRMSupplierItemMapEntity = new PRMSupplierItemMapEntity(); PrepareInitialView(); BindPRMSupplierItemMapList(); MiscUtil.ShowMessage(lblMessage, "Vendor Item Map has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Vendor Item Map.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
private void SavePRMSupplierItemMapEntity() { if (IsValid) { try { IList <ListViewDataItem> list = lvPRMSupplierItemMap.Items; if (list != null && list.Count > 0) { foreach (ListViewDataItem lvdi in list) { TextBox txtActualPriceValidation = (TextBox)lvdi.FindControl("txtActualPriceLV"); if (txtActualPriceValidation.Enabled) { Decimal ActualPrice, DiscountPercentage, Price; Int64 ItemID, BrandID; Label lblItemIDLV = (Label)lvdi.FindControl("txtItemIDLV"); Label lblBrandIDLV = (Label)lvdi.FindControl("lblBrandIDLV"); TextBox txtActualPriceLV = (TextBox)lvdi.FindControl("txtActualPriceLV"); TextBox txtDiscountPercentageLV = (TextBox)lvdi.FindControl("txtDiscountPercentageLV"); TextBox txtPriceLV = (TextBox)lvdi.FindControl("txtPriceLV"); TextBox txtEntryDateLV = (TextBox)lvdi.FindControl("txtEntryDateLV"); Int64.TryParse(lblItemIDLV.Text, out ItemID); Int64.TryParse(lblBrandIDLV.Text, out BrandID); Decimal.TryParse(txtActualPriceLV.Text.Trim(), out ActualPrice); Decimal.TryParse(txtDiscountPercentageLV.Text.Trim(), out DiscountPercentage); Decimal actualPrice, discountPercentages, price; Decimal.TryParse(txtActualPriceLV.Text.Trim(), out actualPrice); Decimal.TryParse(txtDiscountPercentageLV.Text.Trim(), out discountPercentages); price = actualPrice - (actualPrice * (discountPercentages / 100)); String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_SupplierID, ddlSupplierID.SelectedValue.ToString(), SQLMatchType.Equal); String fe2 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_ItemID, ItemID.ToString(), SQLMatchType.Equal); String fe3 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemMapEntity.FLD_NAME_BrandID, BrandID.ToString(), SQLMatchType.Equal); String fe4 = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); String fe = SqlExpressionBuilder.PrepareFilterExpression(fe4, SQLJoinType.AND, fe3); IList <PRMSupplierItemMapEntity> SupplierItemMapList = FCCPRMSupplierItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (SupplierItemMapList != null && SupplierItemMapList.Count > 0) { PRMSupplierItemMapEntity pRMSupplierItemMapEntity = SupplierItemMapList[0]; pRMSupplierItemMapEntity.ActualPrice = ActualPrice; pRMSupplierItemMapEntity.DiscountPercentage = DiscountPercentage; pRMSupplierItemMapEntity.Price = price; pRMSupplierItemMapEntity.ItemID = ItemID; if (txtEntryDateLV.Text.Trim().IsNotNullOrEmpty()) { pRMSupplierItemMapEntity.EntryDate = MiscUtil.ParseToDateTime(txtEntryDateLV.Text); } FCCPRMSupplierItemMap.GetFacadeCreate().Update(pRMSupplierItemMapEntity, fe, DatabaseOperationType.Update, TransactionRequired.No); } } } MiscUtil.ShowMessage(lblMessage, "Vendor Item Map Information has been updated successfully.", false); } BindPRMSupplierItemMapList(); } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }