Esempio n. 1
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;
            }
        }
        internal DataSet Fetch_LoginDtl(string UserCode, string Password, ref string sReturnMsg)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();
            DataSet    ds        = new DataSet();

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(3);
                dbManager.AddParameters(0, "LoginUserCode", UserCode, ParameterDirection.Input);
                dbManager.AddParameters(1, "UserPassword", Password, ParameterDirection.Input);
                dbManager.AddParameters(2, "@RetMsg", string.Empty, ParameterDirection.Output, 100);

                string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "Fetch_LoginDtl");

                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    ds = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "Fetch_LoginDtl");
                }
                if (dbManager.Parameters[2] != null)
                {
                    sReturnMsg = dbManager.Parameters[2].Value.ToString();
                }
                return(ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
        internal void LogError(string errorNameSpace, string eventName, string errorStack, string errorByUser)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(4);
                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    dbManager.AddParameters(0, "@ErrorNameSpace", errorNameSpace, ParameterDirection.Input);
                    dbManager.AddParameters(1, "@ErrorEvent", eventName, ParameterDirection.Input);
                    dbManager.AddParameters(2, "@ErrorStack", errorStack, ParameterDirection.Input);
                    dbManager.AddParameters(3, "@ErrorByUser", errorByUser, ParameterDirection.Input);
                    dbManager.ExecuteNonQuery(CommandType.StoredProcedure, "SAVE_ERROR_LOG");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
        internal int Save_NewApps(int appid, string AppName, string AppURL, string Status, string mode)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();
            int        results   = 0;
            DataSet    ds        = new DataSet();

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(5);
                dbManager.AddParameters(0, "AppId", appid, ParameterDirection.Input);
                dbManager.AddParameters(1, "AppName", AppName, ParameterDirection.Input);
                dbManager.AddParameters(2, "AppURL", AppURL, ParameterDirection.Input);
                dbManager.AddParameters(3, "Status", Status, ParameterDirection.Input);
                dbManager.AddParameters(4, "mode", mode, ParameterDirection.Input);

                string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "Save_Apps");

                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    ds      = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "Save_Apps");
                    results = Convert.ToInt16(ds.Tables[0].Rows[0][0]);
                }

                return(results);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
        internal string Validate(string param, string Mode)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();
            string     results   = "";
            DataSet    ds        = new DataSet();

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(2);
                dbManager.AddParameters(0, "params", param, ParameterDirection.Input);
                dbManager.AddParameters(1, "MODE", Mode, ParameterDirection.Input);
                string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "Validations");

                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    ds      = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "Validations");
                    results = Convert.ToString(ds.Tables[0].Rows[0][0]);
                }

                return(results);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
        internal int Save_UserPassword(string UserEmail, string userCode, string UsrPwd, string strToken)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();
            int        results   = 0;
            DataSet    ds        = new DataSet();

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(4);
                dbManager.AddParameters(0, "UserEmail", UserEmail, ParameterDirection.Input);
                dbManager.AddParameters(1, "userCode", userCode, ParameterDirection.Input);
                dbManager.AddParameters(2, "UsrPwd", UsrPwd, ParameterDirection.Input);
                dbManager.AddParameters(3, "strToken", strToken, ParameterDirection.Input);

                string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "Save_userPassword");

                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    ds      = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "Save_userPassword");
                    results = Convert.ToInt16(ds.Tables[0].Rows[0][0]);
                }

                return(results);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
        internal int SendResetPswdlink(string UserCode, string UserEmail, string EmlTmpl, string token, DateTimeOffset tokenDt)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();
            int        MsgId     = 0;
            DataSet    ds        = new DataSet();

            try
            {
                const string dtFormat  = "yyyy-MM-dd HH:mm:ss.fffffff zzz";
                string       dtString2 = tokenDt.ToString(dtFormat, CultureInfo.InvariantCulture);
                dbManager.Open();
                dbManager.CreateParameters(5);
                dbManager.AddParameters(0, "UserCode", UserCode, ParameterDirection.Input);
                dbManager.AddParameters(1, "UserEmail", UserEmail, ParameterDirection.Input);
                dbManager.AddParameters(2, "EmlTmpl", EmlTmpl, ParameterDirection.Input);
                dbManager.AddParameters(3, "token", token, ParameterDirection.Input);
                dbManager.AddParameters(4, "tokenDt", dtString2, ParameterDirection.Input);

                string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "SendResetPswdlink");
                ds    = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "SendResetPswdlink");
                MsgId = Convert.ToInt16(ds.Tables[0].Rows[0][0]);
                return(MsgId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
        internal DataSet Fetch_UserInfo(string Mode, string usercode)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();
            DataSet    ds        = new DataSet();

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(2);
                dbManager.AddParameters(0, "Mode", Mode, ParameterDirection.Input);
                dbManager.AddParameters(1, "UserCode", usercode, ParameterDirection.Input);

                string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "Fetch_Users");

                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    ds = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "Fetch_Users");
                }

                return(ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
        internal DataSet Open_LoginInfo(string UserCode, string Password, string param)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();
            DataSet    ds        = new DataSet();

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(3);
                dbManager.AddParameters(0, "LoginUserCode", UserCode, ParameterDirection.Input);
                dbManager.AddParameters(1, "UserPassword", Password, ParameterDirection.Input);
                dbManager.AddParameters(2, "Param", param, ParameterDirection.Input);

                string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "Fetch_LoginInfo");

                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    ds = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "Fetch_LoginInfo");
                }

                return(ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
Esempio n. 10
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;
            }
        }
        internal string Save_DocUpload(string sDocType, byte[] DocImgThumb, string Param1, string Param2,
                                       string Param3, string Param4, string Param5, string sUserCode, string sFileName)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();

            try
            {
                string  sReqNo = string.Empty;
                DataSet ds     = new DataSet();
                dbManager.Open();
                dbManager.CreateParameters(10);
                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    dbManager.AddParameters(0, "@DocType", sDocType, ParameterDirection.Input);
                    if (DocImgThumb != null)
                    {
                        dbManager.AddParameters(1, "@DocImg", DocImgThumb, ParameterDirection.Input);
                    }

                    else
                    {
                        dbManager.AddParameters(1, "@DocImg", DBNull.Value, ParameterDirection.Input);
                    }
                    dbManager.AddParameters(2, "@UserCode", sUserCode, ParameterDirection.Input);
                    dbManager.AddParameters(3, "@FileName", sFileName, ParameterDirection.Input);
                    dbManager.AddParameters(4, "@Param1", Param1, ParameterDirection.Input);
                    dbManager.AddParameters(5, "@Param2", Param2, ParameterDirection.Input);
                    dbManager.AddParameters(6, "@Param3", Param3, ParameterDirection.Input);
                    dbManager.AddParameters(7, "@Param4", Param4, ParameterDirection.Input);
                    dbManager.AddParameters(8, "@Param5", Param5, ParameterDirection.Input);
                    dbManager.AddParameters(9, "@ReqNo", string.Empty, ParameterDirection.Output, 50);
                    string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "DataImport.GTK_Upld");
                    ds = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "DataImport.GTK_Upld");
                }
                else
                {
                }
                sReqNo = dbManager.Parameters[9].Value.ToString();
                return(sReqNo);
            }
            catch (Exception ex)
            {
                throw ex;
                //return null;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
        internal DataSet GetFilterConditions()
        {
            IDBManager dbManager = CommonConnection.Connectionstring();

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(2);
                DataSet dsFilterCond = new DataSet();
                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    if (SessionObjects.obj.GlobalPropertiesObject.FteCode != null && SessionObjects.obj.GlobalPropertiesObject.FteCode != "")
                    {
                        dbManager.AddParameters(0, "@FTECODE", SessionObjects.obj.GlobalPropertiesObject.FteCode, ParameterDirection.Input, 10);
                    }

                    else
                    {
                        dbManager.AddParameters(0, "@FTECODE", DBNull.Value, ParameterDirection.Input, 10);
                    }

                    if (SessionObjects.obj.GlobalPropertiesObject.UserCode != null && SessionObjects.obj.GlobalPropertiesObject.UserCode != "")
                    {
                        dbManager.AddParameters(1, "@UserCode", SessionObjects.obj.GlobalPropertiesObject.UserCode, ParameterDirection.Input, 100);
                    }
                    else
                    {
                        dbManager.AddParameters(1, "@UserCode", DBNull.Value, ParameterDirection.Input, 100);
                    }
                    dsFilterCond = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "GetFilterConditions");
                }

                return(dsFilterCond);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
Esempio n. 13
0
        //This method will return the converted value by comparing the UOMs from DB.
        public static double UomCnvVal(string FrUOM, string ToUOM, double FrQty, double ValFct, double WT, string WTUOM)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();

            try
            {
                double sRetVal = default(double);
                dbManager.Open();
                dbManager.CreateParameters(7);
                DataSet dsVal = new DataSet();

                //Asign values to properties
                UomConversions cls = new UomConversions(FrUOM, ToUOM, FrQty, ValFct, WT, WTUOM);

                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    dbManager.AddParameters(0, "@FrUOM", UomConversions.FrUOM, ParameterDirection.Input);
                    dbManager.AddParameters(1, "@ToUOM", UomConversions.ToUOM, ParameterDirection.Input);
                    dbManager.AddParameters(2, "@FrQty", UomConversions.FrQty, ParameterDirection.Input);
                    dbManager.AddParameters(3, "@ValFct", UomConversions.ValFct, ParameterDirection.Input);
                    dbManager.AddParameters(4, "@WT", UomConversions.WT, ParameterDirection.Input);
                    dbManager.AddParameters(5, "@WTUOM", UomConversions.WTUOM, ParameterDirection.Input);
                    dbManager.AddParameters(6, "@CnvQty", 0, ParameterDirection.Output);

                    string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "ObjUom_Convert");
                    dsVal = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "ObjUom_Convert");
                }
                if (dbManager.Parameters[6].Value.ToString() != "")
                {
                    sRetVal = double.Parse(dbManager.Parameters[6].Value.ToString());
                }
                return(sRetVal);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
Esempio n. 14
0
        internal int Save_UserInfo(UserList user)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();
            int        results   = 0;
            DataSet    ds        = new DataSet();

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(8);
                dbManager.AddParameters(0, "UserFirstName", user.UserFirstName, ParameterDirection.Input);
                dbManager.AddParameters(1, "UserMidName", user.UserMidName, ParameterDirection.Input);
                dbManager.AddParameters(2, "UserLastName", user.UserLastName, ParameterDirection.Input);
                dbManager.AddParameters(3, "Email", user.UserEmail, ParameterDirection.Input);
                dbManager.AddParameters(4, "UserApps", user.UserApps, ParameterDirection.Input);
                dbManager.AddParameters(5, "Mode", user.Mode, ParameterDirection.Input);
                dbManager.AddParameters(6, "userCode", user.userCode, ParameterDirection.Input);
                dbManager.AddParameters(7, "eParam", user.EParm, ParameterDirection.Input);

                string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "Save_Users");

                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    ds      = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "Save_Users");
                    results = Convert.ToInt16(ds.Tables[0].Rows[0][0]);
                }

                return(results);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
Esempio n. 15
0
        internal int Save_NewAppsx(string xml, string Mode)
        {
            IDBManager dbManager = CommonConnection.Connectionstring();
            int        results   = 0;
            DataSet    ds        = new DataSet();

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(2);
                dbManager.AddParameters(0, "xml", xml, ParameterDirection.Input);
                dbManager.AddParameters(1, "Mode", Mode, ParameterDirection.Input);
                string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "Save_AppsX");
                if (ConfigurationSettings.AppSettings["DataB"] == "SQL")
                {
                    ds      = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "Save_AppsX");
                    results = Convert.ToInt16(ds.Tables[0].Rows[0][0]);
                }
            }
            catch (Exception ex)
            {
            }
            return(results);
        }
Esempio n. 16
0
        private void UpdateVFDR(object obj, IDBManager dbmgr)
        {
            FAVFDR item = (FAVFDR)obj;

            try
            {
                dbmgr.Open();
                dbmgr.CreateParameters(6);
                dbmgr.AddParameters(0, "@fa_id", item.fa_id);
                dbmgr.AddParameters(1, "@vfdr_id", item.vfdr_id);
                dbmgr.AddParameters(2, "@vfdr", item.vfdr);
                dbmgr.AddParameters(3, "@vfdr_disp", item.vfdr_disp);
                dbmgr.AddParameters(4, "@status", item.status);
                dbmgr.AddParameters(5, "@fre_ref", item.fre_ref);
                dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FAVFDR_u");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
Esempio n. 17
0
        private void UpdatePG(object obj, IDBManager dbmgr)
        {
            FAPG item = (FAPG)obj;

            try
            {
                dbmgr.Open();
                dbmgr.CreateParameters(4);
                dbmgr.AddParameters(0, "@fa_id", item.fa_id);
                dbmgr.AddParameters(1, "@pg", item.pg);
                dbmgr.AddParameters(2, "@method", item.method);
                dbmgr.AddParameters(3, "@comment", item.comment);
                dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FAPG_u");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
Esempio n. 18
0
        private void UpdateDocument(object obj, IDBManager dbmgr)
        {
            FADoc item = (FADoc)obj;

            try
            {
                dbmgr.Open();
                dbmgr.CreateParameters(3);
                dbmgr.AddParameters(0, "@fa_id", item.fa_id);
                dbmgr.AddParameters(1, "@doc_id", item.doc_id);
                dbmgr.AddParameters(2, "@comment", item.comment);
                dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FADOC_u");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
Esempio n. 19
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. 20
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;
        }
Esempio n. 21
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. 22
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. 23
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. 24
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. 25
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. 26
0
 private void UpdateBDEndpoint(object obj, IDBManager dbmgr)
 {
     RouteBDEndpoint item = (RouteBDEndpoint)obj;							        // cast object to proper item type
     try
     {
         dbmgr.Open();															    // open database
         dbmgr.CreateParameters(2);												    // create required paramaters
         dbmgr.AddParameters(0, "@endpt", item.endpt);
         dbmgr.AddParameters(1, "@bdendpt", item.bd_endpt);
         dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.BDENDPOINTS_u");    // execute stored procedure
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dbmgr.Dispose();
     }
 }
Esempio n. 27
0
        private void UpdateDrawing(object obj, IDBManager dbmgr)
        {
            RoutelocaDwg item = (RoutelocaDwg)obj;							                // cast object to proper item type

            try
            {
                dbmgr.Open();															    // open database
                dbmgr.CreateParameters(5);												    // create required paramaters
                dbmgr.AddParameters(0, "@nodeloca_id", item.nodeloca_id);
                dbmgr.AddParameters(1, "@dwg_id", item.dwg_id);
                dbmgr.AddParameters(2, "@dwg_rev", item.dwg_rev);
                dbmgr.AddParameters(3, "@dwgtype_id", 4);                                   // "Other" drawing type
                dbmgr.AddParameters(4, "@col_ref", item.col_ref);
                dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.ROUTELOCADWGS_u");  // execute stored procedure
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
Esempio n. 28
0
        private void UpdateRouteloca(object obj, IDBManager dbmgr)
        {
            Routeloca item = (Routeloca)obj;							                        // cast object to proper item type
            try
            {
                dbmgr.Open();															        // open database
                dbmgr.CreateParameters(3);												        // create required paramaters
                dbmgr.AddParameters(0, "@node_id", item.node_id);

                switch (_user.locaType)
                {
                    case Constant.type_FR:
                        dbmgr.AddParameters(1, "@loca_id", item.rm_id);
                        break;
                    default:
                        dbmgr.AddParameters(1, "@loca_id", item.fz_id);
                        break;
                }

                dbmgr.AddParameters(2, "@locatype_id", _user.locaType);
                dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.ROUTELOCA_u");          // execute stored procedure
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
Esempio n. 29
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. 30
0
 private void DeleteVFDR(object obj, IDBManager dbmgr)
 {
     FAVFDR item = (FAVFDR)obj;
     try
     {
         dbmgr.Open();
         dbmgr.CreateParameters(2);
         dbmgr.AddParameters(0, "@fa_id", item.fa_id);
         dbmgr.AddParameters(1, "@vfdr_id", item.vfdr_id);
         dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FAVFDR_d");
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dbmgr.Dispose();
     }
 }
Esempio n. 31
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. 32
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. 33
0
 private void DeleteRoute(object obj, IDBManager dbmgr)
 {
     Route item = (Route)obj;
     try
     {
         dbmgr.Open();															    // open database
         dbmgr.CreateParameters(2);												    // create required paramaters
         dbmgr.AddParameters(0, "@node_id", item.node_id);
         dbmgr.AddParameters(1, "@error_num", 0, true);
         dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.ROUTELIST_d");	    // execute stored procedure
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dbmgr.Dispose();
     }
 }
Esempio n. 34
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. 35
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. 36
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. 37
0
        // updates recovery action
        private void UpdateRA(object obj, IDBManager dbmgr)
        {
            CompRA item = (CompRA)obj;

            try
            {
                dbmgr.Open();															    // open database
                dbmgr.CreateParameters(6);												    // create required paramaters
                dbmgr.BeginTransaction();
                dbmgr.AddParameters(0, "@comp_id", item.comp_id);
                dbmgr.AddParameters(1, "@fa_id", item.fa_id);
                dbmgr.AddParameters(2, "@ra_disp", item.ra_disp);
                dbmgr.AddParameters(3, "@bin", item.bin);
                dbmgr.AddParameters(4, "@ra_type", item.ra_type);
                dbmgr.AddParameters(5, "@ra_feasible", item.ra_feasible);
                dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FACOMPRA_u");	    // execute stored procedure
                dbmgr.CommitTransaction();
            }
            catch (Exception ex)
            {
                // if there is problem with transaction roll back to original
                dbmgr.RollbackTransaction();
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
Esempio n. 38
0
        private void UpdateCompDisp(object obj, IDBManager dbmgr)
        {
            FACompDisp item = (FACompDisp)obj;										        // cast object to proper item type

            try
            {
                dbmgr.Open();
                dbmgr.CreateParameters(5);												    // create required paramaters
                dbmgr.AddParameters(0, "@fa_id", item.fa_id);
                dbmgr.AddParameters(1, "@comp_id", item.comp_id);
                dbmgr.AddParameters(2, "@old_disp_id", item.old_disp_id);
                dbmgr.AddParameters(3, "@disp_id", item.disp_id);
                dbmgr.AddParameters(4, "@status", item.status);
                dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FACOMPDISP_u");	    // execute stored procedure
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
Esempio n. 39
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. 40
0
        private void UpdateFireArea(object obj, IDBManager dbmgr)
        {
            FireArea item = (FireArea)obj;
            System.Data.Common.DbParameter param;
            try
            {
                dbmgr.Open();
                dbmgr.BeginTransaction();

                // check to see if new object
                if (item.fa_id == 0)
                {
                    dbmgr.CreateParameters(3);
                    dbmgr.AddParameters(0, "@id", 0, true);
                    dbmgr.AddParameters(1, "@fa", item.fa);
                    dbmgr.AddParameters(2, "@fa_desc", item.fa_desc);
                    dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FALIST_i");

                    // get item id
                    param = (System.Data.Common.DbParameter)dbmgr.Parameters.GetValue(0);
                    item.fa_id = (int)param.Value;
                }
                // otherwise update existing object
                else
                {
                    dbmgr.CreateParameters(14);
                    dbmgr.AddParameters(0, "@fa_id", item.fa_id);
                    dbmgr.AddParameters(1, "@fa", item.fa);
                    dbmgr.AddParameters(2, "@fa_desc", item.fa_desc);
                    dbmgr.AddParameters(3, "@bldg", item.bldg);
                    dbmgr.AddParameters(4, "@elev", item.elev);
                    dbmgr.AddParameters(5, "@ssd_path", item.ssd_path);
                    dbmgr.AddParameters(6, "@req", item.req);
                    dbmgr.AddParameters(7, "@supp", item.supp);
                    dbmgr.AddParameters(8, "@det", item.det);
                    dbmgr.AddParameters(9, "@comment", item.comment);
                    dbmgr.AddParameters(10, "@dwg_id", item.dwg_id);
                    dbmgr.AddParameters(11, "@dwg_rev", item.dwg_rev);
                    dbmgr.AddParameters(12, "@risk_summary", item.risk_summary);
                    dbmgr.AddParameters(13, "@reg_basis", item.reg_basis);
                    dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FALIST_u");	        // execute the stored procedure

                    //update status
                    UpdateStatus(dbmgr, item, 1, item.prep_by, item.prep_date);
                    UpdateStatus(dbmgr, item, 5, item.chkd_by, item.chkd_date);
                }

                dbmgr.CommitTransaction();
            }
            catch (Exception ex)
            {
                dbmgr.RollbackTransaction();
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
Esempio n. 41
0
 private void DeleteCabDisp(object obj, IDBManager dbmgr)
 {
     FACabDisp item = (FACabDisp)obj;									            // cast object to proper item type
     try
     {
         dbmgr.Open();															    // open database
         dbmgr.CreateParameters(4);												    // create required paramaters
         dbmgr.AddParameters(0, "@fa_id", item.fa_id);
         dbmgr.AddParameters(1, "@comp_id", item.comp_id);
         dbmgr.AddParameters(2, "@cable_id", item.cable_id);
         dbmgr.AddParameters(3, "@disp_id", item.disp_id);
         dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FACABDISP_d");	    // execute stored procedure
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dbmgr.Dispose();
     }
 }
Esempio n. 42
0
 private void UpdateStatus(IDBManager dbmgr, FireArea item, int statustype_id, string user_id, DateTime status_date)
 {
     if ((user_id == "N/A") || (user_id == ""))
     {
         // delete status
         dbmgr.CreateParameters(2);
         dbmgr.AddParameters(0, "@fa_id", item.fa_id);
         dbmgr.AddParameters(1, "@statustype_id", statustype_id);
         dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FASTATUS_d");
     }
     else
     {
         // update status
         dbmgr.CreateParameters(4);
         dbmgr.AddParameters(0, "@fa_id", item.fa_id);
         dbmgr.AddParameters(1, "@statustype_id", statustype_id);
         dbmgr.AddParameters(2, "@user_id", user_id);
         if (status_date == Convert.ToDateTime(null))
             // set date to null
             dbmgr.AddParameters(3, "@status_date", null);
         else
             // update date
             dbmgr.AddParameters(3, "@status_date", status_date);
         dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FASTATUS_u");
     }
 }
Esempio n. 43
0
 private void DeleteFireArea(object obj, IDBManager dbmgr)
 {
     FireArea item = (FireArea)obj;											        //cast object to proper item type
     try
     {
         dbmgr.Open();															    //open database
         dbmgr.CreateParameters(1);												    //create required paramaters
         dbmgr.AddParameters(0, "@fa_id", item.fa_id);
         dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FALIST_d");	    //execute stored procedure
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dbmgr.Dispose();
     }
 }
Esempio n. 44
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. 45
0
        private void UpdateRoute(object obj, IDBManager dbmgr)
        {
            Route item = (Route)obj;
            System.Data.Common.DbParameter param;

            try
            {
                dbmgr.Open();
                dbmgr.BeginTransaction();

                // check to see if new object
                if (item.node_id == 0)
                {
                    // if id is null then new object
                    dbmgr.CreateParameters(2);
                    dbmgr.AddParameters(0, "@id", 0, true);
                    dbmgr.AddParameters(1, "@node", item.node);
                    dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.ROUTELIST_i");

                    // get item id
                    param = (System.Data.Common.DbParameter)dbmgr.Parameters.GetValue(0);
                    item.node_id = Convert.ToInt32(param.Value);
                }

                // otherwise update existing object
                else
                {
                    // update ROUTELIST table
                    dbmgr.CreateParameters(2);
                    dbmgr.AddParameters(0, "@node_id", item.node_id);
                    dbmgr.AddParameters(1, "@node", item.node);
                    dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.ROUTELIST_u");
                }

                dbmgr.CommitTransaction();
            }
            catch (Exception ex)
            {
                // if there is problem with transaction roll back to original
                dbmgr.RollbackTransaction();
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }