示例#1
0
        public Result UpdatePassword(UserViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[2];
                aParams[0]       = new NpgsqlParameter("Password", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[0].Value = model.newpassword;
                aParams[1]       = new NpgsqlParameter("UserID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[1].Value = model.UserID;

                int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdatePassword, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#2
0
        public Result AddMainMenu(MainMenuViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[2];
                aParams[0]       = new NpgsqlParameter("Name", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[0].Value = model.Name;
                aParams[1]       = new NpgsqlParameter("CreatedBy", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[1].Value = model.CreatedBy;


                int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.AddMainMenu, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                    result.Values = res.ToString();
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#3
0
        public Result UpdateFloor(FloorViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[12];
                aParams[0]       = new NpgsqlParameter("Name", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[0].Value = model.FloorName;
                aParams[1]       = new NpgsqlParameter("Description", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[1].Value = model.Description;
                aParams[2]       = new NpgsqlParameter("FloorPlanSHPPath", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[2].Value = model.FloorPlanSHPPath;
                aParams[3]       = new NpgsqlParameter("BuildingID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[3].Value = model.BuildingID;
                aParams[4]       = new NpgsqlParameter("FloorNo", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[4].Value = model.FloorNo;
                aParams[5]       = new NpgsqlParameter("FloorPlanOrginalFileName", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[5].Value = model.FloorPlanOrginalFileName;
                aParams[6]       = new NpgsqlParameter("FloorID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[6].Value = model.FloorID;
                aParams[7]       = new NpgsqlParameter("Lat", NpgsqlTypes.NpgsqlDbType.Double);
                aParams[7].Value = model.Latitude;

                aParams[8]       = new NpgsqlParameter("Long", NpgsqlTypes.NpgsqlDbType.Double);
                aParams[8].Value = model.Longitude;

                aParams[9]        = new NpgsqlParameter(AppConstants.LastModifiedOn, NpgsqlTypes.NpgsqlDbType.Timestamp);
                aParams[9].Value  = DateTime.Now;
                aParams[10]       = new NpgsqlParameter(AppConstants.LastModifiedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[10].Value = 0;

                aParams[11]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[11].Value = true;

                int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdateFloor, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#4
0
        public Result AddFloor(FloorViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[9];
                aParams[0]       = new NpgsqlParameter("Name", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[0].Value = model.FloorName;
                aParams[1]       = new NpgsqlParameter("Description", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[1].Value = model.Description;
                aParams[2]       = new NpgsqlParameter("FloorPlanSHPPath", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[2].Value = model.FloorPlanSHPPath;
                aParams[3]       = new NpgsqlParameter("BuildingID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[3].Value = model.BuildingID;
                aParams[4]       = new NpgsqlParameter("FloorNo", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[4].Value = model.FloorNo;
                aParams[5]       = new NpgsqlParameter("FloorPlanOrginalFileName", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[5].Value = model.FloorPlanOrginalFileName;
                aParams[6]       = new NpgsqlParameter("Lat", NpgsqlTypes.NpgsqlDbType.Double);
                aParams[6].Value = model.Latitude;

                aParams[7]       = new NpgsqlParameter("Long", NpgsqlTypes.NpgsqlDbType.Double);
                aParams[7].Value = model.Longitude;
                aParams[8]       = new NpgsqlParameter(AppConstants.CreatedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[8].Value = 0;


                int res = (int)dbOps.ExecuteScalar(AppConstants.QueryConstants.AddFloor, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                    result.Values = res.ToString();
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
        public Result UpdateOptionalParameters(OptionalParametersViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[9];
                aParams[0]       = new NpgsqlParameter("CallSignID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[0].Value = model.CallSignID;
                aParams[1]       = new NpgsqlParameter("CbsdInfoID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[1].Value = model.CbsdInfoID;
                aParams[2]       = new NpgsqlParameter("GroupingParamID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[2].Value = model.GroupingParamID;
                aParams[3]       = new NpgsqlParameter("IsSubmitted", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[3].Value = model.IsSubmitted;
                aParams[4]       = new NpgsqlParameter("OptionalParameterID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[4].Value = model.OptionalParameterID;
                aParams[5]       = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[5].Value = model.APID;
                aParams[6]       = new NpgsqlParameter(AppConstants.LastModifiedOn, NpgsqlTypes.NpgsqlDbType.Timestamp);
                aParams[6].Value = DateTime.Now;
                aParams[7]       = new NpgsqlParameter(AppConstants.LastModifiedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[7].Value = 0;
                aParams[8]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[8].Value = true;



                int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdateOptionalParameters, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#6
0
        public Result UpdateCBSD(CBSDViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[10];
                aParams[0]       = new NpgsqlParameter("CBSDVendorModelID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[0].Value = model.CBSDVendorModelID;
                aParams[1]       = new NpgsqlParameter("SoftwareVersion", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[1].Value = model.SoftwareVersion;
                aParams[2]       = new NpgsqlParameter("HardwareVersion", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[2].Value = model.HardwareVersion;
                aParams[3]       = new NpgsqlParameter("FirmwareVersion", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[3].Value = model.FirmwareVersion;
                aParams[4]       = new NpgsqlParameter("IsSubmitted", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[4].Value = model.IsSubmitted;
                aParams[5]       = new NpgsqlParameter("CBSDID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[5].Value = model.CBSDID;
                aParams[6]       = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[6].Value = model.APID;
                aParams[7]       = new NpgsqlParameter(AppConstants.LastModifiedOn, NpgsqlTypes.NpgsqlDbType.Timestamp);
                aParams[7].Value = DateTime.Now;
                aParams[8]       = new NpgsqlParameter(AppConstants.LastModifiedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[8].Value = 0;
                aParams[9]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[9].Value = true;

                int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdateCBSD, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#7
0
        public Result AddCBSD(CBSDViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[7];
                aParams[0]       = new NpgsqlParameter("CBSDVendorModelID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[0].Value = model.CBSDVendorModelID;

                aParams[1]       = new NpgsqlParameter("SoftwareVersion", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[1].Value = model.SoftwareVersion;
                aParams[2]       = new NpgsqlParameter("HardwareVersion", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[2].Value = model.HardwareVersion;
                aParams[3]       = new NpgsqlParameter("FirmwareVersion", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[3].Value = model.FirmwareVersion;
                aParams[4]       = new NpgsqlParameter("IsSubmitted", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[4].Value = model.IsSubmitted;
                aParams[5]       = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[5].Value = model.APID;
                aParams[6]       = new NpgsqlParameter(AppConstants.CreatedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[6].Value = 0;

                int res = (int)dbOps.ExecuteScalar(AppConstants.QueryConstants.AddCBSD, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                    result.Values = res.ToString();
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#8
0
        public UserViewModel GetValidUserByEmail(UserViewModel model)
        {
            UserViewModel result = new UserViewModel();
            DBOperations  dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[1];



                aParams[0]       = new NpgsqlParameter("_emailaddress", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[0].Value = model.EmailAddress;



                dbOps.ExecuteReader(AppConstants.USP_GETVALIDUSERBYEMAIL, aParams);

                if (!(dbOps.DataReader == null))
                {
                    using (dbOps.DataReader)
                    {
                        while (dbOps.DataReader.Read())
                        {
                            result = new UserViewModel
                            {
                                UserID       = Helper.HandleDBNull <int>(dbOps.DataReader[0]),
                                RoleID       = Helper.HandleDBNull <int>(dbOps.DataReader[1]),
                                EmailAddress = Helper.HandleDBNull <string>(dbOps.DataReader[2]),
                                password     = Helper.HandleDBNull <string>(dbOps.DataReader[3])
                            };
                        }
                    }
                }
                //Query to get User record and store it in result
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
            }
            return(result);
        }
        //public Result AddOptionalParameters(OptionalParametersViewModel model)
        //{
        //    Result result = new Result();
        //    DBOperations dbOps = new DBOperations();
        //    try
        //    {
        //        NpgsqlParameter[] aParams = new NpgsqlParameter[3];
        //        aParams[0] = new NpgsqlParameter("_callinfo", NpgsqlTypes.NpgsqlDbType.Integer);
        //        aParams[0].Value = model.CallInfo;
        //        aParams[1] = new NpgsqlParameter("_cbsdinfo", NpgsqlTypes.NpgsqlDbType.Integer);
        //        aParams[1].Value = model.CbsdInfo;
        //        aParams[2] = new NpgsqlParameter("_groupingParam", NpgsqlTypes.NpgsqlDbType.Integer);
        //        aParams[2].Value = model.GroupingParam;

        //        dbOps.ExecuteScalar(AppConstants.USP_ADD_OPTIONALPARAMETERS, aParams);

        //        result.Message = dbOps.ReturnObject.ToString();
        //        result.Status = (dbOps.ReturnObject.ToString().ToLower().Contains("error")) ? Status.Failure : Status.Success;
        //        return result;
        //    }
        //    catch (Exception Ex)
        //    {
        //        dbOps.Abort();
        //        result.Status = Status.Failure;
        //    }
        //    return result;
        //}

        public Result AddOptionalParameters(OptionalParametersViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[6];
                aParams[0]       = new NpgsqlParameter("CallSignID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[0].Value = model.CallSignID;
                aParams[1]       = new NpgsqlParameter("CbsdInfoID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[1].Value = model.CbsdInfoID;
                aParams[2]       = new NpgsqlParameter("GroupingParamID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[2].Value = model.GroupingParamID;
                aParams[3]       = new NpgsqlParameter("IsSubmitted", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[3].Value = model.IsSubmitted;
                aParams[4]       = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[4].Value = model.APID;
                aParams[5]       = new NpgsqlParameter(AppConstants.CreatedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[5].Value = 0;

                int res = (int)dbOps.ExecuteScalar(AppConstants.QueryConstants.AddOptionalParameters, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                    result.Values = res.ToString();
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#10
0
        //public Result DeleteAPSector(int apID)
        //{
        //    Result result = new Result();
        //    DBOperations dbOps = new DBOperations();
        //    try
        //    {
        //        NpgsqlParameter[] aParams = new NpgsqlParameter[5];
        //        aParams[0] = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
        //        aParams[0].Value = false;
        //        aParams[1] = new NpgsqlParameter("IsDeleted", NpgsqlTypes.NpgsqlDbType.Boolean);
        //        aParams[1].Value = true;
        //        aParams[2] = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
        //        aParams[2].Value = apID;
        //        aParams[3] = new NpgsqlParameter(AppConstants.LastModifiedOn, NpgsqlTypes.NpgsqlDbType.Timestamp);
        //        aParams[3].Value = DateTime.Now;
        //        aParams[4] = new NpgsqlParameter(AppConstants.LastModifiedBy, NpgsqlTypes.NpgsqlDbType.Integer);
        //        aParams[4].Value = 0;


        //        int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.DeleteAPSector, aParams);


        //        if (res > 0)
        //        {
        //            result.Status = Status.Success;
        //        }
        //        else
        //        {
        //            result.Status = Status.Failure;
        //        }
        //    }
        //    catch (Exception Ex)
        //    {
        //        dbOps.Abort();
        //        result.Status = Status.Failure;
        //    }
        //    return result;
        //}


        public Result ReduceAPSector(int apID, string apSectorID)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[6];
                aParams[0]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[0].Value = false;
                aParams[1]       = new NpgsqlParameter("IsDeleted", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[1].Value = true;
                aParams[2]       = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[2].Value = apID;
                aParams[3]       = new NpgsqlParameter("APSectorID", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[3].Value = apSectorID;
                aParams[4]       = new NpgsqlParameter(AppConstants.LastModifiedOn, NpgsqlTypes.NpgsqlDbType.Timestamp);
                aParams[4].Value = DateTime.Now;
                aParams[5]       = new NpgsqlParameter(AppConstants.LastModifiedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[5].Value = 0;

                int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.ReduceAPSector, aParams);


                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#11
0
        public Result UpdateBuilding(BuildingViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[6];
                aParams[0]       = new NpgsqlParameter("Name", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[0].Value = model.Name;
                aParams[1]       = new NpgsqlParameter("Description", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[1].Value = model.Description;
                aParams[2]       = new NpgsqlParameter("BuildingID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[2].Value = model.BuildingId;
                aParams[3]       = new NpgsqlParameter(AppConstants.LastModifiedOn, NpgsqlTypes.NpgsqlDbType.Timestamp);
                aParams[3].Value = DateTime.Now;
                aParams[4]       = new NpgsqlParameter(AppConstants.LastModifiedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[4].Value = 0;
                aParams[5]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[5].Value = true;

                int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdateBuilding, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#12
0
        public Result DeleteMainMenu(int mainmenuID)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[5];
                aParams[0]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[0].Value = false;
                aParams[1]       = new NpgsqlParameter("IsDeleted", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[1].Value = true;
                aParams[2]       = new NpgsqlParameter("MainMenuId", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[2].Value = mainmenuID;
                aParams[3]       = new NpgsqlParameter(AppConstants.LastModifiedOn, NpgsqlTypes.NpgsqlDbType.Timestamp);
                aParams[3].Value = DateTime.Now;
                aParams[4]       = new NpgsqlParameter(AppConstants.LastModifiedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[4].Value = 0;

                int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.DeleteMainMenu, aParams);


                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#13
0
        public Result AddBuilding(BuildingViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[4];
                aParams[0]       = new NpgsqlParameter("Name", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[0].Value = model.Name;
                aParams[1]       = new NpgsqlParameter("Description", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[1].Value = model.Description;
                aParams[2]       = new NpgsqlParameter("BuildingID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[2].Value = model.BuildingId;
                aParams[3]       = new NpgsqlParameter(AppConstants.CreatedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[3].Value = 0;


                int res = (int)dbOps.ExecuteScalar(AppConstants.QueryConstants.AddBuilding, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                    result.Values = res.ToString();
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
        public Result UpdateInstallationParameters(InstallationParametersViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams = new NpgsqlParameter[19];



                //aParams[0] = new NpgsqlParameter("LatLong", NpgsqlTypes.NpgsqlDbType.Geometry);
                //aParams[0].Value =  "ST_GeomFromText('POINT(" + model.Latitude + " " + model.Longitude + ")', 4326)";

                aParams[0]       = new NpgsqlParameter("Lat", NpgsqlTypes.NpgsqlDbType.Double);
                aParams[0].Value = model.Latitude;

                aParams[1]       = new NpgsqlParameter("Long", NpgsqlTypes.NpgsqlDbType.Double);
                aParams[1].Value = model.Longitude;

                aParams[2]        = new NpgsqlParameter("Height", NpgsqlTypes.NpgsqlDbType.Numeric);
                aParams[2].Value  = model.Height;
                aParams[3]        = new NpgsqlParameter("HeightTypeID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[3].Value  = model.HeightTypeID;
                aParams[4]        = new NpgsqlParameter("HorizontalAccuracy", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[4].Value  = model.HorizontalAccuracy;
                aParams[5]        = new NpgsqlParameter("VerticalAccuracy", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[5].Value  = model.VerticalAccuracy;
                aParams[6]        = new NpgsqlParameter("IndoorDeployment", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[6].Value  = model.IndoorDeployment;
                aParams[7]        = new NpgsqlParameter("AntennaAzimuth", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[7].Value  = model.AntennaAzimuth;
                aParams[8]        = new NpgsqlParameter("AntennaDowntilt", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[8].Value  = model.AntennaDowntilt;
                aParams[9]        = new NpgsqlParameter("AntennaGain", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[9].Value  = model.AntennaGain;
                aParams[10]       = new NpgsqlParameter("EirpCapability", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[10].Value = model.EripCapability;
                aParams[11]       = new NpgsqlParameter("AntennaBeamwidth", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[11].Value = model.AntennaBeamwidth;
                aParams[12]       = new NpgsqlParameter("AntennaModelID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[12].Value = model.AntennaModelID;
                aParams[13]       = new NpgsqlParameter("IsSubmitted", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[13].Value = model.IsSubmitted;
                aParams[14]       = new NpgsqlParameter("InstallationParameterID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[14].Value = model.InstallationParamterID;
                aParams[15]       = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[15].Value = model.APID;
                aParams[16]       = new NpgsqlParameter(AppConstants.LastModifiedOn, NpgsqlTypes.NpgsqlDbType.Timestamp);
                aParams[16].Value = DateTime.Now;
                aParams[17]       = new NpgsqlParameter(AppConstants.LastModifiedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[17].Value = 0;
                aParams[18]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[18].Value = true;

                int res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdateInstallationParameters, aParams);

                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#15
0
        public Result SaveRoleNRights(ManageRoleNRightsViewModel manageRoleNRightsViewModel)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                foreach (var item in manageRoleNRightsViewModel.RolesNRightsViewMdoels)
                {
                    int res;
                    NpgsqlParameter[] aParams1 = new NpgsqlParameter[1];
                    aParams1[0]       = new NpgsqlParameter("RNRID", NpgsqlTypes.NpgsqlDbType.Integer);
                    aParams1[0].Value = item.RNRID;

                    long count = (long)dbOps.ExecuteScalar(AppConstants.QueryConstants.CheckRolesNRights, aParams1);
                    if (count > 0)
                    {
                        NpgsqlParameter[] aParams = new NpgsqlParameter[6];
                        aParams[0]       = new NpgsqlParameter("RoleID", NpgsqlTypes.NpgsqlDbType.Integer);
                        aParams[0].Value = manageRoleNRightsViewModel.RoleID;
                        aParams[1]       = new NpgsqlParameter("ActionID", NpgsqlTypes.NpgsqlDbType.Integer);
                        aParams[1].Value = item.ActionID;
                        aParams[2]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                        aParams[2].Value = item.IsActive;
                        aParams[3]       = new NpgsqlParameter("LastModifiedBy", NpgsqlTypes.NpgsqlDbType.Integer);
                        aParams[3].Value = 0;
                        aParams[4]       = new NpgsqlParameter("LastModifiedOn", NpgsqlTypes.NpgsqlDbType.Date);
                        aParams[4].Value = DateTime.Now;
                        aParams[5]       = new NpgsqlParameter("RNRID", NpgsqlTypes.NpgsqlDbType.Integer);
                        aParams[5].Value = item.RNRID;
                        res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdateRolesNRights, aParams);
                    }
                    else
                    {
                        NpgsqlParameter[] aParams = new NpgsqlParameter[5];
                        aParams[0]       = new NpgsqlParameter("RoleID", NpgsqlTypes.NpgsqlDbType.Integer);
                        aParams[0].Value = manageRoleNRightsViewModel.RoleID;
                        aParams[1]       = new NpgsqlParameter("ActionID", NpgsqlTypes.NpgsqlDbType.Integer);
                        aParams[1].Value = item.ActionID;
                        aParams[2]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                        aParams[2].Value = item.IsActive;
                        aParams[3]       = new NpgsqlParameter("CreatedBy", NpgsqlTypes.NpgsqlDbType.Integer);
                        aParams[3].Value = 0;
                        aParams[4]       = new NpgsqlParameter("CreatedOn", NpgsqlTypes.NpgsqlDbType.Date);
                        aParams[4].Value = DateTime.Now;
                        res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.AddRolesNRights, aParams);
                    }
                    if (res > 0)
                    {
                        result.Status = Status.Success;
                        result.Values = res.ToString();
                    }
                    else
                    {
                        result.Status = Status.Failure;
                    }
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#16
0
        public Result UpdateAP(APViewModel model, bool isOutdoor = false)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams;
                if (!isOutdoor)
                {
                    aParams = new NpgsqlParameter[14];
                }
                else
                {
                    aParams = new NpgsqlParameter[9];
                }



                aParams[0]       = new NpgsqlParameter("Name", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[0].Value = model.Name;



                aParams[1]       = new NpgsqlParameter("Lat", NpgsqlTypes.NpgsqlDbType.Double);
                aParams[1].Value = model.Lat;



                aParams[2]       = new NpgsqlParameter("Long", NpgsqlTypes.NpgsqlDbType.Double);
                aParams[2].Value = model.Long;



                aParams[3]       = new NpgsqlParameter("Description", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[3].Value = model.Description;



                aParams[4]       = new NpgsqlParameter(AppConstants.LastModifiedOn, NpgsqlTypes.NpgsqlDbType.Timestamp);
                aParams[4].Value = DateTime.Now;



                aParams[5]       = new NpgsqlParameter(AppConstants.LastModifiedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[5].Value = 0;



                aParams[6]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[6].Value = true;



                if (isOutdoor)
                {
                    aParams[7]       = new NpgsqlParameter("APImagePath", NpgsqlTypes.NpgsqlDbType.Varchar);
                    aParams[7].Value = model.ImageSHPPath;
                }
                int i = 8;
                if (!isOutdoor)
                {
                    // aParams[8] = new NpgsqlParameter("FloorID", NpgsqlTypes.NpgsqlDbType.Integer);
                    // aParams[8].Value = model.FloorID;

                    aParams[7]        = new NpgsqlParameter("FloorID", NpgsqlTypes.NpgsqlDbType.Integer);
                    aParams[7].Value  = model.FloorID;
                    aParams[8]        = new NpgsqlParameter("APTypeID", NpgsqlTypes.NpgsqlDbType.Integer);
                    aParams[8].Value  = model.APTypeID;
                    aParams[9]        = new NpgsqlParameter("GroupID", NpgsqlTypes.NpgsqlDbType.Integer);
                    aParams[9].Value  = model.GroupID;
                    aParams[10]       = new NpgsqlParameter("IsIndoor", NpgsqlTypes.NpgsqlDbType.Boolean);
                    aParams[10].Value = true;
                    aParams[11]       = new NpgsqlParameter("APimagepath", NpgsqlTypes.NpgsqlDbType.Varchar);
                    aParams[11].Value = model.ImageSHPPath;
                    aParams[12]       = new NpgsqlParameter("SerialNo", NpgsqlTypes.NpgsqlDbType.Varchar);
                    aParams[12].Value = model.SerialNo;

                    i = 13;
                }



                aParams[i]       = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[i].Value = model.APID;
                int res = 0;
                if (!isOutdoor)
                {
                    res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdateAP, aParams);
                }
                else
                {
                    res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdateAPForOutdoor, aParams);
                }



                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#17
0
        public Result UpdateAPSector(APSectorViewModel model, bool isOutdoor = false)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams;
                if (!isOutdoor)
                {
                    aParams = new NpgsqlParameter[6];
                }
                else
                {
                    aParams = new NpgsqlParameter[8];
                }

                aParams[0]       = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[0].Value = model.APId;


                aParams[1]       = new NpgsqlParameter("SectorNumber", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[1].Value = model.SectorNumber;

                aParams[2]       = new NpgsqlParameter("SectorValue", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[2].Value = model.SectorValue;


                aParams[3]       = new NpgsqlParameter("SerialNo", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[3].Value = model.SerialNumber;

                aParams[4]       = new NpgsqlParameter(AppConstants.LastModifiedOn, NpgsqlTypes.NpgsqlDbType.Timestamp);
                aParams[4].Value = DateTime.Now;

                aParams[5]       = new NpgsqlParameter(AppConstants.LastModifiedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[5].Value = 0;

                aParams[6]       = new NpgsqlParameter("IsActive", NpgsqlTypes.NpgsqlDbType.Boolean);
                aParams[6].Value = true;

                int i = 7;
                if (!isOutdoor)
                {
                    //aParams[7] = new NpgsqlParameter("FloorID", NpgsqlTypes.NpgsqlDbType.Integer);
                    //aParams[7].Value = model.FloorID;
                    //i = 8;
                }

                aParams[i]       = new NpgsqlParameter("APSectorId", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[i].Value = model.APSectorId;
                int res = 0;
                if (!isOutdoor)
                {
                    res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdateAPSector, aParams);
                }
                else
                {
                    res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.UpdateAPSector, aParams);
                }

                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#18
0
        //public Result AddAPSector(APSectorViewModel model, bool isOutdoor = false)
        //{
        //    Result result = new Result();
        //    DBOperations dbOps = new DBOperations();
        //    try
        //    {
        //        NpgsqlParameter[] aParams;
        //        if (!isOutdoor)
        //        {
        //            aParams = new NpgsqlParameter[6];
        //        }
        //        else
        //        {
        //            aParams = new NpgsqlParameter[5];
        //        }


        //        aParams[0] = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
        //        aParams[0].Value = model.APId;

        //        aParams[1] = new NpgsqlParameter("SectorNumber", NpgsqlTypes.NpgsqlDbType.Integer);
        //        aParams[1].Value = model.SectorNumber;

        //        aParams[2] = new NpgsqlParameter("SectorValue", NpgsqlTypes.NpgsqlDbType.Varchar);
        //        aParams[2].Value = model.SectorValue;

        //        aParams[3] = new NpgsqlParameter("SerialNo", NpgsqlTypes.NpgsqlDbType.Varchar);
        //        aParams[3].Value = model.SerialNumber;

        //        aParams[4] = new NpgsqlParameter(AppConstants.CreatedBy, NpgsqlTypes.NpgsqlDbType.Integer);
        //        aParams[4].Value = 0;

        //        //if (!isOutdoor)
        //        //{
        //        //    aParams[5] = new NpgsqlParameter("FloorID", NpgsqlTypes.NpgsqlDbType.Integer);
        //        //    aParams[5].Value = model.FloorID;
        //        //}

        //        int res = 0;
        //        if (!isOutdoor)
        //        {
        //            res = (int)dbOps.ExecuteNonQuery(AppConstants.QueryConstants.AddAP, aParams);
        //        }
        //        else
        //        {
        //            res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.AddAPSector, aParams);
        //        }


        //        if (res > 0)
        //        {
        //            result.Status = Status.Success;
        //        }
        //        else
        //        {
        //            result.Status = Status.Failure;
        //        }
        //    }
        //    catch (Exception Ex)
        //    {
        //        dbOps.Abort();
        //        result.Status = Status.Failure;
        //    }
        //    return result;
        //}
        public Result AddAPSector(APSectorViewModel model, bool isOutdoor = false)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams;
                if (!isOutdoor)
                {
                    aParams = new NpgsqlParameter[6];
                }
                else
                {
                    aParams = new NpgsqlParameter[5];
                }



                aParams[0]       = new NpgsqlParameter("APID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[0].Value = model.APId;



                aParams[1]       = new NpgsqlParameter("SectorNumber", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[1].Value = model.SectorNumber;



                aParams[2]       = new NpgsqlParameter("SectorValue", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[2].Value = model.SectorValue;



                aParams[3]       = new NpgsqlParameter("SerialNo", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[3].Value = model.SerialNumber;



                aParams[4]       = new NpgsqlParameter(AppConstants.CreatedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[4].Value = 0;



                //if (!isOutdoor)
                //{
                //    aParams[5] = new NpgsqlParameter("FloorID", NpgsqlTypes.NpgsqlDbType.Integer);
                //    aParams[5].Value = model.FloorID;
                //}



                int res = 0;
                if (!isOutdoor)
                {
                    res = (int)dbOps.ExecuteNonQuery(AppConstants.QueryConstants.AddAPSector, aParams);
                }
                else
                {
                    res = dbOps.ExecuteNonQuery(AppConstants.QueryConstants.AddAPSector, aParams);
                }



                if (res > 0)
                {
                    result.Status = Status.Success;
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }
示例#19
0
        public Result AddAP(APViewModel model, bool isOutdoor = false)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

            try
            {
                NpgsqlParameter[] aParams;
                if (!isOutdoor)
                {
                    aParams = new NpgsqlParameter[11];
                }
                else
                {
                    aParams = new NpgsqlParameter[6];
                }

                aParams[0]       = new NpgsqlParameter("Name", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[0].Value = model.Name;

                aParams[1]       = new NpgsqlParameter("Lat", NpgsqlTypes.NpgsqlDbType.Double);
                aParams[1].Value = model.Lat;

                aParams[2]       = new NpgsqlParameter("Long", NpgsqlTypes.NpgsqlDbType.Double);
                aParams[2].Value = model.Long;

                aParams[3]       = new NpgsqlParameter("Description", NpgsqlTypes.NpgsqlDbType.Varchar);
                aParams[3].Value = model.Description;


                aParams[4]       = new NpgsqlParameter(AppConstants.CreatedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[4].Value = 0;



                if (!isOutdoor)
                {
                    aParams[5]        = new NpgsqlParameter("FloorID", NpgsqlTypes.NpgsqlDbType.Integer);
                    aParams[5].Value  = model.FloorID;
                    aParams[6]        = new NpgsqlParameter("APTypeID", NpgsqlTypes.NpgsqlDbType.Integer);
                    aParams[6].Value  = model.APTypeID;
                    aParams[7]        = new NpgsqlParameter("GroupID", NpgsqlTypes.NpgsqlDbType.Integer);
                    aParams[7].Value  = model.GroupID;
                    aParams[8]        = new NpgsqlParameter("IsIndoor", NpgsqlTypes.NpgsqlDbType.Boolean);
                    aParams[8].Value  = true;
                    aParams[9]        = new NpgsqlParameter("APimagepath", NpgsqlTypes.NpgsqlDbType.Varchar);
                    aParams[9].Value  = model.ImageSHPPath;
                    aParams[10]       = new NpgsqlParameter("SerialNo", NpgsqlTypes.NpgsqlDbType.Varchar);
                    aParams[10].Value = model.SerialNo;
                }
                if (isOutdoor)
                {
                    aParams[5]       = new NpgsqlParameter("APImagePath", NpgsqlTypes.NpgsqlDbType.Varchar);
                    aParams[5].Value = model.ImageSHPPath;
                }


                int res = 0;
                if (!isOutdoor)
                {
                    res = (int)dbOps.ExecuteScalar(AppConstants.QueryConstants.AddAP, aParams);
                }
                else
                {
                    res = (int)dbOps.ExecuteScalar(AppConstants.QueryConstants.AddAPForOutdoor, aParams);
                }

                if (res > 0)
                {
                    result.Status = Status.Success;
                    result.Values = res.ToString();
                }
                else
                {
                    result.Status = Status.Failure;
                }
            }
            catch (Exception Ex)
            {
                dbOps.Abort();
                result.Status = Status.Failure;
            }
            return(result);
        }