/// <summary>
        /// Merges <see cref="ObjectParameter"/>s from a source ObjectQuery with ObjectParameters specified as an argument to a builder method.
        /// A new <see cref="ObjectParameterCollection"/> is returned that contains copies of parameters from both <paramref name="sourceQueryParams"/> and <paramref name="builderMethodParams"/>.
        /// </summary>
        /// <param name="context">The <see cref="ObjectContext"/> to use when constructing the new parameter collection</param>
        /// <param name="sourceQueryParams">ObjectParameters from the ObjectQuery on which the query builder method was called</param>
        /// <param name="builderMethodParams">ObjectParameters that were specified as an argument to the builder method</param>
        /// <returns>A new ObjectParameterCollection containing copies of all parameters</returns>
        private static ObjectParameterCollection MergeParameters(ObjectContext context, ObjectParameterCollection sourceQueryParams, ObjectParameter[] builderMethodParams)
        {
            Debug.Assert(builderMethodParams != null, "params array argument should not be null");
            if (sourceQueryParams == null && builderMethodParams.Length == 0)
            {
                return null;
            }

            ObjectParameterCollection mergedParams = ObjectParameterCollection.DeepCopy(sourceQueryParams);
            if (mergedParams == null)
            {
                mergedParams = new ObjectParameterCollection(context.Perspective);
            }

            foreach (ObjectParameter builderParam in builderMethodParams)
            {
                mergedParams.Add(builderParam);
            }

            return mergedParams;
        }
        // <summary>
        // Merges <see cref="ObjectParameter" />s from a source ObjectQuery with ObjectParameters specified as an argument to a builder method.
        // A new <see cref="ObjectParameterCollection" /> is returned that contains copies of parameters from both
        // <paramref
        //     name="sourceQueryParams" />
        // and <paramref name="builderMethodParams" />.
        // </summary>
        // <param name="context">
        // The <see cref="ObjectContext" /> to use when constructing the new parameter collection
        // </param>
        // <param name="sourceQueryParams"> ObjectParameters from the ObjectQuery on which the query builder method was called </param>
        // <param name="builderMethodParams"> ObjectParameters that were specified as an argument to the builder method </param>
        // <returns> A new ObjectParameterCollection containing copies of all parameters </returns>
        private static ObjectParameterCollection MergeParameters(
            ObjectContext context, ObjectParameterCollection sourceQueryParams, ObjectParameter[] builderMethodParams)
        {
            DebugCheck.NotNull(builderMethodParams);
            if (sourceQueryParams == null
                && builderMethodParams.Length == 0)
            {
                return null;
            }

            var mergedParams = ObjectParameterCollection.DeepCopy(sourceQueryParams);
            if (mergedParams == null)
            {
                mergedParams = new ObjectParameterCollection(context.Perspective);
            }

            foreach (var builderParam in builderMethodParams)
            {
                mergedParams.Add(builderParam);
            }

            return mergedParams;
        }
Esempio n. 3
0
        public virtual ObjectResult <string> ELMAH_GetErrorsXml(string application, Nullable <int> pageIndex, Nullable <int> pageSize, ObjectParameter totalCount)
        {
            var applicationParameter = application != null ?
                                       new ObjectParameter("Application", application) :
                                       new ObjectParameter("Application", typeof(string));

            var pageIndexParameter = pageIndex.HasValue ?
                                     new ObjectParameter("PageIndex", pageIndex) :
                                     new ObjectParameter("PageIndex", typeof(int));

            var pageSizeParameter = pageSize.HasValue ?
                                    new ObjectParameter("PageSize", pageSize) :
                                    new ObjectParameter("PageSize", typeof(int));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <string>("ELMAH_GetErrorsXml", applicationParameter, pageIndexParameter, pageSizeParameter, totalCount));
        }
Esempio n. 4
0
 private void AddParameter(QueryParameterExpression queryParameter)
 {
     if (null == _parameters)
     {
         _parameters = new List<KeyValuePair<ObjectParameter, QueryParameterExpression>>();
     }
     if (!_parameters.Select(p => p.Value).Contains(queryParameter))
     {
         ObjectParameter parameter = new ObjectParameter(queryParameter.ParameterReference.ParameterName, queryParameter.Type);
         _parameters.Add(new KeyValuePair<ObjectParameter, QueryParameterExpression>(parameter, queryParameter));
     }
 }
 public virtual int uspLogError(ObjectParameter errorLogID)
 {
     return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("uspLogError", errorLogID));
 }
        public virtual ObjectResult <Nullable <int> > Register_User(string name, string email, string password, ObjectParameter result)
        {
            var nameParameter = name != null ?
                                new ObjectParameter("Name", name) :
                                new ObjectParameter("Name", typeof(string));

            var emailParameter = email != null ?
                                 new ObjectParameter("Email", email) :
                                 new ObjectParameter("Email", typeof(string));

            var passwordParameter = password != null ?
                                    new ObjectParameter("Password", password) :
                                    new ObjectParameter("Password", typeof(string));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <Nullable <int> >("Register_User", nameParameter, emailParameter, passwordParameter, result));
        }
 internal static ObjectQueryState Where(ObjectQueryState query, string alias, string predicate, ObjectParameter[] parameters)
 {
     return BuildOrderByOrWhere(query, alias, predicate, parameters, _whereOp, null, false);
 }
Esempio n. 8
0
        public virtual ObjectResult <Nullable <short> > InsertCategory(string category_name, ObjectParameter category_id)
        {
            var category_nameParameter = category_name != null ?
                                         new ObjectParameter("category_name", category_name) :
                                         new ObjectParameter("category_name", typeof(string));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <Nullable <short> >("InsertCategory", category_nameParameter, category_id));
        }
Esempio n. 9
0
 public override ICollection <AccountInvoiceViewDetail> GetViewDetails(int accountInvoiceID)
 {
     ObjectParameter[] parameters = new ObjectParameter[] { new ObjectParameter("AccountInvoiceID", accountInvoiceID) };
     return(this.GetViewDetails(parameters));
 }
 internal static ObjectQueryState SelectValue(ObjectQueryState query, string alias, string projection, ObjectParameter[] parameters, Type projectedType)
 {
     return BuildSelectOrSelectValue(query, alias, projection, parameters, _selectValueOp, projectedType);
 }
Esempio n. 11
0
 public int CallProcedureArchivarInformeRecepcion(int?id, ObjectParameter error)
 {
     return(dao.CallProcedureArchivarInformeRecepcion(id, error));
 }
Esempio n. 12
0
 public int CallProcedureInformarEjecucion(int?id, string mensaje, ObjectParameter error)
 {
     return(dao.CallProcedureInformarEjecucion(id, mensaje, error));
 }
Esempio n. 13
0
        public virtual int sp_userinformation(string emailID, string password, string firstName, string lastName, string mobileNo, string gender, string country, string created_By, ObjectParameter error)
        {
            var emailIDParameter = emailID != null ?
                                   new ObjectParameter("EmailID", emailID) :
                                   new ObjectParameter("EmailID", typeof(string));

            var passwordParameter = password != null ?
                                    new ObjectParameter("Password", password) :
                                    new ObjectParameter("Password", typeof(string));

            var firstNameParameter = firstName != null ?
                                     new ObjectParameter("FirstName", firstName) :
                                     new ObjectParameter("FirstName", typeof(string));

            var lastNameParameter = lastName != null ?
                                    new ObjectParameter("LastName", lastName) :
                                    new ObjectParameter("LastName", typeof(string));

            var mobileNoParameter = mobileNo != null ?
                                    new ObjectParameter("MobileNo", mobileNo) :
                                    new ObjectParameter("MobileNo", typeof(string));

            var genderParameter = gender != null ?
                                  new ObjectParameter("Gender", gender) :
                                  new ObjectParameter("Gender", typeof(string));

            var countryParameter = country != null ?
                                   new ObjectParameter("Country", country) :
                                   new ObjectParameter("Country", typeof(string));

            var created_ByParameter = created_By != null ?
                                      new ObjectParameter("Created_By", created_By) :
                                      new ObjectParameter("Created_By", typeof(string));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_userinformation", emailIDParameter, passwordParameter, firstNameParameter, lastNameParameter, mobileNoParameter, genderParameter, countryParameter, created_ByParameter, error));
        }
Esempio n. 14
0
        public virtual int sp_transactionEntry(Nullable <int> userID, string product, string description, string date, string amount, string created_By, ObjectParameter error)
        {
            var userIDParameter = userID.HasValue ?
                                  new ObjectParameter("UserID", userID) :
                                  new ObjectParameter("UserID", typeof(int));

            var productParameter = product != null ?
                                   new ObjectParameter("Product", product) :
                                   new ObjectParameter("Product", typeof(string));

            var descriptionParameter = description != null ?
                                       new ObjectParameter("Description", description) :
                                       new ObjectParameter("Description", typeof(string));

            var dateParameter = date != null ?
                                new ObjectParameter("Date", date) :
                                new ObjectParameter("Date", typeof(string));

            var amountParameter = amount != null ?
                                  new ObjectParameter("Amount", amount) :
                                  new ObjectParameter("Amount", typeof(string));

            var created_ByParameter = created_By != null ?
                                      new ObjectParameter("Created_By", created_By) :
                                      new ObjectParameter("Created_By", typeof(string));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_transactionEntry", userIDParameter, productParameter, descriptionParameter, dateParameter, amountParameter, created_ByParameter, error));
        }
Esempio n. 15
0
        public virtual int sp_chartdata(Nullable <int> userID, string frDate, string toDate, ObjectParameter error)
        {
            var userIDParameter = userID.HasValue ?
                                  new ObjectParameter("UserID", userID) :
                                  new ObjectParameter("UserID", typeof(int));

            var frDateParameter = frDate != null ?
                                  new ObjectParameter("frDate", frDate) :
                                  new ObjectParameter("frDate", typeof(string));

            var toDateParameter = toDate != null ?
                                  new ObjectParameter("toDate", toDate) :
                                  new ObjectParameter("toDate", typeof(string));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_chartdata", userIDParameter, frDateParameter, toDateParameter, error));
        }
        private static ObjectQueryState BuildOrderByOrWhere(ObjectQueryState query, string alias, string predicateOrKeys, ObjectParameter[] parameters, string op, string skipCount, bool allowsLimit)
        {
            Debug.Assert(!StringUtil.IsNullOrEmptyOrWhiteSpace(alias), "Invalid alias");
            Debug.Assert(!StringUtil.IsNullOrEmptyOrWhiteSpace(predicateOrKeys), "Invalid predicate/keys");
            Debug.Assert(null == skipCount || op == _orderByOp, "Skip clause used with WHERE operator?");

            string queryText = GetCommandText(query);

            // Build the new query string:
            // Either: "SELECT VALUE <alias> FROM (<this query>) AS <alias> WHERE <predicate>"
            //  (for Where)
            // Or:  "SELECT VALUE <alias> FROM (<this query>) AS <alias> ORDER BY <keys> <optional: SKIP <skip>>"
            // Depending on the value of 'op'
            int queryLength = _selectValueOp.Length +
                              alias.Length +
                              _fromOp.Length +
                              queryText.Length +
                              _asOp.Length +
                              alias.Length +
                              op.Length +
                              predicateOrKeys.Length;
            
            if (skipCount != null)
            {
                queryLength += (_skipOp.Length + skipCount.Length);
            }

            StringBuilder builder = new StringBuilder(queryLength);
            builder.Append(_selectValueOp);
            builder.Append(alias);
            builder.Append(_fromOp);
            builder.Append(queryText);
            builder.Append(_asOp);
            builder.Append(alias);
            builder.Append(op);
            builder.Append(predicateOrKeys);
            if (skipCount != null)
            {
                builder.Append(_skipOp);
                builder.Append(skipCount);
            }

            // Create a new EntitySqlQueryImplementation that uses the new query as its command text.
            // Span is carried over, no adjustment is needed.
            return NewBuilderQuery(query, query.ElementType, builder, allowsLimit, query.Span, MergeParameters(query.ObjectContext, query.Parameters,  parameters));
        }
 public override ICollection <FinishedHandoverViewDetail> GetViewDetails(int finishedHandoverID)
 {
     ObjectParameter[] parameters = new ObjectParameter[] { new ObjectParameter("FinishedHandoverID", finishedHandoverID) };
     return(this.GetViewDetails(parameters));
 }
 internal static ObjectQueryState OrderBy(ObjectQueryState query, string alias, string keys, ObjectParameter[] parameters)
 {
     return BuildOrderByOrWhere(query, alias, keys, parameters, _orderByOp, null, true);
 }
Esempio n. 19
0
        public virtual int P_STUDENT(string p_FIRST_NAME, string p_ADDRESS, string p_DATEOFBIRTH, string p_PHONE, Nullable <int> p_AGE, string p_GENDER, Nullable <int> p_SEM, string p_IMAGE, ObjectParameter v_OUT)
        {
            var p_FIRST_NAMEParameter = p_FIRST_NAME != null ?
                                        new ObjectParameter("P_FIRST_NAME", p_FIRST_NAME) :
                                        new ObjectParameter("P_FIRST_NAME", typeof(string));

            var p_ADDRESSParameter = p_ADDRESS != null ?
                                     new ObjectParameter("P_ADDRESS", p_ADDRESS) :
                                     new ObjectParameter("P_ADDRESS", typeof(string));

            var p_DATEOFBIRTHParameter = p_DATEOFBIRTH != null ?
                                         new ObjectParameter("P_DATEOFBIRTH", p_DATEOFBIRTH) :
                                         new ObjectParameter("P_DATEOFBIRTH", typeof(string));

            var p_PHONEParameter = p_PHONE != null ?
                                   new ObjectParameter("P_PHONE", p_PHONE) :
                                   new ObjectParameter("P_PHONE", typeof(string));

            var p_AGEParameter = p_AGE.HasValue ?
                                 new ObjectParameter("P_AGE", p_AGE) :
                                 new ObjectParameter("P_AGE", typeof(int));

            var p_GENDERParameter = p_GENDER != null ?
                                    new ObjectParameter("P_GENDER", p_GENDER) :
                                    new ObjectParameter("P_GENDER", typeof(string));

            var p_SEMParameter = p_SEM.HasValue ?
                                 new ObjectParameter("P_SEM", p_SEM) :
                                 new ObjectParameter("P_SEM", typeof(int));

            var p_IMAGEParameter = p_IMAGE != null ?
                                   new ObjectParameter("P_IMAGE", p_IMAGE) :
                                   new ObjectParameter("P_IMAGE", typeof(string));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("P_STUDENT", p_FIRST_NAMEParameter, p_ADDRESSParameter, p_DATEOFBIRTHParameter, p_PHONEParameter, p_AGEParameter, p_GENDERParameter, p_SEMParameter, p_IMAGEParameter, v_OUT));
        }
        internal static ObjectQueryState Top(ObjectQueryState query, string alias, string count, ObjectParameter[] parameters)
        {
            int queryLength = count.Length;
            string queryText = GetCommandText(query);
            bool limitAllowed = ((EntitySqlQueryState)query).AllowsLimitSubclause;

            if (limitAllowed)
            {
                // Build the new query string:
                // <this query> LIMIT <count>
                queryLength += (queryText.Length +
                                _limitOp.Length
                    // + count.Length is added above
                                );
            }
            else
            {
                // Build the new query string:
                // "SELECT VALUE TOP(<count>) <alias> FROM (<this query>) AS <alias>"
                queryLength += (_topOp.Length +
                    // count.Length + is added above
                               _topInfix.Length +
                               alias.Length +
                               _fromOp.Length +
                               queryText.Length +
                               _asOp.Length +
                               alias.Length);
            }

            StringBuilder builder = new StringBuilder(queryLength);
            if (limitAllowed)
            {
                builder.Append(queryText);
                builder.Append(_limitOp);
                builder.Append(count);
            }
            else
            {
                builder.Append(_topOp);
                builder.Append(count);
                builder.Append(_topInfix);
                builder.Append(alias);
                builder.Append(_fromOp);
                builder.Append(queryText);
                builder.Append(_asOp);
                builder.Append(alias);
            }

            // Create a new EntitySqlQueryImplementation that uses the new query as its command text.
            // Span is carried over, no adjustment is needed.
            return NewBuilderQuery(query, query.ElementType, builder, query.Span, MergeParameters(query.ObjectContext, query.Parameters, parameters));
        }
Esempio n. 21
0
 public virtual int sp_Attendance(ObjectParameter rMessage)
 {
     return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_Attendance", rMessage));
 }
Esempio n. 22
0
        public virtual int uspAddUser(string iduser, string pUserName, string pPassword, Nullable <int> profile, ObjectParameter responseMessage)
        {
            var iduserParameter = iduser != null ?
                                  new ObjectParameter("iduser", iduser) :
                                  new ObjectParameter("iduser", typeof(string));

            var pUserNameParameter = pUserName != null ?
                                     new ObjectParameter("pUserName", pUserName) :
                                     new ObjectParameter("pUserName", typeof(string));

            var pPasswordParameter = pPassword != null ?
                                     new ObjectParameter("pPassword", pPassword) :
                                     new ObjectParameter("pPassword", typeof(string));

            var profileParameter = profile.HasValue ?
                                   new ObjectParameter("profile", profile) :
                                   new ObjectParameter("profile", typeof(int));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("uspAddUser", iduserParameter, pUserNameParameter, pPasswordParameter, profileParameter, responseMessage));
        }
Esempio n. 23
0
        static void Main(string[] args)
        {
            try
            {
                //first Sample
                CustomerContainer ctx = new CustomerContainer();
                try
                {
                    var outputParameter1 = new ObjectParameter("RESULT", typeof(string));
                    outputParameter1.Value = "";

                    var outputParameter2 = new ObjectParameter("arg_xsd", typeof(string));
                    outputParameter2.Value = "";

                    var outputParameter3 = new ObjectParameter("arg_errnum", typeof(string));
                    outputParameter3.Value = "";

                    var outputParameter4 = new ObjectParameter("arg_errmsg", typeof(string));
                    outputParameter4.Value = "";

                    ctx.GetXmlSubroutine("LIST CUSTOMER", "", outputParameter1, outputParameter2, outputParameter3, outputParameter4);

                    string sXmlData = (string)outputParameter1.Value;
                    string sXsdData = (string)outputParameter2.Value;
                    string sErrNum  = (string)outputParameter3.Value;
                    string sErrMsg  = (string)outputParameter4.Value;

                    Console.WriteLine(sXmlData);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }



                //Second Sample

                // make sure you have subroutine GETCUSTOMER compiled and catalog

                //STEPS

                // 1 . Create a BP directory
                // 2.  ED BP GETCUSTOMER
                // 3.  Cut and paste the following subroutine
                // 4.  BASIC BP GETCUSTOMER
                // 5.  CATALOG BP GETCUSTOMER

                // SUBROUTINE GETCUSTOMER
                //$INCLUDE UNIVERSE.INCLUDE ODBC.H
                //SELSTMT = "SELECT *  FROM CUSTOMER"
                //ST = SQLExecDirect(@HSTMT, SELSTMT)
                //RETURN



                CustomerContainer ctx2 = new CustomerContainer();
                try
                {
                    var             q         = ctx2.GetCustomer();
                    List <CUSTOMER> lCustList = q.ToList();

                    foreach (CUSTOMER item in lCustList)
                    {
                        Console.WriteLine(item.FNAME);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                Console.WriteLine("Enter to exit:");
                string line = Console.ReadLine();
            }
        }
Esempio n. 24
0
        public virtual ObjectResult <pr_productAndCategory_Result> pr_productAndCategory(string productName, string categoryName, Nullable <decimal> unitPrice, Nullable <short> unitsInStock, ObjectParameter prodID)
        {
            var productNameParameter = productName != null ?
                                       new ObjectParameter("ProductName", productName) :
                                       new ObjectParameter("ProductName", typeof(string));

            var categoryNameParameter = categoryName != null ?
                                        new ObjectParameter("CategoryName", categoryName) :
                                        new ObjectParameter("CategoryName", typeof(string));

            var unitPriceParameter = unitPrice.HasValue ?
                                     new ObjectParameter("UnitPrice", unitPrice) :
                                     new ObjectParameter("UnitPrice", typeof(decimal));

            var unitsInStockParameter = unitsInStock.HasValue ?
                                        new ObjectParameter("UnitsInStock", unitsInStock) :
                                        new ObjectParameter("UnitsInStock", typeof(short));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <pr_productAndCategory_Result>("pr_productAndCategory", productNameParameter, categoryNameParameter, unitPriceParameter, unitsInStockParameter, prodID));
        }
Esempio n. 25
0
        public virtual int InsertEmployee(Nullable <int> empNo, string empName, Nullable <int> salary, string deptName, string designation, string empFile, string userName, string password, ObjectParameter result)
        {
            var empNoParameter = empNo.HasValue ?
                                 new ObjectParameter("EmpNo", empNo) :
                                 new ObjectParameter("EmpNo", typeof(int));

            var empNameParameter = empName != null ?
                                   new ObjectParameter("EmpName", empName) :
                                   new ObjectParameter("EmpName", typeof(string));

            var salaryParameter = salary.HasValue ?
                                  new ObjectParameter("Salary", salary) :
                                  new ObjectParameter("Salary", typeof(int));

            var deptNameParameter = deptName != null ?
                                    new ObjectParameter("DeptName", deptName) :
                                    new ObjectParameter("DeptName", typeof(string));

            var designationParameter = designation != null ?
                                       new ObjectParameter("Designation", designation) :
                                       new ObjectParameter("Designation", typeof(string));

            var empFileParameter = empFile != null ?
                                   new ObjectParameter("EmpFile", empFile) :
                                   new ObjectParameter("EmpFile", typeof(string));

            var userNameParameter = userName != null ?
                                    new ObjectParameter("UserName", userName) :
                                    new ObjectParameter("UserName", typeof(string));

            var passwordParameter = password != null ?
                                    new ObjectParameter("Password", password) :
                                    new ObjectParameter("Password", typeof(string));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertEmployee", empNoParameter, empNameParameter, salaryParameter, deptNameParameter, designationParameter, empFileParameter, userNameParameter, passwordParameter, result));
        }
Esempio n. 26
0
        public static void CopyFrom(this DbParameter @this, ObjectParameter from)
        {
            @this.ParameterName = from.Name;

            @this.Value = from.Value ?? DBNull.Value;
        }
Esempio n. 27
0
        public ActionResult AjoutSondage(SondageMultilangue sondageMulti)
        {
            if (!sondageMulti.langue1.langueChoisie)
            {
                foreach (var key in ModelState.Keys.Where(key => key.StartsWith("langue1.")))
                {
                    ModelState[key].Errors.Clear();
                }
            }
            ;

            if (!sondageMulti.langue2.langueChoisie)
            {
                foreach (var key in ModelState.Keys.Where(key => key.StartsWith("langue2.")))
                {
                    ModelState[key].Errors.Clear();
                }
            }
            ;

            if (sondageMulti.langue1.CHOIXSONDAGES == null)
            {
                sondageMulti.langue1.CHOIXSONDAGES = new List <CHOIXSONDAGE>();
            }

            if (sondageMulti.langue2.CHOIXSONDAGES == null)
            {
                sondageMulti.langue2.CHOIXSONDAGES = new List <CHOIXSONDAGE>();
            }


            int l1ChoixCount = sondageMulti.langue1.CHOIXSONDAGES.Count;

            if (l1ChoixCount > sondageMulti.nbChoix)
            {
                sondageMulti.langue1.CHOIXSONDAGES.RemoveRange(sondageMulti.nbChoix, l1ChoixCount - sondageMulti.nbChoix);
            }
            else
            {
                for (int i = l1ChoixCount; i < sondageMulti.nbChoix; i++)
                {
                    sondageMulti.langue1.CHOIXSONDAGES.Add(new CHOIXSONDAGE());
                }
            }


            int l2ChoixCount = sondageMulti.langue2.CHOIXSONDAGES.Count;

            if (l2ChoixCount > sondageMulti.nbChoix)
            {
                sondageMulti.langue2.CHOIXSONDAGES.RemoveRange(sondageMulti.nbChoix, l2ChoixCount - sondageMulti.nbChoix);
            }
            else
            {
                for (int i = l2ChoixCount; i < sondageMulti.nbChoix; i++)
                {
                    sondageMulti.langue2.CHOIXSONDAGES.Add(new CHOIXSONDAGE());
                }
            }


            if (!sondageMulti.langue1.langueChoisie && !sondageMulti.langue2.langueChoisie)
            {
                TempData[Constantes.CLE_MSG_RETOUR] = new Message(Message.TYPE_MESSAGE.ERREUR, Resources.Messages.aucuneLangueErreur);
            }
            else if (ModelState.IsValid && Math.Max(l1ChoixCount, l2ChoixCount) == sondageMulti.nbChoix)
            {
                try
                {
                    SONDAGE sondageFR = null;
                    SONDAGE sondagePT = null;

                    if (sondageMulti.langue1.codeLangue == "FR")
                    {
                        sondageFR = sondageMulti.langue1;
                    }
                    else if (sondageMulti.langue2.codeLangue == "FR")
                    {
                        sondageFR = sondageMulti.langue2;
                    }

                    if (sondageMulti.langue1.codeLangue == "PT")
                    {
                        sondagePT = sondageMulti.langue1;
                    }
                    else if (sondageMulti.langue2.codeLangue == "PT")
                    {
                        sondagePT = sondageMulti.langue2;
                    }

                    ObjectParameter idNouvSondage = new ObjectParameter("idsondage", typeof(int));
                    db.AjouterSondage(sondageFR.NOM ?? "",
                                      sondagePT.NOM ?? "",
                                      sondageFR.QUESTION ?? "",
                                      sondagePT.QUESTION ?? "",
                                      sondageMulti.DATEDEBUT,
                                      sondageMulti.DATEFIN,
                                      WebSecurity.CurrentUserId,
                                      sondageMulti.IDSECTEUR,
                                      idNouvSondage);

                    sondageMulti.IDSONDAGE = (int)idNouvSondage.Value;

                    for (int i = 0; i < sondageMulti.nbChoix; i++)
                    {
                        db.AjouterChoixSondage(sondageMulti.IDSONDAGE,
                                               sondageFR.CHOIXSONDAGES[i].VALEUR ?? "",
                                               sondagePT.CHOIXSONDAGES[i].VALEUR ?? "");
                    }

                    TempData[Constantes.CLE_MSG_RETOUR] = new Message(Message.TYPE_MESSAGE.SUCCES, Resources.Sondages.sondageAjoute);

                    return(RedirectToAction("Sondages", "Sectoriel"));
                }
                catch (Exception ex)
                {
                    TempData[Constantes.CLE_MSG_RETOUR] = new Message(Message.TYPE_MESSAGE.ERREUR, Resources.Sondages.sondageErreur + " (" + ex.GetType() + ")");
                }
            }

            List <SelectListItem> listeNombreChoix = Enumerable.Range(2, 9).Select(e => new SelectListItem {
                Text = e.ToString(), Value = e.ToString()
            }).ToList();

            ViewData[Constantes.CLE_NOMBRE_CHOIX] = listeNombreChoix;

            List <GetSecteurs_Result> listeSecteurs = db.GetSecteursLocalises(Session);

            ViewData[Constantes.CLE_SECTEURS] = listeSecteurs;

            return(View(sondageMulti));
        }
Esempio n. 28
0
        public virtual int spAdministrarActiveGuard(string cSerial, string cCuenta, Nullable <int> nPuesCodigo, string cNumero, Nullable <int> nOperCodigo, string cBateria, string cDescripcion, Nullable <int> nOpcion, ObjectParameter cMensaje)
        {
            var cSerialParameter = cSerial != null ?
                                   new ObjectParameter("cSerial", cSerial) :
                                   new ObjectParameter("cSerial", typeof(string));

            var cCuentaParameter = cCuenta != null ?
                                   new ObjectParameter("cCuenta", cCuenta) :
                                   new ObjectParameter("cCuenta", typeof(string));

            var nPuesCodigoParameter = nPuesCodigo.HasValue ?
                                       new ObjectParameter("nPuesCodigo", nPuesCodigo) :
                                       new ObjectParameter("nPuesCodigo", typeof(int));

            var cNumeroParameter = cNumero != null ?
                                   new ObjectParameter("cNumero", cNumero) :
                                   new ObjectParameter("cNumero", typeof(string));

            var nOperCodigoParameter = nOperCodigo.HasValue ?
                                       new ObjectParameter("nOperCodigo", nOperCodigo) :
                                       new ObjectParameter("nOperCodigo", typeof(int));

            var cBateriaParameter = cBateria != null ?
                                    new ObjectParameter("cBateria", cBateria) :
                                    new ObjectParameter("cBateria", typeof(string));

            var cDescripcionParameter = cDescripcion != null ?
                                        new ObjectParameter("cDescripcion", cDescripcion) :
                                        new ObjectParameter("cDescripcion", typeof(string));

            var nOpcionParameter = nOpcion.HasValue ?
                                   new ObjectParameter("nOpcion", nOpcion) :
                                   new ObjectParameter("nOpcion", typeof(int));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("spAdministrarActiveGuard", cSerialParameter, cCuentaParameter, nPuesCodigoParameter, cNumeroParameter, nOperCodigoParameter, cBateriaParameter, cDescripcionParameter, nOpcionParameter, cMensaje));
        }
Esempio n. 29
0
        public virtual ObjectResult <AirportType> GetAirportTypeSP(AirportType airportType)
        {
            var airportTypeParameter = new ObjectParameter("AirportType", airportType);

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <AirportType>("GetAirportTypeSP", airportTypeParameter));
        }
        public virtual int DodajKontrolnuTackuUceniku(Nullable <int> idUcenika, Nullable <int> idZaposlenog, Nullable <int> idKontrolneTacke, Nullable <short> ocena, ObjectParameter success)
        {
            var idUcenikaParameter = idUcenika.HasValue ?
                                     new ObjectParameter("idUcenika", idUcenika) :
                                     new ObjectParameter("idUcenika", typeof(int));

            var idZaposlenogParameter = idZaposlenog.HasValue ?
                                        new ObjectParameter("idZaposlenog", idZaposlenog) :
                                        new ObjectParameter("idZaposlenog", typeof(int));

            var idKontrolneTackeParameter = idKontrolneTacke.HasValue ?
                                            new ObjectParameter("idKontrolneTacke", idKontrolneTacke) :
                                            new ObjectParameter("idKontrolneTacke", typeof(int));

            var ocenaParameter = ocena.HasValue ?
                                 new ObjectParameter("ocena", ocena) :
                                 new ObjectParameter("ocena", typeof(short));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("DodajKontrolnuTackuUceniku", idUcenikaParameter, idZaposlenogParameter, idKontrolneTackeParameter, ocenaParameter, success));
        }
Esempio n. 31
0
 public ObjectResult <AirportType> GetAirportTypesWithOutputParameter(
     [ParameterType(typeof(AirportType?))] ObjectParameter airportType)
 {
     return(((IObjectContextAdapter)this).ObjectContext
            .ExecuteFunction <AirportType>("GetAirportTypesWithOutputParameter", airportType));
 }
Esempio n. 32
0
        public void EnumField_Query_ESql_Param()
        {
            var entity = new EnumFieldEntity { Value = EnumFieldType.EnumValue1 };
            this.context.EnumFieldEntities.Add(entity);
            this.context.SaveChanges();

            var adapter = this.context as IObjectContextAdapter;
            var objectContext = adapter.ObjectContext;

            var sql = "SELECT VALUE t.Id FROM EnumFieldEntities as t WHERE t.Value == @Value";
            var parameters =
                new ObjectParameter[] {
                    new ObjectParameter("Value", EnumFieldType.EnumValue1)
                };

            var queried = objectContext
                .CreateQuery<object>(sql, parameters)
                .FirstOrDefault();

            queried.Should().NotBeNull();
            queried.Should().Be(entity.Id);
        }
Esempio n. 33
0
 public virtual ObjectResult <int> GetXmlInfo([ParameterType(typeof(string), StoreType = "xml")] ObjectParameter xml)
 {
     return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <int>("GetXmlInfo", xml));
 }
        private static ObjectQueryState BuildSelectOrSelectValue(ObjectQueryState query, string alias, string projection, ObjectParameter[] parameters, string projectOp, Type elementType)
        {
            Debug.Assert(!StringUtil.IsNullOrEmptyOrWhiteSpace(alias), "Invalid alias");
            Debug.Assert(!StringUtil.IsNullOrEmptyOrWhiteSpace(projection), "Invalid projection");

            string queryText = GetCommandText(query);

            // Build the new query string - "<project op> <projection> FROM (<this query>) AS <alias>"
            int queryLength = projectOp.Length +
                              projection.Length +
                              _fromOp.Length +
                              queryText.Length +
                              _asOp.Length +
                              alias.Length;

            StringBuilder builder = new StringBuilder(queryLength);
            builder.Append(projectOp);
            builder.Append(projection);
            builder.Append(_fromOp);
            builder.Append(queryText);
            builder.Append(_asOp);
            builder.Append(alias);

            // Create a new EntitySqlQueryImplementation that uses the new query as its command text.
            // Span should not be carried over from a Select or SelectValue operation.
            return NewBuilderQuery(query, elementType, builder, null, MergeParameters(query.ObjectContext, query.Parameters, parameters));
        }
Esempio n. 35
0
        public async Task <ActionResult> UserRegister(HttpPostedFileBase filename, TBL_USER model)
        {
            if (ModelState.IsValid)
            {
                if (filename != null)
                {
                    string pic  = System.IO.Path.GetExtension(filename.FileName);
                    string name = Guid.NewGuid().ToString() + pic;
                    string path = System.IO.Path.Combine(
                        Server.MapPath("~/Contents/upload/user"), name);
                    // file is uploaded
                    filename.SaveAs(path);
                    model.IMAGE = name;
                }
                ObjectParameter output = new ObjectParameter("V_OUT", typeof(int));

                var enpas = com.EncodePass(model.PASSWORD, "shpud");
                if (model.IMAGE == null)
                {
                    model.IMAGE = "default.jpg";
                }
                model.PASSWORD = enpas;
                //db.P_SET_USER(model.NAME, model.ADDRESS, enpas, model.EMAIL, model.GENDER, model.DOB, model.CONTACT, model.IMAGE, output);

                model.STATUS = "Unverified";
                Random r    = new Random();
                int    num  = r.Next(10000, 999999);
                string link = com.EncodePass(num.ToString(), "token");
                model.TOKEN = num.ToString();
                var email = (from p in db.TBL_USER
                             where p.EMAIL.Equals(model.EMAIL)
                             select new { p.EMAIL }
                             ).FirstOrDefault();  //db.TBL_USER.Where(X => X.EMAIL == model.EMAIL).FirstOrDefault();

                if (email != null)
                {
                    Response.StatusCode = (int)HttpStatusCode.SeeOther;
                    return(Json(new { errorMessage = email.EMAIL })); //"User Email already Registered"
                }
                else
                {
                    //email agr
                    link = "Http://shpud.com/User/Verification/" + link;

                    //var body = "<p>Dear: {0} ({1})</p><p>Please Verify Your Email Address:</p><p>Enter this verification Code: {2}</p><p>Or goto this link: {3}</p><br/><p>Regards,</p><p>Smart Health Prediction. SHPUD</p>";
                    //ContactMail(e);
                    await SendEmail(model.EMAIL, link, model.TOKEN, model.NAME);

                    model.USER_ID = db.TBL_USER.Add(model).USER_ID;
                    if (db.SaveChanges() > 0)
                    {
                        return(Json(new { successMessage = "Successfully Registered!" }));
                    }

                    else
                    {
                        Response.StatusCode = (int)HttpStatusCode.SeeOther;
                        return(Json(new { errorMessage = "Something went wrong!" }));
                    }
                }
            }
            else
            {
                Response.StatusCode = (int)HttpStatusCode.SeeOther;
                return(View(model));
            }
        }
        internal static ObjectQueryState GroupBy(ObjectQueryState query, string alias, string keys, string projection, ObjectParameter[] parameters)
        {
            Debug.Assert(!StringUtil.IsNullOrEmptyOrWhiteSpace(alias), "Invalid alias");
            Debug.Assert(!StringUtil.IsNullOrEmptyOrWhiteSpace(alias), "Invalid keys");
            Debug.Assert(!StringUtil.IsNullOrEmptyOrWhiteSpace(projection), "Invalid projection");

            string queryText = GetCommandText(query);

            // Build the new query string:
            // "SELECT <projection> FROM (<this query>) AS <alias> GROUP BY <keys>"
            int queryLength = _selectOp.Length +
                              projection.Length +
                              _fromOp.Length +
                              queryText.Length +
                              _asOp.Length +
                              alias.Length +
                              _groupByOp.Length +
                              keys.Length;

            StringBuilder builder = new StringBuilder(queryLength);
            builder.Append(_selectOp);
            builder.Append(projection);
            builder.Append(_fromOp);
            builder.Append(queryText);
            builder.Append(_asOp);
            builder.Append(alias);
            builder.Append(_groupByOp);
            builder.Append(keys);

            // Create a new EntitySqlQueryImplementation that uses the new query as its command text.
            // Span should not be carried over from a GroupBy operation.
            return NewBuilderQuery(query, typeof(DbDataRecord), builder, null, MergeParameters(query.ObjectContext, query.Parameters, parameters));
        }
        public virtual ObjectResult <lan_sp_B2B_SubmittedOrdersByAccount_v2_Result> lan_sp_B2B_SubmittedOrdersByAccount_v2(string account, Nullable <int> page, Nullable <int> size, ObjectParameter totalRecords)
        {
            var accountParameter = account != null ?
                                   new ObjectParameter("Account", account) :
                                   new ObjectParameter("Account", typeof(string));

            var pageParameter = page.HasValue ?
                                new ObjectParameter("Page", page) :
                                new ObjectParameter("Page", typeof(int));

            var sizeParameter = size.HasValue ?
                                new ObjectParameter("Size", size) :
                                new ObjectParameter("Size", typeof(int));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <lan_sp_B2B_SubmittedOrdersByAccount_v2_Result>("lan_sp_B2B_SubmittedOrdersByAccount_v2", accountParameter, pageParameter, sizeParameter, totalRecords));
        }
 internal static ObjectQueryState Select(ObjectQueryState query, string alias, string projection, ObjectParameter[] parameters)
 {
     return BuildSelectOrSelectValue(query, alias, projection, parameters, _selectOp, typeof(DbDataRecord));
 }
Esempio n. 39
0
        public List <ViewPart> QueryUnRequestedPartByPage(StocktakeRequest request, Part filter, int pageSize, int pageNumber, out int pageCount, out int itemCount)
        {
            itemCount = DefaultValue.INT;
            //var partQry = this.QueryParts(filter);
            ObjectParameter p = new ObjectParameter("itemCount", itemCount);

            pageCount = (itemCount - 1) / pageSize + 1;
            Context.CommandTimeout = 120;
            int?plantID = null;

            if (filter.Plant != null)
            {
                plantID = filter.Plant.PlantID;
            }
            long?requestID = null;

            if (request != null)
            {
                requestID = request.RequestID;
            }
            List <ViewPart> result = Context.GetUnrequestedParts(requestID, pageSize, pageNumber, p, filter.PartCode, filter.PartChineseName, plantID, filter.FollowUp, filter.Specs).ToList();

            itemCount = (int)p.Value;
            return(result);
            //partQry = this.QueryParts(filter, partQry);
            //partQry = from p in partQry join q in qry on p.PartID equals q.PartID select p;
            //var detailsQry = (from d in Context.View_StocktakeDetails join p in Context.ViewPart on d.PartID equals p.PartID where d.RequestID == request.RequestID select p.PartID).ToList().AsQueryable();
            //var pidQry = partQry.Select(p => p.PartID).ToList().AsQueryable();
            //pidQry = pidQry.Except(detailsQry);

            //partQry = partQry.Where(BuildContainsExpression<ViewPart, int>(p => p.PartID, pidQry.ToList()));

            //partQry = from p in partQry join i in pidQry on p.PartID equals i select p;
            //var qry = from d in Context.Part
            //          select new
            //          {
            //              Part = d,
            //              Details = Context.StocktakeDetails.Where(dt => dt.StocktakeRequest.RequestID == request.RequestID).FirstOrDefault(dt => dt.Part.PartID == d.PartID)
            //          };
            //var partQry1 = this.QueryParts(filter);
            //if (request != null)
            //{
            //    partQry = from v in partQry join p in qry on v.PartID equals p.Part.PartID where p.Details == null select v;//from v in partQry join p in Context.Part.Include("StocktakeDetails") on v.PartID equals p.PartID where p.StocktakeDetails.Count == 0 select v;
            //    //var detailsQry = Context.StocktakeDetails.Where(d => d.StocktakeRequest.RequestID != request.RequestID).Select(d => d.Part).Distinct();
            //    //var detailsPartQry = (from d in Context.StocktakeDetails join p in partQry1 on d.Part.PartID equals p.PartID where d.StocktakeRequest.RequestID != request.RequestID select p).Distinct();
            //    //var detailsQry = Context.View_StocktakeDetails.Where(d => d.RequestID != request.RequestID).Select(d => d.PartID.Value ).Distinct();
            //    //var detailsPartQry = from p in Context.ViewPart join d in detailsQry on p.PartID equals d select p;
            //    //partQry = partQry.Union(detailsPartQry);

            //}

            //if (request != null)
            //{
            //    var detailsQry = Context.StocktakeDetails.AsQueryable();
            //    long requestID = request.RequestID;
            //    //details of request
            //    detailsQry = from d in detailsQry where d.StocktakeRequest.RequestID == requestID select d;

            //    //get parts not in this request
            //    var qry = from p in partQry join d in detailsQry on p.PartID equals d.Part.PartID into detailParts select new { p, cnt=detailParts.Count() };
            //    partQry = qry.Where(pd => pd.cnt == 0).Select(pd => pd.p);
            //    //partQry = (from v in partQry
            //               //join p in pQry
            //               //    on v.PartID equals p.PartID
            //               //select v);
            //}
            // partQry = partQry.OrderBy(p => p.PartCode);
            //var result = (from p in partQry join d in Context.StocktakeDetails on p.PartID equals d.Part.PartID into joinedParts select new { p, Count=joinedParts.Count() }).Where(pd=>pd.Count==0);//from joinedPart in joinedParts.DefaultIfEmpty() select new { p, joinedPart });//
            //partQry = result.Select(pd => pd.p).OrderBy(p => p.PartCode);// result.Where(pd => pd.joinedPart == null).Select(pd => pd.p).OrderBy(p => p.PartCode);

            //return (ObjectQuery<ViewPart>)this.GetQueryByPage(partQry, pageSize, pageNumber, out pageCount, out itemCount);
        }
 internal static ObjectQueryState Skip(ObjectQueryState query, string alias, string keys, string count, ObjectParameter[] parameters)
 {
     Debug.Assert(!StringUtil.IsNullOrEmptyOrWhiteSpace(count), "Invalid skip count");
     return BuildOrderByOrWhere(query, alias, keys, parameters, _orderByOp, count, true);
 }
        public static void procInserirAluguerComCliente()
        {
            try {
                using (var ctx = new TestesSI2Entities())
                {
                    Console.WriteLine("Estes sao os Clientes existentes -------------------\nCODIGO|  NIF   |     NOME   |      MORADA");
                    printClientes(ctx);

                    Console.WriteLine("\nEscolha um dos Clientes (codigo NIF):");
                    niff = Convert.ToInt32(Console.ReadLine());

                    if (niff <= 0)
                    {
                        Console.WriteLine("O NIF que colocou esta incorrecto, volte a tentar");
                        printClientes(ctx);
                    }

                    printQuestoesAluguer();

                    int num = 0;
                    foreach (var i in ctx.Cliente1.Where(x => x.nif == niff).Select(x => x.codigo))
                    {
                        num = i;
                    }

                    printPromocoes(ctx);
                    printQuestoesPromocao();
                    aplicarTempoExtra(ctx);

                    var id = new ObjectParameter("id", 0);
                    tuplos += ctx.InserirAluguerComCliente(Convert.ToDateTime(dI), Convert.ToDateTime(dF), duracaoAlg, numEmp, num, id);

                    Console.WriteLine("ID gerado : " + id.Value);

                    do
                    {
                        printEquipamentos(ctx);
                        Console.WriteLine("Que equipamentos quer adicionar ao Alguer criado ? (Coloque o ID) (para sair pressione -> q)");
                        idEq = Console.ReadLine();

                        if (idEq.Equals("q"))
                        {
                            break;
                        }

                        printEspecificos(ctx);
                        Console.WriteLine("Que equipamentos quer adicionar ao Alguer criado ? (coloque a duracao) ");
                        string aux = Console.ReadLine();

                        if (aux.Equals(""))
                        {
                            break;
                        }
                        duracaoEq = Convert.ToInt32(aux);

                        buscarPreco(ctx);

                        float percentagem = 0;
                        foreach (var row in ctx.BuscarPercentagem(idDesconto, id2Promocoes))
                        {
                            percentagem += Convert.ToInt16(row.Value);
                        }

                        preco = Convert.ToInt32(((100 - percentagem) / 100) * preco);

                        tuplos += ctx.InserirAluguerEquipamentos(Convert.ToDecimal(preco), Convert.ToInt32(id.Value), Convert.ToInt32(idEq));
                    } while (true);
                }
                Console.WriteLine("Adicao concluida, foram afectados " + tuplos + " tuplos");
                Console.ReadKey();
            }catch (Exception ex)
            {
                Console.WriteLine("E R R O : " + ex.InnerException.Message);
                Console.WriteLine("***********************************************************************");
            }
        }
Esempio n. 42
0
        public virtual int P_ISSUE(string p_STUDENT_NAME, Nullable <int> p_SEMESTER, string p_BOOK_NAME, string p_ISSUE_NAME, string p_RETURN_DATE, ObjectParameter v_OUT)
        {
            var p_STUDENT_NAMEParameter = p_STUDENT_NAME != null ?
                                          new ObjectParameter("P_STUDENT_NAME", p_STUDENT_NAME) :
                                          new ObjectParameter("P_STUDENT_NAME", typeof(string));

            var p_SEMESTERParameter = p_SEMESTER.HasValue ?
                                      new ObjectParameter("P_SEMESTER", p_SEMESTER) :
                                      new ObjectParameter("P_SEMESTER", typeof(int));

            var p_BOOK_NAMEParameter = p_BOOK_NAME != null ?
                                       new ObjectParameter("P_BOOK_NAME", p_BOOK_NAME) :
                                       new ObjectParameter("P_BOOK_NAME", typeof(string));

            var p_ISSUE_NAMEParameter = p_ISSUE_NAME != null ?
                                        new ObjectParameter("P_ISSUE_NAME", p_ISSUE_NAME) :
                                        new ObjectParameter("P_ISSUE_NAME", typeof(string));

            var p_RETURN_DATEParameter = p_RETURN_DATE != null ?
                                         new ObjectParameter("P_RETURN_DATE", p_RETURN_DATE) :
                                         new ObjectParameter("P_RETURN_DATE", typeof(string));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("P_ISSUE", p_STUDENT_NAMEParameter, p_SEMESTERParameter, p_BOOK_NAMEParameter, p_ISSUE_NAMEParameter, p_RETURN_DATEParameter, v_OUT));
        }
Esempio n. 43
0
        public virtual int P_REGISTER(string p_BOOK_NAME, string p_AUTHOR_NAME, string p_PUBLISHER_NAME, string p_EDITION, Nullable <int> p_SEMESTER, Nullable <int> p_NUMBER_OF_COPIES, string p_IMAGE, ObjectParameter v_OUT)
        {
            var p_BOOK_NAMEParameter = p_BOOK_NAME != null ?
                                       new ObjectParameter("P_BOOK_NAME", p_BOOK_NAME) :
                                       new ObjectParameter("P_BOOK_NAME", typeof(string));

            var p_AUTHOR_NAMEParameter = p_AUTHOR_NAME != null ?
                                         new ObjectParameter("P_AUTHOR_NAME", p_AUTHOR_NAME) :
                                         new ObjectParameter("P_AUTHOR_NAME", typeof(string));

            var p_PUBLISHER_NAMEParameter = p_PUBLISHER_NAME != null ?
                                            new ObjectParameter("P_PUBLISHER_NAME", p_PUBLISHER_NAME) :
                                            new ObjectParameter("P_PUBLISHER_NAME", typeof(string));

            var p_EDITIONParameter = p_EDITION != null ?
                                     new ObjectParameter("P_EDITION", p_EDITION) :
                                     new ObjectParameter("P_EDITION", typeof(string));

            var p_SEMESTERParameter = p_SEMESTER.HasValue ?
                                      new ObjectParameter("P_SEMESTER", p_SEMESTER) :
                                      new ObjectParameter("P_SEMESTER", typeof(int));

            var p_NUMBER_OF_COPIESParameter = p_NUMBER_OF_COPIES.HasValue ?
                                              new ObjectParameter("P_NUMBER_OF_COPIES", p_NUMBER_OF_COPIES) :
                                              new ObjectParameter("P_NUMBER_OF_COPIES", typeof(int));

            var p_IMAGEParameter = p_IMAGE != null ?
                                   new ObjectParameter("P_IMAGE", p_IMAGE) :
                                   new ObjectParameter("P_IMAGE", typeof(string));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("P_REGISTER", p_BOOK_NAMEParameter, p_AUTHOR_NAMEParameter, p_PUBLISHER_NAMEParameter, p_EDITIONParameter, p_SEMESTERParameter, p_NUMBER_OF_COPIESParameter, p_IMAGEParameter, v_OUT));
        }
Esempio n. 44
0
 private void AddParameter(QueryParameterExpression queryParameter)
 {
     if (null == _parameters)
     {
         _parameters = new List<Tuple<ObjectParameter, QueryParameterExpression>>();
     }
     if (!_parameters.Select(p => p.Item2).Contains(queryParameter))
     {
         var parameter = new ObjectParameter(queryParameter.ParameterReference.ParameterName, queryParameter.Type);
         _parameters.Add(new Tuple<ObjectParameter, QueryParameterExpression>(parameter, queryParameter));
     }
 }
        internal static ObjectQueryState Skip(ObjectQueryState query, string alias, string keys, string count, ObjectParameter[] parameters)
        {
            DebugCheck.NotEmpty(count);

            return BuildOrderByOrWhere(query, alias, keys, parameters, _orderByOp, count, true);
        }