protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Request.QueryString["ItemId"] != null)
                {
                    itemId = Int32.Parse(Request.QueryString["ItemId"]);
                }

                if (!IsPostBack)
                {
                    //load the data into the control the first time
                    //we hit this page


                    cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");

                    //check we have an item to lookup
                    if (!Null.IsNull(itemId))
                    {
                        //load the item
                        FBFoodInventoryController controller = new FBFoodInventoryController();
                        FBFoodInventoryInfo       item       = controller.FBSuppliers_GetByID(this.ModuleId, itemId);

                        if (item != null)
                        {
                            txtContent.Text        = item.SupplierName;
                            ctlAudit.CreatedByUser = item.CreatedByUserName;
                            ctlAudit.CreatedDate   = item.CreatedOnDate.ToLongDateString();
                        }
                        else
                        {
                            Response.Redirect(Globals.NavigateURL(), true);
                        }
                    }
                    else
                    {
                        cmdDelete.Visible = false;
                        ctlAudit.Visible  = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        protected void gvSuppliers_RowEditing(object sender, GridViewEditEventArgs e)
        {
            try
            {
                //   cmdDeleteDonation.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteDonationItemMessage.Confirm", this.LocalResourceFile) + "');");

                panelEdit.Visible = true;
                panelGrid.Visible = false;

                int supplierID = (int)gvSuppliers.DataKeys[e.NewEditIndex].Value;

                FBFoodInventoryController controller = new FBFoodInventoryController();
                FBFoodInventoryInfo       item       = controller.FBSuppliers_GetByID(this.ModuleId, supplierID);

                if (item != null)
                {
                    txtSupplierName.Text = item.SupplierName.ToString();
                    //   cbxGBFB.Checked = item.GBFB;
                    txtAddress.Text           = item.Address.ToString();
                    txtCity.Text              = item.City.ToString();
                    ddlState.SelectedValue    = item.State.ToString();
                    txtZip.Text               = item.Zip.ToString();
                    txtSupplierPhone.Text     = item.SupplierPhone.ToString();
                    txtSalesman.Text          = item.Salesman.ToString();
                    txtSalesmanPhone.Text     = item.SalesmanPhone.ToString();
                    rblIsActive.SelectedValue = item.IsActive.ToString();
                    txtSupplierID.Value       = item.SupplierID.ToString();
                }
                else
                {
                    txtSupplierID.Value = "";
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Esempio n. 3
0
        public void AddInActiveSupplier(int SupplierID)
        {
            try
            {
                FBFoodInventoryController controller = new FBFoodInventoryController();
                FBFoodInventoryInfo       item       = controller.FBSuppliers_GetByID(this.ModuleId, SupplierID);

                if (item != null)
                {
                    ListItem lst = new ListItem(item.SupplierName.ToString(), SupplierID.ToString());

                    ddlSupplier.Items.Add(lst);
                    ddlSupplier.SelectedValue = SupplierID.ToString();
                }
                else
                {
                    //  txtSupplierID.Value = "";
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }