Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                FBFoodInventoryController controller = new FBFoodInventoryController();
                FBFoodInventoryInfo       item       = new FBFoodInventoryInfo();


                item.ModuleId = this.ModuleId;
                item.PortalId = this.PortalId;

                item.InvoiceNumber = txtInvoiceNumber.Text.ToString();

                item.SupplierID = Int32.Parse(ddlSupplier.SelectedValue.ToString());

                item.InvoiceDate = Convert.ToDateTime(txtInvoiceDate.Text.ToString());

                item.Organization = ddlOrganization.SelectedValue.ToString();

                item.LastModifiedByUserID = this.UserId;



                if (txtInvoiceID.Value.Length > 0)
                {
                    item.InvoiceID = Int32.Parse(txtInvoiceID.Value.ToString());
                    controller.FBInvoice_Update(item);

                    lblFormMessage.Text    = Localization.GetString("InvoiceUpdateSuccessful", this.LocalResourceFile);
                    lblFormMessage.Visible = true;
                }
                else
                {
                    item.CreatedByUserID = this.UserId;


                    int MyNewID = Null.NullInteger;
                    MyNewID            = controller.FBInvoice_Insert(item);
                    txtInvoiceID.Value = Convert.ToString(MyNewID);

                    lblFormMessage.Text    = Localization.GetString("InvoiceInsertSuccessful", this.LocalResourceFile);
                    lblFormMessage.Visible = true;
                }

                panelAddLineItems.Visible = true;
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }