Esempio n. 1
0
        //public bool Notifications(Masters AR)
        //{
        //    bool _val = false;
        //    try
        //    {
        //        dbManager.Open();
        //        dbManager.BeginTransaction();
        //        dbManager.CreateParameters(7);
        //        dbManager.AddParameters(0, "Id", AR.Id, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(1, "NotificationTitle", AR.Notifications, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(2, "FromDate", AR.FromDate, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(3, "ToDate", AR.ToDate, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(4, "CreatedBy", AR.UserName, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(5, "IpAddress", AR.Ip, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(6, "Action", "I", ParameterDirection.Input, DaoConstants.InParamSize);

        //        Int32 iResult = Convert.ToInt32(dbManager.ExecuteNonQuery(CommandType.StoredProcedure, "GLI_Notifications"));
        //        if (iResult > 0)
        //        {
        //            dbManager.CommitTransaction();
        //            _val = true;
        //        }
        //        else
        //        {
        //            dbManager.RollBackTransaction();
        //            _val = false;
        //        }
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        dbManager.Dispose();
        //        dbManager = null;
        //    }
        //    return _val;
        //}

        //public bool Arbitration(Masters AR)
        //{
        //    bool _val = false;
        //    try
        //    {
        //        dbManager.Open();
        //        dbManager.BeginTransaction();
        //        dbManager.CreateParameters(6);
        //        dbManager.AddParameters(0, "Id", AR.Id, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(1, "ArbitrationTitle", AR.ArbitrationTitle, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(2, "ArbitrationDescription", AR.ArbitrationDescription, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(3, "CreatedBy", AR.UserName, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(4, "IpAddress", AR.Ip, ParameterDirection.Input, DaoConstants.InParamSize);
        //        dbManager.AddParameters(5, "Action", "I", ParameterDirection.Input, DaoConstants.InParamSize);

        //        Int32 iResult = Convert.ToInt32(dbManager.ExecuteNonQuery(CommandType.StoredProcedure, "GLI_GetArbitration"));
        //        if (iResult > 0)
        //        {
        //            dbManager.CommitTransaction();
        //            _val = true;
        //        }
        //        else
        //        {
        //            dbManager.RollBackTransaction();
        //            _val = false;
        //        }
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        dbManager.Dispose();
        //        dbManager = null;
        //    }
        //    return _val;
        //}

        public List <AdminMenu_DTO> GetArbitrations(AdminMenu_DTO M)
        {
            IDataReader          dr       = null;
            List <AdminMenu_DTO> lstMenus = new List <AdminMenu_DTO>();

            try
            {
                dbManager.Open();
                AdminMenu_DTO obj = null;
                dbManager.CreateParameters(1);
                dr = dbManager.ExecuteReader(CommandType.StoredProcedure, "GetModules");
                while (dr.Read())
                {
                    obj            = new AdminMenu_DTO();
                    obj.MenuId     = dr["MenuId"] == DBNull.Value ? default(int) : Convert.ToInt32(dr["MenuId"]);
                    obj.MenuName   = dr["MenuName"] == DBNull.Value ? string.Empty : dr["MenuName"].ToString();
                    obj.MainMenuId = dr["MainMenuId"] == DBNull.Value ? default(int) : Convert.ToInt32(dr["MainMenuId"]);
                    lstMenus.Add(obj);
                    obj = null;
                }
                dr.Close();
                return(lstMenus);
            }
            catch (Exception ex)
            {
                if (dr != null)
                {
                    dr.Close();
                }
                return(null);
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                dbManager.Dispose();
                dbManager = null;
            }
        }
Esempio n. 2
0
        //To Get Data From Button Click in Proforma1
        public List <ListProforma1Details> GetProforma1Details(int?villageCode, string baseSurveyNumber)
        {
            IDataReader dr = null;
            List <ListProforma1Details> proformaList = new List <ListProforma1Details>();

            try
            {
                dbManager.Open();
                ListProforma1Details obj = null;
                dbManager.CreateParameters(2);
                dbManager.AddParameters(0, "VillageCode", GetDBNullOrValue(villageCode), ParameterDirection.Input, DaoConstants.InParamSize);
                dbManager.AddParameters(1, "BaseSurveyNo", GetDBNullOrValue(baseSurveyNumber), ParameterDirection.Input, DaoConstants.InParamSize);
                dr = dbManager.ExecuteReader(CommandType.StoredProcedure, "USP_WL_Prof1_GETRSRBaseSurvey_SubDivisions");
                while (dr.Read())
                {
                    obj = new ListProforma1Details();
                    //obj.DistrictCode = dr["dist_code"] == DBNull.Value ? default(int) : Convert.ToInt32(dr["dist_code"]);
                    //obj.MandalCode = dr["mand_code"] == DBNull.Value ? default(int) : Convert.ToInt32(dr["mand_code"]);
                    obj.VillageNameTelugu  = dr["vill_name"] == DBNull.Value ? string.Empty : dr["vill_name"].ToString();
                    obj.VillageNameEnglish = dr["Evill_name"] == DBNull.Value ? string.Empty : dr["Evill_name"].ToString();
                    obj.BaseSurveyNo       = dr["base"] == DBNull.Value ? string.Empty : dr["base"].ToString();
                    obj.SubDivNo           = dr["subdivno"] == DBNull.Value ? string.Empty : dr["subdivno"].ToString();
                    obj.TotalExtent        = dr["area"] == DBNull.Value ? string.Empty : dr["subdivno"].ToString();
                    obj.LandNature         = dr["wlnature"] == DBNull.Value ? string.Empty : dr["wlnature"].ToString();
                    obj.LandClassification = dr["wlclassification"] == DBNull.Value ? string.Empty : dr["wlclassification"].ToString();
                    obj.PattadarName       = dr["wlpattadar"] == DBNull.Value ? string.Empty : dr["wlpattadar"].ToString();
                    obj.OfficerRemarks     = dr["wlremarks"] == DBNull.Value ? string.Empty : dr["wlremarks"].ToString();
                    proformaList.Add(obj);
                    obj = null;
                }
                dr.Close();
                return(proformaList);
            }
            catch (Exception ex)
            {
                if (dr != null)
                {
                    dr.Close();
                }
                return(null);
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                dbManager.Dispose();
                dbManager = null;
            }
        }
        private static void GetParticularIDAndTypeID(IDBManager dbManager, string particularName, string particularSubType, out int particularID, out int particularSubTypeID)
        {
            particularID        = 0;
            particularSubTypeID = 0;
            string selectQuery = string.Format(@"SELECT ParticularsID,ParticularsSubTypeID from Particulars p
                                                JOIN ParticularsSubType pst on pst.ParticularID =p.ParticularsID 
                                                WHERE p.ParticularName='{0}' and pst.SubTypeName='{1}'", particularName, particularSubType);
            var    dataread    = dbManager.ExecuteReader(CommandType.Text, selectQuery);

            while (dataread.Read())
            {
                particularID        = Convert.ToInt32(dataread["ParticularsID"]);
                particularSubTypeID = Convert.ToInt32(dataread["ParticularsSubTypeID"]);
            }
            dataread.Close();
        }
Esempio n. 4
0
        // fetches drawings for every fz_id associated with a gived node_id
        // different from other fetches
        private void FetchDrawingList(ArrayList localist, IDBManager dbmgr)
        {
            if (localist.Count == 0)
                _route.drawinglist = null;
            else
            {
                string qryString = "SELECT * FROM viewROUTELOCADWGS rd WHERE rd.NODE_ID = @node_id AND rd.FZ_ID = @fz_id ORDER BY rd.DWG_REF";
                ArrayList list = new ArrayList();										    // create new ArrayList to house objects

                foreach (Routeloca litem in localist)
                {
                    RoutelocaDwg item = new RoutelocaDwg();							        // create new object type to be able to get property info
                    PropertyInfo[] p = item.GetType().GetProperties();					    // get property info for item

                    dbmgr.CreateParameters(2);											    // create parameters
                    dbmgr.AddParameters(0, "@node_id", litem.node_id);					    // node id
                    dbmgr.AddParameters(1, "@fz_id", litem.fz_id);						    // loca id
                    dbmgr.ExecuteReader(CommandType.Text, qryString);					    // execute query

                    while (dbmgr.DataReader.Read())
                    {
                        item = new RoutelocaDwg();										    // create new item
                        item = (RoutelocaDwg)FetchObject(item, p, dbmgr);
                        list.Add(item);													    // add item to the ArrayList
                    }
                    dbmgr.CloseReader();
                }

                _route.drawinglist = list;										            // update item list
            }
        }
Esempio n. 5
0
        private void FetchLICdocList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewFADOCS WHERE FA_ID = @fa_id AND DOC_TYPE = @doc_type ORDER BY DOC";
            FADoc item = new FADoc();
            ArrayList list = new ArrayList();

            PropertyInfo[] p = item.GetType().GetProperties();
            dbmgr.CreateParameters(2);
            dbmgr.AddParameters(0, "@fa_id", id);
            dbmgr.AddParameters(1, "@doc_type", "LIC");
            dbmgr.ExecuteReader(CommandType.Text, qryString);

            while (dbmgr.DataReader.Read())
            {
                item = new FADoc();
                item = (FADoc)FetchObject(item, p, dbmgr);
                list.Add(item);
            }

            dbmgr.CloseReader();
            _firearea.licdoclist = list;
        }
        // procedure fetches drawings given a component id
        private void FetchDrawingList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewCOMPDWGS cd WHERE cd.COMP_ID = @comp_id AND cd.DWGTYPE_desc = 'Other' ORDER BY cd.DWG_REF, cd.DWG_REV";
            //string qryString = "SELECT * FROM viewCOMPDWGS cd WHERE cd.COMP_ID = @comp_id AND DWGTYPE_ID <= 4 ORDER BY cd.DWGTYPE_ID, cd.DWG_REF, cd.DWG_REV";

            CompDwg item = new CompDwg();
            ArrayList list = new ArrayList();

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(1);											            // create parameters
            dbmgr.AddParameters(0, "@comp_id", id);								            // component id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new CompDwg();											            // create new item
                item = (CompDwg)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }

            dbmgr.CloseReader();
            _comp.drawinglist = list;												        // update object item list
        }
Esempio n. 7
0
        private void FetchCabDispList(int fa_id, int comp_id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewFACABDISP_LIVE WHERE FA_ID = @fa_id AND COMP_ID = @comp_id ORDER BY COMP, CABLE, DISP";
            FACabDisp item = new FACabDisp();									            // create new object type to be able to get property info
            ArrayList list = new ArrayList();										        // create new ArrayList to house objects

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(2);											            // create parameters
            dbmgr.AddParameters(0, "@fa_id", fa_id);							            // fire area id
            dbmgr.AddParameters(1, "@comp_id", comp_id);
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new FACabDisp();
                item = (FACabDisp)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }
            dbmgr.CloseReader();
            _firearea.cabdisplist = list;											        // update item list
        }
Esempio n. 8
0
        private void FetchCompDispList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewFACOMPDISP_LIVE WHERE FA_ID = @fa_id ORDER BY COMP, DISP";
            FACompDisp item = new FACompDisp();											    // create new object type to be able to get property info
            ArrayList list = new ArrayList();										        // create new ArrayList to house objects

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(1);											            // create parameters
            dbmgr.AddParameters(0, "@fa_id", id);							                // fire area id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new FACompDisp();
                item = (FACompDisp)FetchObject(item, p, dbmgr);
                item.in_fa = Convert.ToBoolean(dbmgr.DataReader["in_fa"]);
                list.Add(item);
            }

            dbmgr.CloseReader();
            _firearea.compdisplist = list;
        }
Esempio n. 9
0
        private string Get_BD_ENDPT(int id, IDBManager dbmgr)
        {
            string bd_endpt = "";
            string qryString;

            switch (_user.locaType)
            {
                case Constant.type_FR:
                    qryString = "SELECT * FROM viewBDENDPOINTS_FR AS e WHERE e.NODE_ID = @node_id ORDER BY e.BD_ENDPT";
                    break;
                default:
                    qryString = "SELECT * FROM viewBDENDPOINTS AS e WHERE e.NODE_ID = @node_id ORDER BY e.BD_ENDPT";
                    break;
            }
            dbmgr.CreateParameters(1);											            // create parameters
            dbmgr.AddParameters(0, "@node_id", id);								            // node id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                if (bd_endpt == "")
                    bd_endpt = "'" + dbmgr.DataReader["BD_ENDPT"].ToString() + "'";
                else
                    bd_endpt = bd_endpt + ", " + "'" + dbmgr.DataReader["BD_ENDPT"].ToString() + "'";
            }

            dbmgr.CloseReader();
            return bd_endpt;
        }
Esempio n. 10
0
        // procedure fetches recovery action list
        private void FetchRAList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewFACOMPRA AS r WHERE r.COMP_ID = @comp_id ORDER BY r.FA, r.RA_DISP";

            CompRA item = new CompRA();
            ArrayList list = new ArrayList();

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(1);											            // create required parameters
            dbmgr.AddParameters(0, "@comp_id", id);								            // component id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new CompRA();											            // create new item
                item = (CompRA)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }

            dbmgr.CloseReader();
            _comp.ralist = list;												            // update object item list
        }
Esempio n. 11
0
        // procedure fetches incoming interlocks
        private void FetchIncomingIntlkList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewCOMPINTLKS ci WHERE ci.COMP_ID = @comp_id ORDER BY ci.INTLK, ci.DEVICE, ci.CONTACTS";

            CompIntlk item = new CompIntlk();
            ArrayList list = new ArrayList();

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(1);											            // create parameters
            dbmgr.AddParameters(0, "@comp_id", id);								            // component id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new CompIntlk();											            // create new item
                item = (CompIntlk)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }

            dbmgr.CloseReader();
            _comp.incomingintlklist = list;												    // update component item list
        }
Esempio n. 12
0
        // procedure fetches subcomponent list
        private void FetchSubcompList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewSUBCOMPS s WHERE s.COMP_ID = @comp_id ORDER BY s.SUBCOMP";

            Subcomp item = new Subcomp();
            ArrayList list = new ArrayList();

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(1);											            // create parameters
            dbmgr.AddParameters(0, "@comp_id", id);								            // component id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new Subcomp();											            // create new item
                item = (Subcomp)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }

            dbmgr.CloseReader();
            _comp.subcomplist = list;												        // update component item list
        }
Esempio n. 13
0
        private void FetchRouteList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT DISTINCT RM_ID, RM, FZ_ID, FZ, NODE_ID, NODE FROM viewFRDATA WHERE NODE IS NOT NULL AND RM_ID=@rm_id " +
                "UNION " +
                "SELECT DISTINCT RM_ID, RM, FZ_ID, FZ, NODE_ID, NODE FROM viewROUTELOCA_FR WHERE NODE_ID IS NOT NULL AND RM_ID=@rm_id " +
                "ORDER BY NODE";

            FRoute item = new FRoute();
            ArrayList list = new ArrayList();

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(1);											            // create required parameters
            dbmgr.AddParameters(0, "@rm_id", id);								            // component id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new FRoute();											                // create new item
                item = (FRoute)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to ArrayList
            }

            dbmgr.CloseReader();
            _fireroom.routelist = list;												        // update object item list
        }
Esempio n. 14
0
        private void FetchFAList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewFADOCS d WHERE d.DOC_ID = @doc_id ORDER BY d.FA";
            FADoc item = new FADoc();											            // create new object type to be able to get property info
            ArrayList list = new ArrayList();										        // create new ArrayList to house objects
            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item

            dbmgr.CreateParameters(1);											            // create parameters
            dbmgr.AddParameters(0, "@doc_id", id);							                // document id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new FADoc();											                // create new item
                item = (FADoc)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }

            dbmgr.CloseReader();
            _document.falist = list;												        // update object item list
        }
Esempio n. 15
0
        // procedure fetches fire zone information
        private void FetchFireRoom(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewFRLIST WHERE RM_ID=@id";

            dbmgr.CreateParameters(1);
            dbmgr.AddParameters(0, "@id", id);
            dbmgr.ExecuteReader(CommandType.Text, qryString);
            if (dbmgr.DataReader.Read())
            {
                // get properties of object and fetch object
                PropertyInfo[] p = _fireroom.GetType().GetProperties();
                _fireroom = (FireRoom)FetchObject(_fireroom, p, dbmgr);
            }

            dbmgr.CloseReader();
        }
Esempio n. 16
0
        private void FetchComponentList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT DISTINCT RM_ID, RM, FZ_ID, FZ, COMP_ID, COMP, dbo.IN_FR(COMP_ID, FZ_ID) AS IN_FZ FROM viewFRDATA " +
                "WHERE COMP_SSD_REQ=1 AND CABLE_SSD_REQ=1 AND COMP IS NOT NULL AND RM_ID=@rm_id ORDER BY COMP";

            FComp item = new FComp();
            ArrayList list = new ArrayList();

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(1);											            // create required parameters
            dbmgr.AddParameters(0, "@rm_id", id);								            // component id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new FComp();											            // create new item
                item = (FComp)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to ArrayList
            }

            dbmgr.CloseReader();
            _fireroom.componentlist = list;												    // update object item list
        }
Esempio n. 17
0
        private void FetchDrawingList(int id, IDBManager dbmgr)
        {
            string qryString;

            switch (_user.plant)
            {
                case "ANO":
                    qryString = "SELECT * FROM viewCOMPCABDWGS cd WHERE cd.CABLE_ID = @cable_id ORDER BY DWG_REF";
                    break;
                default:
                    qryString = "SELECT * FROM viewCOMPCABDWGS cd WHERE cd.CABLE_ID = @cable_id AND cd.DWGTYPE_DESC = 'Other' ORDER BY cd.DWG_REF, cd.DWG_REV";
                    break;
            }

            CabDwg item = new CabDwg();											            // create new object type to be able to get property info
            ArrayList list = new ArrayList();										        // create new ArrayList to house objects
            try
            {
                PropertyInfo[] p = item.GetType().GetProperties();					        // get property info for item
                dbmgr.Open();														        // open database manager
                dbmgr.CreateParameters(1);											        // create parameters
                dbmgr.AddParameters(0, "@cable_id", id);								    // cable id
                dbmgr.ExecuteReader(CommandType.Text, qryString);					        // execute query

                while (dbmgr.DataReader.Read())
                {
                    item = new CabDwg();											        // create new item
                    item = (CabDwg)FetchObject(item, p, dbmgr);
                    list.Add(item);													        // add item to the ArrayList
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
            _cable.drawinglist = list;												        // update item list
        }
Esempio n. 18
0
        private void FetchRoute(int id, IDBManager dbmgr)
        {
            string qryLocal = "SELECT * FROM viewROUTELIST WHERE NODE_ID=@id ORDER BY NODE";

            dbmgr.CreateParameters(1);
            dbmgr.AddParameters(0, "@id", id);
            dbmgr.ExecuteReader(CommandType.Text, qryLocal);
            if (dbmgr.DataReader.Read())
            {
                PropertyInfo[] p = _route.GetType().GetProperties();
                _route = (Route)FetchObject(_route, p, dbmgr);
            }

            dbmgr.CloseReader();
        }
Esempio n. 19
0
        private void FetchCableList(int id, IDBManager dbmgr)
        {
            string qryString;

            switch (_user.plant)
            {
                case "ANO":
                    qryString = "SELECT cd.COMP_ID,  " +
                        " COMP = CASE WHEN c.CHKD_DATE IS NULL AND c.CABLE_CODE LIKE '%YES%' THEN 'R' ELSE '-' END, " +
                        " cd.CABLE_ID, cd.CABLE, cd.DWG_ID, cd.DWG_REF, cd.DWG_REV, cd.DWGTYPE_ID " +
                        " FROM viewCOMPCABDWGS AS cd " +
                        " LEFT OUTER JOIN viewCABLIST c ON c.CABLE_ID = cd.CABLE_ID " +
                        " WHERE cd.DWG_ID = @dwg_id " +
                        " ORDER BY cd.CABLE";
                    break;
                default:
                    qryString = "SELECT cd.*, '' AS COMP FROM viewCABDWGS AS cd " +
                        "INNER JOIN viewCABLIST_USED AS c ON c.CABLE_ID = cd.CABLE_ID " +
                        "WHERE cd.DWG_ID = @dwg_id ORDER BY cd.CABLE";
                    break;
            }

            CabDwg item = new CabDwg();											            // create new object type to be able to get property info
            ArrayList list = new ArrayList();										        // create new ArrayList to house objects
            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item

            dbmgr.CreateParameters(1);											            // create parameters
            dbmgr.AddParameters(0, "@dwg_id", id);							                // drawing id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new CabDwg();											            // create new item
                item = (CabDwg)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }

            dbmgr.CloseReader();
            _drawing.cablelist = list;												        // update object item list
        }
Esempio n. 20
0
        private void FetchRoutelocaList(int id, IDBManager dbmgr)
        {
            string qryString;
            Routeloca item = new Routeloca();
            ArrayList list = new ArrayList();
            PropertyInfo[] p = item.GetType().GetProperties();

            switch (_user.plant)
            {
                case "BLN":
                case "TFAC":
                    qryString = "SELECT * FROM viewROUTELOCA_FR rl WHERE rl.NODE_ID = @node_id ORDER BY rl.RM, rl.FZ";
                    break;
                default:
                    qryString = "SELECT * FROM viewROUTELOCA rl WHERE rl.NODE_ID = @node_id ORDER BY rl.RM, rl.FZ";
                    break;
            }

            dbmgr.CreateParameters(1);
            dbmgr.AddParameters(0, "@node_id", id);
            dbmgr.ExecuteReader(CommandType.Text, qryString);

            while (dbmgr.DataReader.Read())
            {
                item = new Routeloca();
                item = (Routeloca)FetchObject(item, p, dbmgr);
                list.Add(item);
            }

            dbmgr.CloseReader();
            _route.routelocalist = list;
        }
Esempio n. 21
0
        private void FetchDrawing(int id, IDBManager dbmgr)
        {
            string qryLocal = "SELECT * FROM viewDWGLIST WHERE DWG_ID=@id";

            dbmgr.CreateParameters(1);
            dbmgr.AddParameters(0, "@id", id);
            dbmgr.ExecuteReader(CommandType.Text, qryLocal);
            if (dbmgr.DataReader.Read())
            {
                // get properties of object and fetch object
                PropertyInfo[] p = _drawing.GetType().GetProperties();
                _drawing = (Drawing)FetchObject(_drawing, p, dbmgr);
            }

            dbmgr.CloseReader();
        }
Esempio n. 22
0
        private void FetchComponent(int id, IDBManager dbmgr)
        {
            string qryLocal = "SELECT * FROM viewCOMPLIST WHERE COMP_ID=@id";

            dbmgr.CreateParameters(1);                                                      // create required parameters
            dbmgr.AddParameters(0, "@id", id);
            dbmgr.ExecuteReader(CommandType.Text, qryLocal);                                // execute reader
            if (dbmgr.DataReader.Read())
            {
                // get properties of object and fetch object
                PropertyInfo[] p = _comp.GetType().GetProperties();
                _comp = (Component)FetchObject(_comp, p, dbmgr);
            }

            dbmgr.CloseReader();
        }
Esempio n. 23
0
        private void FetchRoutelocaList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewROUTELOCADWGS_ALL rd WHERE rd.DWG_ID = @dwg_id ORDER BY rd.NODE";
            RoutelocaDwg item = new RoutelocaDwg();											// create new object type to be able to get property info
            ArrayList list = new ArrayList();										        // create new ArrayList to house objects
            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item

            dbmgr.CreateParameters(1);											            // create parameters
            dbmgr.AddParameters(0, "@dwg_id", id);							                // drawing id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new RoutelocaDwg();											        // create new item
                item = (RoutelocaDwg)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }

            dbmgr.CloseReader();
            _drawing.routelocalist = list;												    // update object item list
        }
Esempio n. 24
0
        public ArrayList FetchComboList(string initMsg, string param)
        {
            string qryString = "SELECT DISTINCT CABLE_ID, CABLE FROM viewFADATA_SSD WHERE FA_ID = @fa_id AND COMP_ID = @comp_id ORDER BY CABLE";
            ArrayList list = new ArrayList();

            string[] strTemp = ((string)param).Split(new char[] { '|' });
            int fa_id = Convert.ToInt32(strTemp[0]);
            int comp_id = Convert.ToInt32(strTemp[1]);

            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            try
            {
                // initialize
                if (initMsg.Length > 0)
                    list.Add(new ComboBoxItem(initMsg, "0"));

                _dbmgr.Open();
                _dbmgr.CreateParameters(2);
                _dbmgr.AddParameters(0, "@fa_id", fa_id);
                _dbmgr.AddParameters(1, "@comp_id", comp_id);
                _dbmgr.ExecuteReader(CommandType.Text, qryString);

                while (_dbmgr.DataReader.Read() == true)
                {
                    if (_dbmgr.DataReader.GetInt32(0) != 0)
                        list.Add(new ComboBoxItem(_dbmgr.DataReader.GetString(1), _dbmgr.DataReader.GetInt32(0).ToString())); ;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
            return list;
        }
Esempio n. 25
0
        private void FetchVFDRList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT f.FA, v.* FROM FAVFDR v INNER JOIN FALIST f ON f.FA_ID = v.FA_ID WHERE v.FA_ID = @fa_id ORDER BY v.VFDR_ID";
            FAVFDR item = new FAVFDR();
            ArrayList list = new ArrayList();

            PropertyInfo[] p = item.GetType().GetProperties();
            dbmgr.CreateParameters(1);
            dbmgr.AddParameters(0, "@fa_id", id);
            dbmgr.ExecuteReader(CommandType.Text, qryString);

            while (dbmgr.DataReader.Read())
            {
                item = new FAVFDR();
                item = (FAVFDR)FetchObject(item, p, dbmgr);
                list.Add(item);
            }

            dbmgr.CloseReader();
            _firearea.vfdrlist = list;
        }
Esempio n. 26
0
        private void FetchCascPowerList(string analysis, int fa_id, IDBManager dbmgr)
        {
            FACascHit item = new FACascHit();											    // create new object type to be able to get property info
            ArrayList list = new ArrayList();										        // create new ArrayList to house objects

            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item
            dbmgr.CreateParameters(2);											            // create parameters
            dbmgr.AddParameters(0, "@analysis", analysis);							            // fire area id
            dbmgr.AddParameters(1, "@fa_id", fa_id);
            dbmgr.ExecuteReader(CommandType.StoredProcedure, "dbo.FACASC_POWER_s"); // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new FACascHit();											            // create new item
                item = (FACascHit)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }
            dbmgr.CloseReader();
            _firearea.cascpowerlist = list;											        // update item list
        }
Esempio n. 27
0
 private void FetchCRDPowerList(int id, IDBManager dbmgr)
 {
     string qryString = "SELECT * FROM viewCRDPOWERCAB cc WHERE cc.CABLE_ID = @cable_id ORDER BY cc.POWER, cc.BKRFUSE";
     PSLoad item = new PSLoad();
     ArrayList list = new ArrayList();
     try
     {
         PropertyInfo[] p = item.GetType().GetProperties();
         dbmgr.Open();
         dbmgr.CreateParameters(1);
         dbmgr.AddParameters(0, "@cable_id", id);
         dbmgr.ExecuteReader(CommandType.Text, qryString);
         while (dbmgr.DataReader.Read())
         {
             item = new PSLoad();
             item = (PSLoad)FetchObject(item, p, dbmgr);
             list.Add(item);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dbmgr.Dispose();
     }
     _cable.crdpowerlist = list;
 }
Esempio n. 28
0
        private void FetchFireArea(int id, IDBManager dbmgr)
        {
            string qryLocal = "SELECT * FROM viewFALIST WHERE FA_ID=@id ORDER BY FA";
            dbmgr.CreateParameters(1);
            dbmgr.AddParameters(0, "@id", id);
            dbmgr.ExecuteReader(CommandType.Text, qryLocal);
            if (dbmgr.DataReader.Read())
            {
                PropertyInfo[] p = _firearea.GetType().GetProperties();
                _firearea = (FireArea)FetchObject(_firearea, p, dbmgr);
            }

            dbmgr.CloseReader();
        }
Esempio n. 29
0
        private void FetchCableList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewCABROUTE_CHKD c WHERE c.NODE_ID = @node_id ORDER BY c.CABLE";
            CabRoute item = new CabRoute();							                        // create new object type to be able to get property info
            ArrayList list = new ArrayList();										        // create new ArrayList to house objects
            PropertyInfo[] p = item.GetType().GetProperties();					            // get property info for item

            dbmgr.CreateParameters(1);											            // create parameters
            dbmgr.AddParameters(0, "@node_id", id);								            // node id
            dbmgr.ExecuteReader(CommandType.Text, qryString);					            // execute query

            while (dbmgr.DataReader.Read())
            {
                item = new CabRoute();											            // create new item
                item = (CabRoute)FetchObject(item, p, dbmgr);
                list.Add(item);													            // add item to the ArrayList
            }

            dbmgr.CloseReader();
            _route.cablelist = list;										                // update item list
        }
Esempio n. 30
0
        private void FetchProtectionList(int id, IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM viewFZPROTECTION WHERE FA_ID = @fa_id ORDER BY FZ, SYS_CATEGORY, SYS_NAME";
            FZProtection item = new FZProtection();
            ArrayList list = new ArrayList();

            PropertyInfo[] p = item.GetType().GetProperties();
            dbmgr.CreateParameters(1);
            dbmgr.AddParameters(0, "@fa_id", id);
            dbmgr.ExecuteReader(CommandType.Text, qryString);

            while (dbmgr.DataReader.Read())
            {
                item = new FZProtection();
                item = (FZProtection)FetchObject(item, p, dbmgr);
                list.Add(item);
            }

            dbmgr.CloseReader();
            _firearea.protectionlist = list;
        }
Esempio n. 31
0
 private void FetchRouteList(int id, IDBManager dbmgr)
 {
     string qryString = "SELECT * FROM viewCABROUTE_PLANT cr WHERE cr.CABLE_ID = @cable_id ORDER BY cr.SEQ, cr.NODE";
     CabRoute item = new CabRoute();											        //create new object type to be able to get property info
     ArrayList list = new ArrayList();										        //create new ArrayList to house objects
     try
     {
         PropertyInfo[] p = item.GetType().GetProperties();					        //get property info for item
         dbmgr.Open();														        //open database manager
         dbmgr.CreateParameters(1);											        //create parameters
         dbmgr.AddParameters(0, "@cable_id", id);								    //cable id
         dbmgr.ExecuteReader(CommandType.Text, qryString);					        //execute query
         while (dbmgr.DataReader.Read())
         {
             item = new CabRoute();											        //create new item
             item = (CabRoute)FetchObject(item, p, dbmgr);
             list.Add(item);													        //add item to the ArrayList
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dbmgr.Dispose();
     }
     _cable.routelist = list;												        //update item list
 }
Esempio n. 32
0
        private void FetchBDEndpointList(int id, IDBManager dbmgr)
        {
            string bd_endpt = Get_BD_ENDPT(id, dbmgr);
            _route.bd_endpt = bd_endpt.Replace("'", "");

            if (_route.bd_endpt=="")
                _route.bdendpointlist=null;
            else
            {
                string qryString = "SELECT * FROM viewBDENDPOINTS e WHERE e.BD_ENDPT IN (" + bd_endpt + ") ORDER BY e.ENDPT";
                RouteBDEndpoint item = new RouteBDEndpoint();							    // create new object type to be able to get property info
                ArrayList list = new ArrayList();										    // create new ArrayList to house objects
                PropertyInfo[] p = item.GetType().GetProperties();					        // get property info for item

                dbmgr.ExecuteReader(CommandType.Text, qryString);					        // execute query

                while (dbmgr.DataReader.Read())
                {
                    item = new RouteBDEndpoint();										    // create new item
                    item = (RouteBDEndpoint)FetchObject(item, p, dbmgr);
                    list.Add(item);													        // add item to the ArrayList
                }

                dbmgr.CloseReader();
                _route.bdendpointlist = list;										        //update item list
            }
        }
Esempio n. 33
0
 private void FetchCable(int id, IDBManager dbmgr)
 {
     string qryLocal = "SELECT *, dbo.GET_LOCATION(FR_EQUIP) AS FR_EQUIP_LOC, dbo.GET_LOCATION(TO_EQUIP) AS TO_EQUIP_LOC, " +
         " dbo.GET_LOCATION(FR_EQUIP_ORIG) AS FR_EQUIP_ORIG_LOC, dbo.GET_LOCATION(TO_EQUIP_ORIG) AS TO_EQUIP_ORIG_LOC " +
         " FROM viewCABLIST WHERE CABLE_ID = @id";
     try
     {
         dbmgr.Open();
         dbmgr.CreateParameters(1);
         dbmgr.AddParameters(0, "@id", id);
         dbmgr.ExecuteReader(CommandType.Text, qryLocal);
         if (dbmgr.DataReader.Read())
         {
             PropertyInfo[] p = _cable.GetType().GetProperties();                    // get properties of object
             _cable = (Cable)FetchObject(_cable, p, dbmgr);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dbmgr.Dispose();
     }
 }