public void BindItem(string mode) { try { InventoryServiceClient service = new InventoryServiceClient(); List <GetDrpItemsByCategory> listItem = null; if (mode == "Add") { listItem = service.GetDrpItemsByCategory(Convert.ToInt64(drdItemCategory.SelectedValue)).Where(a => a.IsActive == true).ToList(); } else { listItem = service.GetDrpItemsByCategory(Convert.ToInt64(drdItemCategory.SelectedValue)).ToList(); } drdItemID.DataSource = listItem; drdItemID.DataTextField = "ItemShortName"; drdItemID.DataValueField = "ItemID"; drdItemID.DataBind(); ListItem lst = new ListItem(); lst.Value = "0"; lst.Text = "Select"; drdItemID.Items.Insert(0, lst); } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true); } }
//private void LoadLookups(string mode) //{ // try // { // BindCategory(mode); // BindItem(mode); // BindVendor(mode); // } // catch (Exception ex) // { // ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true); // } //} private bool ValidateLoookups(InventoryServiceClient service) { try { bool result = true; string errmessage = ""; //Item Category Lookup List <GetItemCategory> lstCat = service.GetItemCategory().Where(a => a.IsActive == true && a.CategoryID == Convert.ToInt64(drdItemCategory.SelectedValue)).ToList(); if (lstCat.Count == 0) { errmessage += "ItemCategory (" + drdItemCategory.SelectedItem.Text + ") , "; result = false; } //Item based on Category Lookup List <GetDrpItemsByCategory> lstitemCat = service.GetDrpItemsByCategory(Convert.ToInt64(drdItemCategory.SelectedValue)).Where(a => a.IsActive == true && a.ItemID == Convert.ToInt64(drdItemID.SelectedValue)).ToList(); if (lstitemCat.Count == 0) { errmessage += "Item (" + drdItemID.SelectedItem.Text + ") , "; result = false; } //Vendor Lookup List <GetvendorDetails> lstvendor = service.GetvendorDetails("").Where(a => a.IsActive == true && a.VendorID == Convert.ToInt64(drdVendorID.SelectedValue)).ToList(); if (lstvendor.Count == 0) { errmessage += "Vendor (" + drdVendorID.SelectedItem.Text + ") "; result = false; } if (!result) { EventLogger log = new EventLogger(config); string msg = Constant.WarningLookupMessage.Replace("ShowwarningLookupPopup('", "").Replace("<<values>>", errmessage).Replace("');", ""); log.LogWarning(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningLookupMessage.Replace("<<values>>", errmessage), true); } return(result); } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true); return(false); } }