public virtual int InsertFlower(string maHoa, string tenHoa, Nullable<double> giaBan, Nullable<int> soLuong, string hinhAnh, string maChuDe, ObjectParameter error)
        {
            var maHoaParameter = maHoa != null ?
                new ObjectParameter("MaHoa", maHoa) :
                new ObjectParameter("MaHoa", typeof(string));

            var tenHoaParameter = tenHoa != null ?
                new ObjectParameter("TenHoa", tenHoa) :
                new ObjectParameter("TenHoa", typeof(string));

            var giaBanParameter = giaBan.HasValue ?
                new ObjectParameter("GiaBan", giaBan) :
                new ObjectParameter("GiaBan", typeof(double));

            var soLuongParameter = soLuong.HasValue ?
                new ObjectParameter("SoLuong", soLuong) :
                new ObjectParameter("SoLuong", typeof(int));

            var hinhAnhParameter = hinhAnh != null ?
                new ObjectParameter("HinhAnh", hinhAnh) :
                new ObjectParameter("HinhAnh", typeof(string));

            var maChuDeParameter = maChuDe != null ?
                new ObjectParameter("MaChuDe", maChuDe) :
                new ObjectParameter("MaChuDe", typeof(string));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertFlower", maHoaParameter, tenHoaParameter, giaBanParameter, soLuongParameter, hinhAnhParameter, maChuDeParameter, error);
        }
     public virtual int SPCodeGlobalInsert(string permissionCode, string codeValue, string parentCodeValue, string codeName, string memId, string regIP, ObjectParameter returnValue)
     {
         var permissionCodeParameter = permissionCode != null ?
             new ObjectParameter("permissionCode", permissionCode) :
             new ObjectParameter("permissionCode", typeof(string));
 
         var codeValueParameter = codeValue != null ?
             new ObjectParameter("codeValue", codeValue) :
             new ObjectParameter("codeValue", typeof(string));
 
         var parentCodeValueParameter = parentCodeValue != null ?
             new ObjectParameter("parentCodeValue", parentCodeValue) :
             new ObjectParameter("parentCodeValue", typeof(string));
 
         var codeNameParameter = codeName != null ?
             new ObjectParameter("codeName", codeName) :
             new ObjectParameter("codeName", typeof(string));
 
         var memIdParameter = memId != null ?
             new ObjectParameter("memId", memId) :
             new ObjectParameter("memId", typeof(string));
 
         var regIPParameter = regIP != null ?
             new ObjectParameter("regIP", regIP) :
             new ObjectParameter("regIP", typeof(string));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("SPCodeGlobalInsert", permissionCodeParameter, codeValueParameter, parentCodeValueParameter, codeNameParameter, memIdParameter, regIPParameter, returnValue);
     }
 /// <summary>
 /// Inserts the specified ticket detail.
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <param name="ticketDetail">The ticket detail.</param>
 /// <returns>
 /// Ticket Id.
 /// </returns>
 public int Insert(int? userId, string ticketDetail)
 {
     ObjectParameter ticketIdParameter = new ObjectParameter("TicketID", typeof(global::System.Int32));
     ticketIdParameter.Value = DBNull.Value;
     this.unitOfWork.Context.AddTicket(ticketDetail, userId, ticketIdParameter);
     return Convert.ToInt32(ticketIdParameter.Value, CultureInfo.CurrentCulture);
 }
 /// <summary>
 /// Posts the comment.
 /// </summary>
 /// <param name="commentDetail">The comment detail.</param>
 /// <param name="userId">The user identifier.</param>
 /// <returns>comment id</returns>
 public int PostComment(string commentDetail, int userId)
 {
     ObjectParameter commentIdParameter = new ObjectParameter("CommentID", typeof(global::System.Int32));
     commentIdParameter.Value = DBNull.Value;
     this.unitOfWork.Context.AddTicketComment(commentDetail, userId, commentIdParameter);
     return Convert.ToInt32(commentIdParameter.Value, CultureInfo.CurrentCulture);
 }
     public virtual int NewEvent(string name, Nullable<int> typeId, Nullable<System.DateTime> date, Nullable<System.DateTime> closingDate, Nullable<int> capacity, string place, string imageUrl, ObjectParameter id)
     {
         var nameParameter = name != null ?
             new ObjectParameter("Name", name) :
             new ObjectParameter("Name", typeof(string));
 
         var typeIdParameter = typeId.HasValue ?
             new ObjectParameter("TypeId", typeId) :
             new ObjectParameter("TypeId", typeof(int));
 
         var dateParameter = date.HasValue ?
             new ObjectParameter("Date", date) :
             new ObjectParameter("Date", typeof(System.DateTime));
 
         var closingDateParameter = closingDate.HasValue ?
             new ObjectParameter("ClosingDate", closingDate) :
             new ObjectParameter("ClosingDate", typeof(System.DateTime));
 
         var capacityParameter = capacity.HasValue ?
             new ObjectParameter("Capacity", capacity) :
             new ObjectParameter("Capacity", typeof(int));
 
         var placeParameter = place != null ?
             new ObjectParameter("Place", place) :
             new ObjectParameter("Place", typeof(string));
 
         var imageUrlParameter = imageUrl != null ?
             new ObjectParameter("ImageUrl", imageUrl) :
             new ObjectParameter("ImageUrl", typeof(string));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("NewEvent", nameParameter, typeIdParameter, dateParameter, closingDateParameter, capacityParameter, placeParameter, imageUrlParameter, id);
     }
     public virtual int T_Alarms_ADD(ObjectParameter id, Nullable<int> statId, Nullable<int> devId, Nullable<short> dustType, Nullable<double> faultVal, Nullable<System.DateTime> updateTime, string country)
     {
         var statIdParameter = statId.HasValue ?
             new ObjectParameter("StatId", statId) :
             new ObjectParameter("StatId", typeof(int));
 
         var devIdParameter = devId.HasValue ?
             new ObjectParameter("DevId", devId) :
             new ObjectParameter("DevId", typeof(int));
 
         var dustTypeParameter = dustType.HasValue ?
             new ObjectParameter("DustType", dustType) :
             new ObjectParameter("DustType", typeof(short));
 
         var faultValParameter = faultVal.HasValue ?
             new ObjectParameter("FaultVal", faultVal) :
             new ObjectParameter("FaultVal", typeof(double));
 
         var updateTimeParameter = updateTime.HasValue ?
             new ObjectParameter("UpdateTime", updateTime) :
             new ObjectParameter("UpdateTime", typeof(System.DateTime));
 
         var countryParameter = country != null ?
             new ObjectParameter("Country", country) :
             new ObjectParameter("Country", typeof(string));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("T_Alarms_ADD", id, statIdParameter, devIdParameter, dustTypeParameter, faultValParameter, updateTimeParameter, countryParameter);
     }
Example #7
0
        /* 
         * Nombre      :    AddClient
         * Descripción :    Agregar un registro de cliente, tarjetas y cuentas. 
         * Parámetros  :    string numdoc, string name, string phone, string address
         */
        public Response AddClient(string numdoc, string name, string phone, string address)
        {

            using (CardsEntities context = new CardsEntities())
            {

                string resCode = "1";
                string resDetail = "Excepción: ";
                string resSource = SERVICE_NAME + String.Format("AddClient(string numdoc={0}, string name={1}, string phone={2}, string address={3})", numdoc , name , phone , address);

                ObjectParameter respuesta = new ObjectParameter("response", typeof(int));

                if (numdoc != null && name != null && phone != null && address != null)
                {
                    context.PLZ_ADD_CLIENTE(numdoc, name, phone, address, respuesta);
                    resCode = respuesta.Value.ToString();
                }

                resDetail = getExcepcionDetail(resCode);

                return new Response() { excode = resCode, exdetail = resDetail, exsource = resSource };

            }

        }
     public virtual int ParameterTest(byte[] binary, Nullable<bool> @bool, Nullable<System.DateTime> dateTime, Nullable<decimal> @decimal, Nullable<double> @float, Nullable<System.Guid> guid, ObjectParameter @int, ObjectParameter @string)
     {
         var binaryParameter = binary != null ?
             new ObjectParameter("binary", binary) :
             new ObjectParameter("binary", typeof(byte[]));
 
         var boolParameter = @bool.HasValue ?
             new ObjectParameter("bool", @bool) :
             new ObjectParameter("bool", typeof(bool));
 
         var dateTimeParameter = dateTime.HasValue ?
             new ObjectParameter("dateTime", dateTime) :
             new ObjectParameter("dateTime", typeof(System.DateTime));
 
         var decimalParameter = @decimal.HasValue ?
             new ObjectParameter("decimal", @decimal) :
             new ObjectParameter("decimal", typeof(decimal));
 
         var floatParameter = @float.HasValue ?
             new ObjectParameter("float", @float) :
             new ObjectParameter("float", typeof(double));
 
         var guidParameter = guid.HasValue ?
             new ObjectParameter("guid", guid) :
             new ObjectParameter("guid", typeof(System.Guid));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("ParameterTest", binaryParameter, boolParameter, dateTimeParameter, decimalParameter, floatParameter, guidParameter, @int, @string);
     }
Example #9
0
 private static void CallStoredProc() {
     using (AutoLotEntities context = new AutoLotEntities()) {
         ObjectParameter outParam = new ObjectParameter("petName", typeof(string));
         context.GetPetName(83, outParam);
         Console.WriteLine(outParam.Value);
     }
 }
     public virtual int GetPetName(Nullable<int> carID, ObjectParameter petName)
     {
         var carIDParameter = carID.HasValue ?
             new ObjectParameter("carID", carID) :
             new ObjectParameter("carID", typeof(int));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetPetName", carIDParameter, petName);
     }
        public virtual int aspnet_Applications_CreateApplication(string applicationName, ObjectParameter applicationId)
        {
            var applicationNameParameter = applicationName != null ?
                new ObjectParameter("ApplicationName", applicationName) :
                new ObjectParameter("ApplicationName", typeof(string));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("aspnet_Applications_CreateApplication", applicationNameParameter, applicationId);
        }
        public virtual int sp_GenerateRandomString(Nullable<int> sLength, ObjectParameter randomString)
        {
            var sLengthParameter = sLength.HasValue ?
                new ObjectParameter("sLength", sLength) :
                new ObjectParameter("sLength", typeof(int));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_GenerateRandomString", sLengthParameter, randomString);
        }
        public virtual int GetHashCode(string input, ObjectParameter hash)
        {
            var inputParameter = input != null ?
                new ObjectParameter("input", input) :
                new ObjectParameter("input", typeof(string));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetHashCode", inputParameter, hash);
        }
        public virtual int usp_AddEventFilter(string eventFilter, ObjectParameter guid)
        {
            var eventFilterParameter = eventFilter != null ?
                new ObjectParameter("EventFilter", eventFilter) :
                new ObjectParameter("EventFilter", typeof(string));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_AddEventFilter", eventFilterParameter, guid);
        }
Example #15
0
        /// <summary>
        /// Allow create a new agent
        /// </summary>
        /// <param name="model"> Objet type ModelAgent</param>
        /// <param name="prmOutIdAgent">New id agent record</param>
        /// <param name="prmOutResult">Result the process created</param>
        public void addAgentController(AgentModel model, ref ObjectParameter  prmOutIdAgent, ref ObjectParameter  prmOutResult)
        {

            int res = 0;
            Repository<AGENT> objInsert = new Repository<AGENT>();

            //Repository<AgentInsert> objInsert = new Repository<AgentInsert>();
            DGSDATAEntities entities = new DGSDATAEntities();
            try
            {

                res = entities.Agent_Insert(
                    model.Enable,
                    model.DontXferPlayerActivity, //prmDontXfer
                    model.IsDistributor,
                    model.IdUser,   // prmIdUser,
                    model.Distributor,
                    model.Makeup, 
                    model.CommSports,
                    model.CommCasino,
                    model.CommHorses,
                    model.PerHeadSports,
                    model.PerHeadCasino,
                    model.PerHeadHorses,
                    model.IdAgentType,
                    model.IdCurrency,
                    model.IdBook,
                    model.IdGrouping,
                    model.Agent,
                    model.Name,
                    model.Password,
                    model.City,
                    model.State,
                    model.Country,
                    model.Address1,
                    model.Address2,
                    model.Email,
                    model.Phone,
                    model.Fax,
                    model.Zip,
                    model.OnlineAccess,
                    model.OnlineMessage,
                    model.IdLineType,
                    prmOutIdAgent,
                    prmOutResult);

                   //object obj = new object[] { prmOutIdAgent, prmOutResult };

                //return obj;
            }
            catch 
            {
                throw;
            }

           
            
        }
 private static decimal FindSupplierIncomesForPeriodOfTime(string name, DateTime startDate, DateTime endDate)
 {
     using (var northwindEntities = new NorthwindEntities())
     {
         var outputParameter = new ObjectParameter("result", typeof(decimal));
         northwindEntities.FindSupplierIncome(name, startDate, endDate, outputParameter);
         return decimal.Parse(outputParameter.Value.ToString());
     }
 }
Example #17
0
        public JsonResult LockedDate(int locationID, DateTime lockedDate)
        {
            int x = locationID;
            DateTime d = lockedDate;
            ObjectParameter[] parameters = new ObjectParameter[] { new ObjectParameter("AspUserID", User.Identity.GetUserId()), new ObjectParameter("LocationID", locationID), new ObjectParameter("LockedDate", lockedDate) };
            this.baseRepository.ExecuteFunction("UpdateLockedDate", parameters);

            return Json(new { Success = true });
        }
Example #18
0
		// ReSharper disable once MemberCanBePrivate.Global
		public IQueryable<UserIdWrapper> GetUsersByNamePrefix(string name)
		{
			if (string.IsNullOrEmpty(name))
				return db.Users.Select(u => new UserIdWrapper(u.Id)); ;
			var splittedName = name.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
			var nameQuery = string.Join(" & ", splittedName.Select(s => "\"" + s.Trim().Replace("\"", "\\\"") + "*\""));
			var nameParameter = new ObjectParameter("name", nameQuery);
			return db.ObjectContext().CreateQuery<UserIdWrapper>($"[{nameof(GetUsersByNamePrefix)}](@name)", nameParameter);
		}
Example #19
0
        public static void InsertNewUserToAspNetUserRoles(LmsUserViewModel reg, string id)
        {
            using (var db = new SWC_LMSEntities())
            {
                var output = new ObjectParameter("UserId", typeof(int));
                db.InsertToAspNetUserRoles(reg.UserId.ToString(), reg.Roles.ToString());

            }
        }
Example #20
0
 public string InsertFlower(Hoa hoa)
 {
     ObjectParameter err = new ObjectParameter("Error", typeof(string));
     using (BanHoaEntityEntities banHoaEntity=new BanHoaEntityEntities())
     {
         banHoaEntity.InsertFlower(hoa.MaHoa, hoa.TenHoa, hoa.GiaBan, hoa.SoLuong, hoa.HinhAnh, hoa.MaChuDe, err);
     }
     return err.Value.ToString();
 }
Example #21
0
        public static void InsertNewUserToDb(RegisterViewModel reg, string id)
        {
            using (var db = new SWC_LMSEntities())
            {
                var output = new ObjectParameter("UserId", typeof(int));
                db.LmsUserInsert(id, reg.Fname, reg.Lname, reg.Email,
                    reg.GradeLevelId, reg.SuggestedRole, output);

            }
        }
 public void StoreProcedureWithOutParameterTest()
 {
     using (AdventureWorks adventureWorks = new AdventureWorks())
     {
         ObjectParameter errorLogId = new ObjectParameter("ErrorLogID", typeof(int)) { Value = 5 };
         int? rows = adventureWorks.LogError(errorLogId);
         Assert.AreEqual(0, errorLogId.Value);
         Assert.AreEqual(typeof(int), errorLogId.ParameterType);
         Assert.AreEqual(-1, rows);
     }
 }
        public virtual ObjectResult<sp_ShowProductShoppingPage_Result> sp_ShowProductShoppingPage(ObjectParameter totalRow, Nullable<int> index, Nullable<int> rowNumber)
        {
            var indexParameter = index.HasValue ?
                new ObjectParameter("index", index) :
                new ObjectParameter("index", typeof(int));

            var rowNumberParameter = rowNumber.HasValue ?
                new ObjectParameter("rowNumber", rowNumber) :
                new ObjectParameter("rowNumber", typeof(int));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_ShowProductShoppingPage_Result>("sp_ShowProductShoppingPage", totalRow, indexParameter, rowNumberParameter);
        }
Example #24
0
        public virtual int spInsertSale(Nullable<int> clientId, Nullable<System.DateTime> dateSale, ObjectParameter saleId)
        {
            var clientIdParameter = clientId.HasValue ?
                new ObjectParameter("ClientId", clientId) :
                new ObjectParameter("ClientId", typeof(int));

            var dateSaleParameter = dateSale.HasValue ?
                new ObjectParameter("DateSale", dateSale) :
                new ObjectParameter("DateSale", typeof(System.DateTime));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("spInsertSale", clientIdParameter, dateSaleParameter, saleId);
        }
Example #25
0
     public virtual int AccountExists(string login, Nullable<bool> isActive, ObjectParameter accExists)
     {
         var loginParameter = login != null ?
             new ObjectParameter("Login", login) :
             new ObjectParameter("Login", typeof(string));
 
         var isActiveParameter = isActive.HasValue ?
             new ObjectParameter("IsActive", isActive) :
             new ObjectParameter("IsActive", typeof(bool));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("AccountExists", loginParameter, isActiveParameter, accExists);
     }
Example #26
0
        public void LogIn(LmsUserViewRegistration user)
        {
            byte? gradeLevelId = null;
            if (user.GradeLevelId != null)
            {
                gradeLevelId = Convert.ToByte(user.GradeLevelId);
            }

            ObjectParameter userId = new ObjectParameter("userId", typeof (int));
            db.LmsUserInsert(user.GuidId, user.FirstName, user.LastName, user.Email, gradeLevelId, user.SuggestedRole,
                userId);
        }
        public virtual int spLogin(string user, string pwd, ObjectParameter outId)
        {
            var userParameter = user != null ?
                new ObjectParameter("user", user) :
                new ObjectParameter("user", typeof(string));

            var pwdParameter = pwd != null ?
                new ObjectParameter("pwd", pwd) :
                new ObjectParameter("pwd", typeof(string));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("spLogin", userParameter, pwdParameter, outId);
        }
        public virtual int Register_Complete(Nullable<int> userId, Nullable<int> roleId, ObjectParameter msgText, ObjectParameter msgType)
        {
            var userIdParameter = userId.HasValue ?
                new ObjectParameter("UserId", userId) :
                new ObjectParameter("UserId", typeof(int));

            var roleIdParameter = roleId.HasValue ?
                new ObjectParameter("RoleId", roleId) :
                new ObjectParameter("RoleId", typeof(int));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("Register_Complete", userIdParameter, roleIdParameter, msgText, msgType);
        }
Example #29
0
        public static int Get(string name)
        {
            using (var context = Connection.GetContext())
            {
                ObjectParameter parameter = new ObjectParameter("ID", typeof(int));

                context.sp_GetProducerID(name, parameter);
                context.SaveChanges();
                return (int)parameter.Value;
            }


        }
        /// <summary>
        /// Applies the current filter settings to an esql object query dynamically.
        /// </summary>
        /// <param name="filters">The filters.</param>
        /// <param name="baseQuery">The base object query.</param>
        /// <returns>ObjectQuery{Ticket}.</returns>
        public static ObjectQuery<Ticket> ApplyToQuery(this ICollection<UserTicketListFilterColumn> filters, ObjectQuery<Ticket> baseQuery)
        {
            var filterColumns = filters.ToList();
            if (filterColumns.Count > 0)
            {
                var fkeys = new string[filterColumns.Count];
                var fParams = new ObjectParameter[filterColumns.Count];
                for (var i = 0; i < filterColumns.Count; i++)
                {
                    string optr;
                    var filterColumn = filterColumns[i];

                    if (filterColumn.ColumnValue == DBNull.Value)
                    {
                        optr = (filterColumn.UseEqualityComparison.HasValue && !filterColumn.UseEqualityComparison.Value)
                            ? "IS NOT"
                            : "IS";
                    }
                    else
                    {
                        optr = (filterColumn.UseEqualityComparison.HasValue && !filterColumn.UseEqualityComparison.Value)
                            ? "!="
                            : "=";
                    }

                    fkeys[i] = string.Format("it.{0} {1} {2}", filterColumn.ColumnName, optr, "@" + filterColumn.ColumnName);

                    //most of the time esql works with whatever type of param value you pass in, but
                    // enums in our collection are serialized to/from json as integers.
                    // Check if enum, and explicitly convert int value to the correct enum value
                    if (filterColumn.ColumnValueType != null && filterColumn.ColumnValueType.IsEnum)
                    {
                        filterColumn.ColumnValue = Enum.Parse(filterColumn.ColumnValueType, filterColumn.ColumnValue.ToString());
                    }
                    //assigning the type in ctor, then value directly as a param works around issues when the colum val is null.

                    fParams[i] = new ObjectParameter(filterColumn.ColumnName, filterColumn.ColumnValueType)
                    {
                        Value = filterColumn.ColumnValue
                    };

                }

                var wString = string.Join(" and ", fkeys);
                baseQuery = baseQuery.Where(wString, fParams);
            }
            return baseQuery;
        }