Example #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                String tempName      = txtCategoryName.Text;
                int    tempCat3Order = int.Parse(txtCatOrder.Text);
                String tempColor     = txtColorName.Text.Trim();

                int tempViewTable = chkTable.Checked == true ? 1 : 0;
                int tempViewBar   = chkBar.Checked == true ? 1 : 0;
                int tempViewTW    = chkTakeAway.Checked == true ? 1 : 0;

                CCategory2 oCat = new CCategory2();

                oCat.Category2Name = tempName;

                oCat.Category2Order = tempCat3Order;

                oCat.Category2Color = tempColor;

                oCat.Category1ID = Int32.Parse(cmbFoodType.SelectedValue.ToString());

                oCat.Category2ID = m_categoryID;

                oCat.Category2ViewTable = tempViewTable;

                oCat.Category2ViewBar = tempViewBar;

                oCat.Category2ViewTakeAway = tempViewTW;

                oCat.Category2Type = ((CComboBoxItem)cmbCategoryType.SelectedItem).Value;


                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.UpdateCategory2(oCat, m_cattegoryOrder);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = "Category2 information is updated successfully. ";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult2.Message;

                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = oResult.Message;

                lblSaveStatus.Visible = true;
            }
        }