private void frmMain_FormClosed(object sender, FormClosedEventArgs e) { try { ClsUtility.Init_Hashtable(); //Assets.UtFunctions theDB = new Assets.UtFunctions(); if (clsGbl.DBState != "No data" || clsGbl.DBState != "" || clsGbl.DBState != "Loading") { clsGbl.DBState = "Ready"; int i = (int)theObject.ReturnObject(Entity.getconnString(clsGbl.xmlPath), ClsUtility.theParams , "UPDATE aa_Database SET IQStatus='Ready', UpdateDate=dbo.fn_GetCurrentDate()" , ClsUtility.ObjectEnum.ExecuteNonQuery, serverType); } else if (clsGbl.DBState == "Loading") { clsGbl.DBState = "Loading"; int i = (int)theObject.ReturnObject(Entity.getconnString(clsGbl.xmlPath), ClsUtility.theParams , "UPDATE aa_Database SET IQStatus='Loading'", ClsUtility.ObjectEnum.ExecuteNonQuery, serverType); } } catch (Exception ex) { EH.LogError(ex.Message, "<<frmMain_FormClosed>>", serverType); } Application.Exit(); }
private void cmdEMap_Click(object sender, EventArgs e) { //TODO Replace with pr_SaveUpdateExcelMapping_IQTools Cursor.Current = Cursors.WaitCursor; DataRow qryDR; DataRow catDR; ClsUtility.Init_Hashtable(); int i = 0; qryDR = (DataRow)theObject.ReturnObject(Entity.getconnString(clsGbl.xmlPath), ClsUtility.theParams , "SELECT qryID FROM aa_Queries WHERE qryName = '" + lstQueries.Items[lstQueries.SelectedIndex].ToString() + "'" , ClsUtility.ObjectEnum.DataRow, serverType); catDR = (DataRow)theObject.ReturnObject(Entity.getconnString(clsGbl.xmlPath), ClsUtility.theParams , "SELECT sbCatID FROM aa_SBCategory " + "WHERE sbCategory = '" + lstCategories.Items[lstCategories.SelectedIndex].ToString() + "' And QryId=" + qryDR["QryID"], ClsUtility.ObjectEnum.DataRow, serverType); i = 0; try { string sql = "DELETE FROM aa_XLMaps WHERE QryID=" + qryDR["qryID"].ToString() + " AND xlCatID=" + catDR["sbCatID"].ToString(); i = (int)theObject.ReturnObject(Entity.getconnString(clsGbl.xmlPath), ClsUtility.theParams, sql , ClsUtility.ObjectEnum.ExecuteNonQuery, serverType); foreach (DataGridViewRow dr in dgXls.Rows) { if (dr.Cells["xlsCell"].Value.ToString().Length > 1) { //i = (int)theObject.ReturnObject(Entity.getconnString(clsGbl.xmlPath), ClsUtility.theParams // , "UPDATE aa_XLMaps SET xlsCell, QryID, xlsTitle, xlCatID, CreateDate, DhisElementID, CategoryOptionID) VALUES('" + // dr.Cells["xlsCell"].Value.ToString() + "', " + qryDR["qryID"].ToString() + ", '" // + dr.Cells["xlsTitle"].Value.ToString() + "', " + catDR["sbCatID"].ToString() + ", dbo.fn_GetCurrentDate(), '" // + dr.Cells["DHISElementID"].Value.ToString() + "','" + dr.Cells["categoryOptionID"].Value.ToString() + "' )" // , ClsUtility.ObjectEnum.ExecuteNonQuery, serverType); i = (int)theObject.ReturnObject(Entity.getconnString(clsGbl.xmlPath), ClsUtility.theParams , "INSERT INTO aa_XLMaps (xlsCell, QryID, xlsTitle, xlCatID, CreateDate, DhisElementID, CategoryOptionID) VALUES('" + dr.Cells["xlsCell"].Value.ToString() + "', " + qryDR["qryID"].ToString() + ", '" + dr.Cells["xlsTitle"].Value.ToString() + "', " + catDR["sbCatID"].ToString() + ", dbo.fn_GetCurrentDate(), '" + dr.Cells["DHISElementID"].Value.ToString() + "','" + dr.Cells["categoryOptionID"].Value.ToString() + "' )" , ClsUtility.ObjectEnum.ExecuteNonQuery, serverType); } } MessageBox.Show("Query Mapping Was Saved Successfully", Assets.Messages.InfoHeader); } catch (Exception ex) { EH.LogError(ex.Message, "Excel Mapping", serverType); } Cursor.Current = Cursors.Default; }