protected void btnSave_Click(object sender, ImageClickEventArgs e) { if (ViewState["Mode"].ToString() == "Add") { bool CountryCode = reasonCode.CheckDataExist(txtCode.Text.Trim(),MaintenaceTable.ReasonCodes); if (CountryCode) { string columnName = "TableCd,Dsc,ShortDsc,Comments,IssueDoc,SOEAllowed,GLApp,APApp,ARApp,SOApp,POApp,IMApp,WMApp,WOApp,MMApp,SMApp,EntryID,EntryDt,ChangeID,ChangeDt,TableType"; string columnValue = "'" + txtCode.Text.Trim().Replace("'", "''") + "'," + "'" + txtDescription.Text.Trim().Replace("'", "''") + "'," + "'" + txtShortDesc.Text.Trim().Replace("'", "''") + "'," + "'" + txtComments.Text.Trim().Replace("'", "''") + "'," + "'" + txtIssueDoc.Text.Trim().Replace("'", "''") + "'," + "'" + txtSOEExpense.Text.Trim().Replace("'", "''") + "'," + "'" + ((chkSelection.Items[0].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[1].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[2].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[3].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[4].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[5].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[6].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[7].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[8].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[9].Selected == true) ? "Y" : "") + "'," + "'" + Session["UserName"] + "'," + "'" + DateTime.Now.ToShortDateString() + "'," + "'" + Session["UserName"] + "'," + "'" + DateTime.Now.ToShortDateString() + "','REAS'"; reasonCode.InsertTables(columnName,columnValue); DisplaStatusMessage(updateMessage, "Success"); btnSave.Visible = false; btnDelete.Visible = false; } else { DisplaStatusMessage("Code Already Exists", "Fail"); upnlGrid.Update(); pnlProgress.Update(); return; } } else { string updateValue = "TableCd='" + txtCode.Text.Trim().Replace("'", "''") + "'," + "Dsc='" + txtDescription.Text.Trim().Replace("'", "''") + "'," + "ShortDsc='" + txtShortDesc.Text.Trim().Replace("'", "''") + "'," + "Comments='" + txtComments.Text.Trim().Replace("'", "''") + "'," + "IssueDoc='" + txtIssueDoc.Text.Trim().Replace("'", "''") + "'," + "SOEAllowed='" + txtSOEExpense.Text.Trim().Replace("'", "''") + "'," + "GLApp='" + ((chkSelection.Items[0].Selected == true) ? "Y" : "") + "'," + "APApp='" + ((chkSelection.Items[1].Selected == true) ? "Y" : "") + "'," + "ARApp='" + ((chkSelection.Items[2].Selected == true) ? "Y" : "") + "'," + "SOApp='" + ((chkSelection.Items[3].Selected == true) ? "Y" : "") + "'," + "POApp='" + ((chkSelection.Items[4].Selected == true) ? "Y" : "") + "'," + "IMApp='" + ((chkSelection.Items[5].Selected == true) ? "Y" : "") + "'," + "WMApp='" + ((chkSelection.Items[6].Selected == true) ? "Y" : "") + "'," + "WOApp='" + ((chkSelection.Items[7].Selected == true) ? "Y" : "") + "'," + "MMApp='" + ((chkSelection.Items[8].Selected == true) ? "Y" : "") + "'," + "SMApp='" + ((chkSelection.Items[9].Selected == true) ? "Y" : "") + "'," + "ChangeID='" + Session["UserName"].ToString() + "'," + "ChangeDt='" + DateTime.Now.ToShortDateString() + "'"; reasonCode.UpdateTables(updateValue, "pTableID=" + hidPrimaryKey.Value.Trim()); DisplaStatusMessage(updateMessage, "Success"); btnSave.Visible = false; btnDelete.Visible = false; ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Focus", "document.getElementById('div-datagrid').scrollTop='" + hidScrollTop.Value + "';", true); } ViewState["Operation"] = "Save"; Clear(); BindDataGrid(); UpdatePanels(); }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { if (ViewState["Mode"].ToString() == "Add") { bool ExpenseCode = expenseCode.CheckDataExist(txtCode.Text.Trim(), MaintenaceTable.ExpenseCodes); if (ExpenseCode) { string columnName = "TableCd,Dsc,ShortDsc,GLAccountNo,Pct,LineNumber,ExpType,Indicator,TaxStatus,GLApp,APApp,ARApp,SOApp,POApp,IMApp,WMApp,WOApp,MMApp,SMApp,EntryID,EntryDt,TableType"; string columnValue = "'" + txtCode.Text.Trim() + "'," + "'" + txtDescription.Text.Trim() + "'," + "'" + txtShortDesc.Text.Trim() + "'," + "'" + ddlGLAccount.SelectedValue.Trim() + "'" + "," + (txtPercent.Text.Trim() == "" ? "NULL" : txtPercent.Text.Trim()) + "," + (txtExpLine.Text.Trim() == "" ? "NULL" : txtExpLine.Text.Trim()) + "," + "'" + ddlExpType.SelectedValue.Trim() + "'," + "'" + ddlIndicator.SelectedValue.Trim() + "'," + "'" + ddlTaxStatus.SelectedValue.Trim() + "'," + "'" + ((chkSelection.Items[0].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[1].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[2].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[3].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[4].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[5].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[6].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[7].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[8].Selected == true) ? "Y" : "") + "'," + "'" + ((chkSelection.Items[9].Selected == true) ? "Y" : "") + "'," + "'" + Session["UserName"] + "'," + "'" + DateTime.Now.ToShortDateString() + "'," + "'EXP'"; expenseCode.InsertTables(columnName, columnValue); DisplaStatusMessage(updateMessage, "Success"); //BindDataGrid(); btnSave.Visible = false; btnDelete.Visible = false; } else { DisplaStatusMessage("Code Already Exists", "Fail"); upnlGrid.Update(); pnlProgress.Update(); return; } } else { string updateValue = "TableCd='" + txtCode.Text.Trim().Replace("'", "''") + "'," + "Dsc='" + txtDescription.Text.Trim().Replace("'", "''") + "'," + "ShortDsc='" + txtShortDesc.Text.Trim().Replace("'", "''") + "'," + "GLAccountNo='" + ddlGLAccount.SelectedValue.Trim() + "'," + "Pct=" + (txtPercent.Text.Trim() == "" ? "NULL" : txtPercent.Text.Trim()) + "," + "ExpType='" + ddlExpType.SelectedValue.Trim() + "'," + "LineNumber=" + (txtExpLine.Text.Trim() == "" ? "NULL" : txtExpLine.Text.Trim()) + "," + "Indicator='" + ddlIndicator.SelectedValue.Trim() + "'," + "TaxStatus='" + ddlTaxStatus.SelectedValue.Trim() + "'," + "GLApp='" + ((chkSelection.Items[0].Selected == true) ? "Y" : "") + "'," + "APApp='" + ((chkSelection.Items[1].Selected == true) ? "Y" : "") + "'," + "ARApp='" + ((chkSelection.Items[2].Selected == true) ? "Y" : "") + "'," + "SOApp='" + ((chkSelection.Items[3].Selected == true) ? "Y" : "") + "'," + "POApp='" + ((chkSelection.Items[4].Selected == true) ? "Y" : "") + "'," + "IMApp='" + ((chkSelection.Items[5].Selected == true) ? "Y" : "") + "'," + "WMApp='" + ((chkSelection.Items[6].Selected == true) ? "Y" : "") + "'," + "WOApp='" + ((chkSelection.Items[7].Selected == true) ? "Y" : "") + "'," + "MMApp='" + ((chkSelection.Items[8].Selected == true) ? "Y" : "") + "'," + "SMApp='" + ((chkSelection.Items[9].Selected == true) ? "Y" : "") + "'," + "ChangeID='" + Session["UserName"].ToString() + "'," + "ChangeDt='" + DateTime.Now.ToShortDateString() + "'"; expenseCode.UpdateTables(updateValue, "pTableID=" + hidPrimaryKey.Value.Trim()); // BindDataGrid(); DisplaStatusMessage(updateMessage, "Success"); btnSave.Visible = false; btnDelete.Visible = false; ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Focus", "document.getElementById('div-datagrid').scrollTop='" + hidScrollTop.Value + "';", true); } ViewState["Operation"] = "Save"; Clear(); BindDataGrid(); UpdatePanels(); }