public void Delete(object obj)
 {
     _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
     _dbmgr = new DBManager(_user.plantDBStr);
     _dbmgr.ConnectionString = _user.plantDBStr;
     DeleteDisposition(obj, _dbmgr);
 }
        public void Delete(object obj)
        {
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            string type = obj.GetType().ToString();

            switch (type)
            {
                case "FRIAS.Common.Entity.FireArea":
                    DeleteFireArea(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.FACompDisp":
                    DeleteCompDisp(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.FACabDisp":
                    DeleteCabDisp(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.FAVFDR":
                    DeleteVFDR(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.FADOC":
                    DeleteDocument(obj, _dbmgr);
                    break;
            }
        }
        public object Fetch(object obj)
        {
            int id;
            id = ((FireRoom)obj).rm_id;

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

            try
            {
                _dbmgr.Open();
                // fetch object information
                FetchFireRoom(id, _dbmgr);
                FetchComponentList(id, _dbmgr);
                FetchCableList(id, _dbmgr);
                FetchRouteList(id, _dbmgr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }

            return _fireroom;
        }
        public object Fetch(object obj)
        {
            int id;
            string type;                                                                    //type of object passed
            string objtype = obj.GetType().ToString();                                      //get object type
            if (objtype == "System.String")
            {
                string[] strTemp = ((string)obj).Split(new char[] { '|' });                 //if the object type is a string then extract the id and type
                id = Convert.ToInt32(strTemp[0]);
                type = strTemp[1];
            }
            else
            {
                id = ((Disposition)obj).disp_id;
                type = "all";                                                               //object is a cable and get all information
            }

            _disp = new Disposition();                                                     //create new instance of object
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            switch (type)
            {
                case "facompcabdisp":
                    FetchFACompCabList(id, _dbmgr);
                    return _disp.facompcablist;
                case "all":
                    FetchDisposition(id, _dbmgr);
                    FetchFACompCabList(id, _dbmgr);
                    return _disp;
            }
            return _disp;
        }
        public void Delete(object obj)
        {
            // get connection
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            string type = obj.GetType().ToString();

            // delete from database
            switch (type)
            {
                case "FRIAS.Common.Entity.FireZone":
                    DeleteFireZone(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.FZProtection":
                    DeleteProtection(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.FZIgnition":
                    DeleteIgnition(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.FZIgnitionImpact":
                    DeleteIgnitionImpact(obj, _dbmgr);
                    break;
            }
        }
        // fetches object and object items
        // user has option of passing object itself OR a string with id and type delimited by '|'
        public object Fetch(object obj)
        {
            int id = ((CableBlock)obj).comp_id;

            // create new object and database connection
            _cabBlock = new CableBlock();
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            try
            {
                _dbmgr.Open();

                FetchComponent(id, _dbmgr);
                FetchCableBlock(id, _dbmgr);
                FetchVertexList(id, _dbmgr);
                return _cabBlock;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
        }
 public ComponentManager()
 {
     loadAssembly();
     _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
     _dbmgr = new DBManager(_user.plantDBStr);
     _dbmgr.ConnectionString = _user.plantDBStr;
 }
        // deletes given object or object item
        public void Delete(object obj)
        {
            // create database connection
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

               // determine type of object
               string type = obj.GetType().ToString();
               switch (type)
               {
               case "FRIAS.Common.Entity.Component":
                   DeleteComponent(obj, _dbmgr);
                   break;
               case "FRIAS.Common.Entity.CompDwg":
                   DeleteDrawing(obj, _dbmgr);
                   break;
               case "FRIAS.Common.Entity.Subcomp":
                   DeleteSubcomp(obj, _dbmgr);
                   break;
               case "FRIAS.Common.Entity.CompPwr":
                   DeletePower(obj, _dbmgr);
                   break;
               case "FRIAS.Common.Entity.CompIntlk":
                   DeleteInterlock(obj, _dbmgr);
                   break;
               case "FRIAS.Common.Entity.CompCab":
                   DeleteCable(obj, _dbmgr);
                   break;
               }
        }
Example #9
0
        public object Fetch(object obj)
        {
            int id;
            string type;                                                                    // type of object passed
            string objtype = obj.GetType().ToString();                                      // get object type
            if (objtype == "System.String")
            {
                string[] strTemp = ((string)obj).Split(new char[] { '|' });                 // if the object type is a string then extract the id and type
                id = Convert.ToInt32(strTemp[0]);
                type = strTemp[1];
            }
            else
            {
                id = ((Route)obj).node_id;
                type = "all";                                                               // object is a cable and get all information
            }
            _route = new Route();                                                           // create new instance of object
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            try
            {
                _dbmgr.Open();

                switch (type)
                {
                    case "routeloca":
                        FetchRoutelocaList(id, _dbmgr);
                        return _route.routelocalist;
                    case "routelocadwg":
                        FetchRoutelocaList(id, _dbmgr);
                        FetchDrawingList(_route.routelocalist, _dbmgr);
                        return _route.drawinglist;
                    case "bdendpoint":
                        FetchBDEndpointList(id, _dbmgr);
                        return _route.bdendpointlist;
                    case "cable":
                        FetchCableList(id, _dbmgr);
                        return _route.cablelist;
                    default:
                        FetchRoute(id, _dbmgr);
                        FetchRoutelocaList(id, _dbmgr);
                        FetchBDEndpointList(id, _dbmgr);
                        FetchDrawingList(_route.routelocalist, _dbmgr);
                        FetchCableList(id, _dbmgr);
                        return _route;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
        }
Example #10
0
        public object Fetch(object obj)
        {
            int id;
            string type;                                                                    // type of object passed
            string objtype = obj.GetType().ToString();                                      // get object type

            if (objtype == "System.String")
            {
                string[] strTemp = ((string)obj).Split(new char[] { '|' });                 // if object type is a string then extract the id and type
                id = Convert.ToInt32(strTemp[0]);
                type = strTemp[1];
            }
            else
            {
                id = ((Power)obj).power_id;
                type = "all";                                                               // object is  drawing and get all information
            }

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

            try
            {
                _dbmgr.Open();

                switch (type)
                {
                    case "component":
                        FetchComponentList(id, _dbmgr);
                        return _power.componentlist;
                    case "psload":
                        FetchPSLoadList(id, _dbmgr);
                        return _power.psloadlist;
                    case "psbkrcab":
                        FetchPSBkrCabList(id, _dbmgr);
                        return _power.psbkrcablist;
                    case "cabroutelist":
                        FetchCabRoutelist(id, _dbmgr);
                        return _power.cabroutelist;
                    default:
                        FetchPower(id, _dbmgr);
                        FetchComponentList(id, _dbmgr);
                        FetchPSLoadList(id, _dbmgr);
                        return _power;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
        }
Example #11
0
        // deletes given object or object item
        public void Delete(object obj)
        {
            // create database connection
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            DeleteRA(obj, _dbmgr);
        }
        public void Delete(object obj)
        {
            // get connection
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            // delete from database
            DeleteFireRoom(obj, _dbmgr);
        }
Example #13
0
        // fetches object and object items
        // user has option of passing object itself OR a string with id and type delimited by '|'
        public object Fetch(object obj)
        {
            int id;
            string type;
            string objtype = obj.GetType().ToString();

            if (objtype == "System.String")
            {
                string[] strTemp = ((string)obj).Split(new char[] { '|' });
                id = Convert.ToInt32(strTemp[0]);
                type = strTemp[1];
            }
            else
            {
                id = ((Component)obj).comp_id;
                type = "all";
            }

            // create new object and database connection
            _comp = new Component();
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            try
            {
                _dbmgr.Open();

                // determine type
                switch (type)
                {
                    case "ra":
                        FetchRAList(id, _dbmgr);
                        return _comp.ralist;
                    default:
                        FetchComponent(id, _dbmgr);
                        FetchFACompDispList(id, _dbmgr);
                        FetchRAList(id, _dbmgr);
                        return _comp;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
        }
Example #14
0
        public void Delete(object obj)
        {
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;
            string type = obj.GetType().ToString();

            switch (type)
            {
                case "FRIAS.Common.Entity.Drawing":
                    DeleteDrawing(obj, _dbmgr);
                    break;
            }
        }
        public object Fetch(object obj)
        {
            int id;
            string type;                                                                    //type of object passed
            string objtype = obj.GetType().ToString();                                      //get object type
            if (objtype == "System.String")
            {
                string[] strTemp = ((string)obj).Split(new char[] { '|' });                 //if the object type is a string then extract the id and type
                id = Convert.ToInt32(strTemp[0]);
                type = strTemp[1];
            }
            else
            {
                id = ((Document)obj).doc_id;
                type = "all";                                                               //object is  document and get all information
            }

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

            try
            {
                _dbmgr.Open();
                switch (type)
                {
                    case "firearea":
                        FetchFAList(id, _dbmgr);
                        return _document.falist;
                    default:
                        FetchDocument(id, _dbmgr);
                        FetchFAList(id, _dbmgr);
                        return _document;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
        }
Example #16
0
        public object Fetch(object obj)
        {
            int id;
            string type;                                                                    // type of object passed
            string objtype = obj.GetType().ToString();                                      // get object type
            if (objtype == "System.String")
            {
                string[] strTemp = ((string)obj).Split(new char[] { '|' });                 // if the object type is a string then extract the id and type
                id = Convert.ToInt32(strTemp[0]);
                type = strTemp[1];
            }
            else
            {
                id = ((Cable)obj).cable_id;
                type = "all";                                                               // object is a cable and get all information
            }

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

            switch (type)
            {
                case "component":
                    FetchComponentList(id, _dbmgr);
                    return _cable.componentlist;
                case "drawing":
                    FetchDrawingList(id, _dbmgr);
                    return _cable.drawinglist;
                case "routechg":
                    FetchRoutechgList(id, _dbmgr);
                    return _cable.routechglist;
                case "all":
                    FetchCable(id, _dbmgr);
                    FetchComponentList(id, _dbmgr);
                    FetchDrawingList(id, _dbmgr);
                    FetchRoutechgList(id, _dbmgr);
                    FetchRouteList(id, _dbmgr);
                    FetchCRDPowerList(id, _dbmgr);
                    return _cable;
            }
            return _cable;
        }
Example #17
0
        // fetches user information
        public object Fetch(object obj)
        {
            string type;

            string objtype = obj.GetType().ToString();
            if (objtype == "System.String")
                type = "userlist";
            else
                type = "user";

            _user = new User();
            _dbmgr = new DBManager(DBHelper.getProvider(Config.getValue("DBStr", "")));
            _dbmgr.ConnectionString = Config.getValue("DBStr", "");

            try
            {
                _dbmgr.Open();

                switch (type)
                {
                    case "userlist":
                        FetchAccessList(_dbmgr);
                        return _accesslist;
                    default:
                        FetchUser(obj, _dbmgr);
                        //if (_user.initial != null)
                        //    FetchPlantInfo(_user, _dbmgr);
                        return _user;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
        }
        public object Fetch(object obj)
        {
            int id;
            string type;

            // determine id and type
            string objtype = obj.GetType().ToString();
            if (objtype == "System.String")
            {
                string[] strTemp = ((string)obj).Split(new char[] { '|' });
                id = Convert.ToInt32(strTemp[0]);
                type = strTemp[1];
            }
            else
            {
                id = ((FireZone)obj).fz_id;
                type = "all";
            }

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

            try
            {
                _dbmgr.Open();

                // fetch object information
                switch (type)
                {
                    case "firezone":
                        FetchFireZone(id, _dbmgr);
                        return _firezone;
                    case "protection":
                        FetchProtectionList(id, _dbmgr);
                        return _firezone;
                    case "ignition":
                        FetchIgnitionList(id, _dbmgr);
                        return _firezone;
                    case "ignitionimpact":
                        // TODO: Need to pass ignition information
                        //FetchIgnitionImpactList(id, _dbmgr);
                        return _firezone;
                    case "all":
                        FetchFireZone(id, _dbmgr);
                        FetchComponentList(id, _dbmgr);
                        FetchCableList(id, _dbmgr);
                        FetchRouteList(id, _dbmgr);
                        FetchProtectionList(id, _dbmgr);
                        FetchIgnitionList(id, _dbmgr);
                        return _firezone;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }

            return _firezone;
        }
Example #19
0
        // fetches user access list
        private void FetchAccessList(IDBManager dbmgr)
        {
            string qryString = "SELECT * FROM USERLIST ORDER BY NAME";

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

            PropertyInfo[] p = item.GetType().GetProperties();
            dbmgr.ExecuteReader(CommandType.Text, qryString);

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

            dbmgr.CloseReader();
            _accesslist = list;
        }
Example #20
0
        public void Update(object obj)
        {
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            string type = obj.GetType().ToString();

            switch (type)
            {
                case "FRIAS.Common.Entity.Route":
                    UpdateRoute(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.Routeloca":
                    UpdateRouteloca(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.RoutelocaDwg":
                    UpdateDrawing(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.RouteBDEndpoint":
                    UpdateBDEndpoint(obj, _dbmgr);
                    break;
            }
        }
Example #21
0
        public DataSet FetchDataSet(string criteria)
        {
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];

            DataSet ds = new DataSet();
            string qryString;

            switch (_user.plant)
            {
                case "BLN":
                case "TFAC":
                    qryString = "SELECT * FROM viewROUTELIST_FR ORDER BY NODE";
                    break;
                default:
                    qryString = "SELECT * FROM viewROUTELIST ORDER BY NODE";
                    break;
            }

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

            try
            {
                _dbmgr.Open();
                ds = (DataSet)_dbmgr.ExecuteDataSet(CommandType.Text, qryString);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
            return ds;
        }
Example #22
0
        // locks sign-off controls based on prep_by, chkd_by and user intitials
        public static void LockControls(Control control, string prep_by, string chkd_by, User user)
        {
            if (user.level != User.admin)
            {
                // if there is no prep_by user cannot enter chkd_by or chkd_date
                // NOTE: if user enter prep_date w/ prep_by=N/A error message is given in the page
                if (prep_by == "N/A")
                {
                    ((DropDownList)control.FindControl("chkd_by")).Enabled = false;
                    ((TextBox)control.FindControl("chkd_date")).Enabled = false;
                }

                // if user is preparer, he cannot also be the checker
                if (user.initial == prep_by)
                {
                    ((DropDownList)control.FindControl("chkd_by")).Enabled = false;
                    ((TextBox)control.FindControl("chkd_date")).Enabled = false;
                }
                else
                {
                    // otherwise if user is not preparer, and therefore should not be able to change prep_by or prep_date
                    if (prep_by != "N/A")
                    {
                        ((DropDownList)control.FindControl("prep_by")).Enabled = false;
                        ((TextBox)control.FindControl("prep_date")).Enabled = false;
                    }
                }

                // if user is not checker and there is already a checker, then he cannot change chkd_date
                if ((user.initial != chkd_by) && (chkd_by != "N/A"))
                    ((TextBox)control.FindControl("chkd_date")).Enabled = false;
            }
        }
        public void Update(object obj)
        {
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;
            string type = obj.GetType().ToString();										    //get the type of object

            switch (type)																    //update respective object
            {
                case "FRIAS.Common.Entity.Document":
                    UpdateDocument(obj, _dbmgr);
                    break;
            }
        }
Example #24
0
        // fetches user information
        private void FetchUser(object obj, IDBManager dbmgr)
        {
            string qryLocal = "SELECT * FROM USERLIST WHERE NAME=@name";
            _user = (User)obj;

            dbmgr.CreateParameters(1);
            dbmgr.AddParameters(0, "@name", _user.name);
            dbmgr.ExecuteReader(CommandType.Text, qryLocal);

            if (dbmgr.DataReader.Read())
            {
                // get properties of object and fetch object
                PropertyInfo[] p = _user.GetType().GetProperties();
                _user = (User)FetchObject(_user, p, dbmgr);
            }
            else
            {
                _user.initial = "";
                _user.password = null;
            }

            dbmgr.CloseReader();
        }
        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;
        }
        /// <summary>
        /// Fetches Dataset
        /// </summary>
        /// <param name="criteria">Prep_Only, Prep and Chkd, Show All</param>
        /// <returns>Dataset</returns>
        public DataSet FetchDataSet(string criteria)
        {
            DataSet ds = new DataSet();
            string qryString;
            switch (criteria)
            {
                case "Prep Only":
                    qryString = "SELECT * FROM viewCOMPLIST_LITE WHERE PREP_DATE IS NOT NULL AND CHKD_DATE IS NULL ORDER BY COMP";
                    break;
                case "Prep and Chkd":
                    qryString = "SELECT * FROM viewCOMPLIST_LITE WHERE PREP_DATE IS NOT NULL AND CHKD_DATE IS NOT NULL ORDER BY COMP";
                    break;
                case "Show All":
                default:
                    qryString = "SELECT * FROM viewCOMPLIST_LITE ORDER BY COMP";
                    break;
            }

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

            try
            {
                _dbmgr.Open();
                ds = (DataSet)_dbmgr.ExecuteDataSet(CommandType.Text, qryString);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
            return ds;
        }
        public DataSet FetchDataSet(string criteria)
        {
            DataSet ds = new DataSet();
            string qryString = "SELECT * FROM viewFALIST ORDER BY FA";

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

            try
            {
                _dbmgr.Open();
                ds = (DataSet)_dbmgr.ExecuteDataSet(CommandType.Text, qryString);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
            return ds;
        }
        // fetches object and object items
        // user has option of passing object itself OR a string with id and type delimited by '|'
        public object Fetch(object obj)
        {
            int id = 0;
            string name = "";
            string type = "all";

            string objtype = obj.GetType().ToString();
            if (objtype == "System.String")
            {
                // if the object type is a string then extract the id and type
                string[] strTemp = ((string)obj).Split(new char[] { '|' });
                type = strTemp[1];
                if (type == "pricomp")
                    name = strTemp[0];
                else
                    id = Convert.ToInt32(strTemp[0]);
            }
            else
                id = ((Component)obj).comp_id;

            // create new object and database connection
            _comp = new Component();
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            try
            {
                _dbmgr.Open();

                // determine type
                switch (type)
                {
                    case "drawing":
                        FetchDrawingList(id, _dbmgr);
                        return _comp.drawinglist;
                    case "power":
                        FetchPowerList(id, _dbmgr);
                        return _comp.powerlist;
                    case "subcomp":
                        FetchSubcompList(id, _dbmgr);
                        return _comp.subcomplist;
                    case "pricomp":
                        FetchPriCompList(name, _dbmgr);
                        return _comp.pricomplist;
                    case "interlock":
                        FetchIncomingIntlkList(id, _dbmgr);
                        return _comp.incomingintlklist;
                    case "cable":
                        FetchCableList(id, _dbmgr);
                        return _comp.cablelist;
                    case "be":
                        FetchBEList(id, _dbmgr);
                        return _comp.belist;
                    default:
                        FetchComponent(id, _dbmgr);
                        FetchDrawingList(id, _dbmgr);
                        FetchSubcompList(id, _dbmgr);
                        FetchPowerList(id, _dbmgr);
                        FetchLoadList(id, _dbmgr);
                        FetchIncomingIntlkList(id, _dbmgr);
                        FetchOutgoingIntlkList(id, _dbmgr);
                        FetchCableList(id, _dbmgr);
                        return _comp;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }
        }
        public object Fetch(object obj)
        {
            int fa_id;
            int comp_id = 0;
            string type;                                                                    // type of object passed
            string objtype = obj.GetType().ToString();                                      // get object type
            if (objtype == "System.String")
            {
                string[] strTemp = ((string)obj).Split(new char[] { '|' });                 // if the object type is a string then extract the id and type
                fa_id = Convert.ToInt32(strTemp[0]);
                type = strTemp[1];
                comp_id = Convert.ToInt32(strTemp[2]);
            }
            else
            {
                fa_id = ((FireArea)obj).fa_id;
                type = "all";                                                               // object is a cable and get all information
            }

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

            try
            {
                _dbmgr.Open();

                switch (type)
                {
                    //case "facompdisp":
                    //    FetchCompDispList(fa_id, _dbmgr);
                    //    return _firearea.compdisplist;
                    case "facabdisp":
                        FetchCabDispList(fa_id, comp_id, _dbmgr);
                        break;
                        //return _firearea.cabdisplist;
                    case "facompinfo":
                        FetchCabDispList(fa_id, comp_id, _dbmgr);
                        break;
                        //return _firearea;
                    case "faB3Table":
                        FetchFireArea(fa_id, _dbmgr);
                        FetchVFDRList(fa_id, _dbmgr);
                        FetchPGList(fa_id, _dbmgr);
                        FetchGENdocList(fa_id, _dbmgr);
                        FetchEEdocList(fa_id, _dbmgr);
                        FetchLICdocList(fa_id, _dbmgr);
                        FetchIgnitionList(fa_id, _dbmgr);
                        FetchProtectionList(fa_id, _dbmgr);
                        break;
                        //return _firearea;
                    case "all":
                        FetchFireArea(fa_id, _dbmgr);
                        FetchCompDispList(fa_id, _dbmgr);
                        FetchCascPowerList("SSD", fa_id, _dbmgr);
                        FetchCascIntlkList("SSD", fa_id, _dbmgr);
                        break;
                        //return _firearea;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _dbmgr.Dispose();
            }

            return _firearea;
        }
Example #30
0
        public void Update(object obj)
        {
            _user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
            _dbmgr = new DBManager(_user.plantDBStr);
            _dbmgr.ConnectionString = _user.plantDBStr;

            string type = obj.GetType().ToString();

            switch (type)
            {
                case "FRIAS.Common.Entity.PSLoad":
                    UpdatePSLoad(obj, _dbmgr);
                    break;
                case "FRIAS.Common.Entity.PSBkrCab":
                    UpdatePSBkrCab(obj, _dbmgr);
                    break;
                case "System.Collections.ArrayList":
                    UpdateCabRoute(obj, _dbmgr);
                    break;
            }
        }