ExecuteScalar() 공개 메소드

public ExecuteScalar ( string queryString ) : int
queryString string
리턴 int
예제 #1
0
    private object saveOrderSummaryWithClient()
    {
        if (Session["Cart"] != null)
        {
            dtCart = (DataTable)Session["Cart"];
        }
        Object OrdSumID = null;

        try
        {
            Hashtable htPrams = new Hashtable();
            htCustInfo = (Hashtable)Session["htCustInfo"];
            htPrams.Add("@CustomerName", Convert.ToString(htCustInfo["Name"]));
            htPrams.Add("@EmailID", (string)htCustInfo["EmailID"]);
            htPrams.Add("@MobileNo", (string)htCustInfo["Mobile"]);
            htPrams.Add("@AlternameMobileNo", (string)htCustInfo["AltMobile"]);
            htPrams.Add("@Address", (string)htCustInfo["Address"]);

            htPrams.Add("@TotalAmount", (int)htCustInfo["Total"]);
            htPrams.Add("@OrdID", System.DBNull.Value);
            OrdSumID           = DBOperations.ExecuteScalar(htPrams, "uspFillOrderInfo_Prasad");
            btnConfirm.Enabled = false;
        }
        catch (Exception ex)
        {
            Response.Redirect("Error.aspx");
        }
        return(OrdSumID);
    }
예제 #2
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);
        }
예제 #3
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);
        }
        //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);
        }
예제 #5
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);
        }
예제 #6
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);
        }
        public Result AddInstallationParameters(InstallationParametersViewModel model)
        {
            Result       result = new Result();
            DBOperations dbOps  = new DBOperations();

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



                //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("APID", NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[14].Value = model.APID;
                aParams[15]       = new NpgsqlParameter(AppConstants.CreatedBy, NpgsqlTypes.NpgsqlDbType.Integer);
                aParams[15].Value = 0;



                int res = (int)dbOps.ExecuteScalar(AppConstants.QueryConstants.AddInstallationParameters, 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 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);
        }