protected void btnRequest_Click(object sender, EventArgs e) { try { if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); BOSecondCategory _boscat = new BOSecondCategory(); BASecondCategory _bascat = new BASecondCategory(); _boscat.SecondCategoryName = txtcategory.Text; _boscat.TopCategoryId = Convert.ToInt32(drpTopcategory.SelectedValue); _boscat.IsActive = false; _boscat.IsDelete = false; _boscat.CreatedBy = merchantId; _boscat.CreatedDate = DateTime.UtcNow; _boscat.UpdatedBy = merchantId; _boscat.UpdatedDate = DateTime.UtcNow; _boscat.Event = "Insert"; int result = _bascat.Insert(_boscat); if (result == 1) { ShowMessage("Category added successfully", MessageType.Success); } } } catch (Exception ex) { Common.LogError(ex); ShowMessage("Some technical error", MessageType.Warning); } txtcategory.Text = ""; }
private void btnAdd_Click(object sender, EventArgs e) { try { if (ValidateTextBoxes()) { if (SecCatId > 0) { _boscat.SecondCategoryId = SecCatId; _boscat.SecondCategoryName = txtSecondCategory.Text; _boscat.TopCategoryId = Convert.ToInt32(cmbTopCategory.SelectedValue); _boscat.IsActive = true; _boscat.IsDelete = false; _boscat.CreatedBy = loginID; _boscat.CreatedDate = DateTime.UtcNow; _boscat.UpdatedBy = loginID; _boscat.UpdatedDate = DateTime.UtcNow; _boscat.Event = "Update"; MessageBox.Show(Common.Message("Second category", bscat.Update(_boscat))); SecCatId = default(int); txtSecondCategory.Text = ""; } else { _boscat.SecondCategoryName = txtSecondCategory.Text; _boscat.TopCategoryId = Convert.ToInt32(cmbTopCategory.SelectedValue); _boscat.IsActive = true; _boscat.IsDelete = false; _boscat.CreatedBy = loginID; _boscat.CreatedDate = DateTime.UtcNow; _boscat.UpdatedBy = loginID; _boscat.UpdatedDate = DateTime.UtcNow; _boscat.Event = "Insert"; MessageBox.Show(Common.Message("Second category", bscat.Insert(_boscat))); SecCatId = default(int); txtSecondCategory.Text = ""; } btnAdd.Text = "Add"; FillDataGridView(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected void btnAdd_Click(object sender, EventArgs e) { try { if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); if (validateForm()) { _boscat.SecondCategoryName = txtSecondCategory.Text; _boscat.TopCategoryId = Convert.ToInt32(ddlTopCategory.SelectedValue); _boscat.IsActive = true; _boscat.IsDelete = false; _boscat.CreatedBy = adminId; _boscat.CreatedDate = DateTime.UtcNow; _boscat.UpdatedBy = adminId; _boscat.UpdatedDate = DateTime.UtcNow; if (ViewState["scatId"] != null) { _boscat.SecondCategoryId = Convert.ToInt32(ViewState["scatId"]); _boscat.Event = "Update"; if (_bascat.Update(_boscat) == 2) { ShowMessage("Category updated successfully", MessageType.Success); } } else { _boscat.SecondCategoryId = 0; _boscat.Event = "Insert"; if (_bascat.Insert(_boscat) == 1) { ShowMessage("Category added successfully", MessageType.Success); } } } } } catch (Exception ex) { Common.LogError(ex); ShowMessage("Some technical error", MessageType.Warning); } ClearControl(); }