private void GridDataBind() { try { ApplicationResult objResult = new ApplicationResult(); MaterialGroupBL objMaterialGroupBL = new MaterialGroupBL(); objResult = objMaterialGroupBL.MaterialGroup_SelectAll(); if (objResult != null) { gvMaterialGroup.DataSource = objResult.resultDT; gvMaterialGroup.DataBind(); if (objResult.resultDT.Rows.Count > 0) { PanelGrid_VisibilityMode(1); } else { PanelGrid_VisibilityMode(2); } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
public void BindYear() { ApplicationResult objResult = new ApplicationResult(); Controls objControls = new Controls(); MaterialGroupBL objMaterialGroupBl = new MaterialGroupBL(); objResult = objMaterialGroupBl.GetYear(); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { objControls.BindDropDown_ListBox(objResult.resultDT, ddlYear, "Year", "Year"); ddlYear.SelectedIndex = 1; } } }
public void GetMaterialGroupName() { ApplicationResult objResult = new ApplicationResult(); Controls objControls = new Controls(); MaterialGroupBL objMaterialGroupBl = new MaterialGroupBL(); objResult = objMaterialGroupBl.MaterialGroup_SelectAll(); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { objControls.BindDropDown_ListBox(objResult.resultDT, ddlMaterialGroupName, "MaterialGroupName", "MaterialGroupID"); } ddlMaterialGroupName.Items.Insert(0, new ListItem("--Select--", "")); } }
protected void gvMaterialGroup_RowCommand(object sender, GridViewCommandEventArgs e) { try { Controls objControls = new Controls(); ApplicationResult objResults = new ApplicationResult(); MaterialGroupBL objMaterialGroupBL = new MaterialGroupBL(); ViewState["MaterialGroupID"] = Convert.ToInt32(e.CommandArgument.ToString()); if (e.CommandName.ToString() == "Edit1") { objResults = objMaterialGroupBL.MaterialGroup_Select(Convert.ToInt32(ViewState["MaterialGroupID"].ToString())); if (objResults != null) { if (objResults.resultDT.Rows.Count > 0) { txtMGroupName.Text = objResults.resultDT.Rows[0][MaterialGroupBO.MATERIALGROUP_MATERIALGROUPNAME].ToString(); txtDescription.Text = objResults.resultDT.Rows[0][MaterialGroupBO.MATERIALGROUP_DESCRIPTION].ToString(); ViewState["Mode"] = "Edit"; PanelGrid_VisibilityMode(2); } } } else if ((e.CommandName.ToString() == "Delete1")) { objResults = objMaterialGroupBL.MaterialGroup_Delete(Convert.ToInt32(ViewState["MaterialGroupID"].ToString())); if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) { ClearAll(); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Material Group deleted successfully.');</script>"); GridDataBind(); PanelGrid_VisibilityMode(1); } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Material Group is not deleted because it is in use.');</script>"); } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
private void BindgvMaterial() { try { ApplicationResult objResult = new ApplicationResult(); MaterialGroupBL objMaterialGroupBl = new MaterialGroupBL(); objResult = objMaterialGroupBl.MaterialGroup_Select_ForMaterial(Convert.ToInt32(ddlMaterialGroupName.SelectedValue), Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), ddlYear.Text); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { gvMaterial.DataSource = objResult.resultDT; gvMaterial.DataBind(); //(TextBox)row.FindControl("txtStock"); for (int i = 0; i < objResult.resultDT.Rows.Count; i++) { var Id = objResult.resultDT.Rows[i]["MaterialTID"].ToString(); var Stock = objResult.resultDT.Rows[i]["Stock"].ToString(); foreach (GridViewRow row in gvMaterial.Rows) { if (row.Cells[0].Text == Id) { // ((CheckBox)row.FindControl("chkChild")).Checked = true; Convert.ToDouble(((TextBox)row.FindControl("txtStock")).Text = Stock); } } } divGrid.Visible = true; btnSave.Visible = true; } else { gvMaterial.DataSource = null; gvMaterial.DataBind(); divGrid.Visible = false; ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Stock is already Updated of this year or Financial year has not changed.');</script>"); } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
public void BindMaterialGroup() { try { ApplicationResult objResult = new ApplicationResult(); MaterialGroupBL objMaterialGroupBL = new MaterialGroupBL(); Controls objControl = new Controls(); objResult = objMaterialGroupBL.MaterialGroup_SelectAll(); if (objResult != null) { objControl.BindDropDown_ListBox(objResult.resultDT, ddlMaterialGroup, "MaterialGroupName", "MaterialGroupID"); } ddlMaterialGroup.Items.Insert(0, new ListItem("--Select--", "")); } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
protected void btnSave_Click(object sender, EventArgs e) { try { ApplicationResult objResults = new ApplicationResult(); MaterialGroupBO objMaterialGroupBO = new MaterialGroupBO(); MaterialGroupBL objMaterialGroupBL = new MaterialGroupBL(); objMaterialGroupBO.MaterialGroupName = txtMGroupName.Text; objMaterialGroupBO.Description = txtDescription.Text; objMaterialGroupBO.LastModifiedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objMaterialGroupBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); int intClear = 1; if (ViewState["Mode"].ToString() == "Save") { objMaterialGroupBO.CreatedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objMaterialGroupBO.CreatedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); objResults = objMaterialGroupBL.MaterialGroup_Insert(objMaterialGroupBO); if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) { intClear = 1; ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Material Group Created Successfully.');</script>"); } else { intClear = 0; ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Material Group is already exist.');</script>"); } } else if (ViewState["Mode"].ToString() == "Edit") { objMaterialGroupBO.MaterialGroupID = Convert.ToInt32(ViewState["MaterialGroupID"].ToString()); objResults = objMaterialGroupBL.MaterialGroup_Update(objMaterialGroupBO); if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) { intClear = 1; ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Material Group updated successfully.');</script>"); } else { intClear = 0; ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Material Group is already exist.');</script>"); } } if (intClear == 1) { ClearAll(); GridDataBind(); PanelGrid_VisibilityMode(1); } else { txtMGroupName.Text = ""; } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }