public static DataTable GetUnit() { DataTable dt = new DataTable(); try { string sSql = "Select Unit_ID,Unit_Name from dbo.UOM Order by Unit_Name"; BsfGlobal.OpenRateAnalDB(); SqlDataAdapter sda = new SqlDataAdapter(sSql, BsfGlobal.g_RateAnalDB); dt = new DataTable(); sda.Fill(dt); sda.Dispose(); BsfGlobal.g_RateAnalDB.Close(); } catch (Exception ex) { BsfGlobal.CustomException(ex.Message, ex.StackTrace); } return(dt); }
public static DataTable FillRecord1(string sql) { BsfGlobal.OpenRateAnalDB(); DataTable dt = null; try { SqlDataAdapter sda = new SqlDataAdapter(sql, BsfGlobal.g_RateAnalDB); dt = new DataTable(); sda.Fill(dt); sda.Dispose(); } catch (Exception ex) { BsfGlobal.CustomException(ex.Message, ex.StackTrace); } finally { BsfGlobal.g_RateAnalDB.Close(); } return(dt); }
public bool CheckCity(int argCityId) { bool status = false; string sSql = ""; SqlDataAdapter sda; DataTable dt; try { BsfGlobal.OpenVendorAnalDB(); BsfGlobal.OpenWorkFlowDB(); BsfGlobal.OpenRateAnalDB(); sSql = "Select CityId from Branch Where CityId=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_VendorDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select CityId from VendorLocation Where CityId=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_VendorDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select CityId from VendorMaster Where CityId=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_VendorDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select CityId from CompanyMaster Where CityId=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_WorkFlowDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select CityId from CostCentre Where CityId=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_WorkFlowDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select CityId from Users Where CityId=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_WorkFlowDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select Location_Id from ConceptionRegister Where Location_Id=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_RateAnalDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select Location_Id from IOW_Rate Where Location_Id=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_RateAnalDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select Location_Id from IOW_Rate_Q Where Location_Id=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_RateAnalDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select Location_Id from Project_List Where Location_Id=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_RateAnalDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select Location_Id from Project_List Where Location_Id=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_RateAnalDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select Location_Id from Resource_Rate Where Location_Id=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_RateAnalDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } sSql = "Select Location_Id from Resource_Rate_Q Where Location_Id=" + argCityId + " "; dt = new DataTable(); sda = new SqlDataAdapter(sSql, BsfGlobal.g_RateAnalDB); sda.Fill(dt); if (dt.Rows.Count > 0) { status = false; return(status); } status = true; } catch (Exception ce) { throw ce; } finally { BsfGlobal.g_VendorDB.Close(); BsfGlobal.g_WorkFlowDB.Close(); BsfGlobal.g_RateAnalDB.Close(); } return(status); }