コード例 #1
0
        public static int Set(UserPosting entry, Locale locale, LcDatabase sharedDb = null)
        {
            using (var db = new LcDatabase(sharedDb))
            {
                var neededSpecializationsText  = string.Join(",", entry.neededSpecializationIDs);
                var desiredSpecializationsText = string.Join(",", entry.desiredSpecializationIDs);

                db.Execute("BEGIN TRANSACTION");
                var id = 0;

                if (entry.userPostingID > 0)
                {
                    db.QueryValue(sqlUpdate,
                                  entry.userID,
                                  entry.userPostingID,
                                  entry.title,
                                  neededSpecializationsText,
                                  desiredSpecializationsText
                                  );
                    id = entry.userPostingID;
                    foreach (var qr in entry.questionsResponses)
                    {
                        qr.userPostingID = id;
                        UserPostingQuestionResponse.Update(qr, db);
                    }
                }
                else
                {
                    id = (int)db.QueryValue(sqlInsert,
                                            entry.userID,
                                            entry.solutionID,
                                            entry.postingTemplateID,
                                            entry.statusID,
                                            entry.title,
                                            neededSpecializationsText,
                                            desiredSpecializationsText,
                                            locale.languageID,
                                            locale.countryID,
                                            entry.userID
                                            );
                    foreach (var qr in entry.questionsResponses)
                    {
                        qr.userPostingID = id;
                        UserPostingQuestionResponse.Insert(qr, db);
                    }
                }

                db.Execute("COMMIT TRANSACTION");
                return(id);
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="record"></param>
        /// <param name="fillSpecializations"></param>
        /// <param name="clientRequesterUserID">UserID of a professional that request client information to be filled in</param>
        /// <returns></returns>
        private static UserPosting FromDB(
            dynamic record,
            bool fillSpecializations    = false,
            int clientRequesterUserID   = 0,
            bool fillQuestionsResponses = false)
        {
            if (record == null)
            {
                return(null);
            }

            var neededSpecializations  = ConvertListOfSpecializationIDs(record.neededSpecializationIDs);
            var desiredSpecializations = ConvertListOfSpecializationIDs(record.desiredSpecializationIDs);

            var r = new UserPosting
            {
                userPostingID            = record.userPostingID,
                userID                   = record.userID,
                solutionID               = record.solutionID,
                solutionName             = record.solutionName,
                title                    = record.title,
                statusID                 = (LcEnum.UserPostingStatus)record.statusID,
                createdDate              = record.createdDate,
                updatedDate              = record.updatedDate,
                neededSpecializationIDs  = neededSpecializations,
                desiredSpecializationIDs = desiredSpecializations,
                languageID               = record.languageID,
                countryID                = record.countryID,
                postingTemplateID        = record.postingTemplateID
            };

            if (fillSpecializations)
            {
                r.FillSpecializations();
            }
            if (clientRequesterUserID > 0)
            {
                r.FillClient(clientRequesterUserID);
            }
            if (fillQuestionsResponses)
            {
                r.FillQuestionsResponses();
            }
            return(r);
        }
コード例 #3
0
 public PostingEmailInfo(int userID, int userPostingID, int serviceProfessionalID)
 {
     posting = LcRest.UserPosting.Get(userID, userPostingID, LcData.GetCurrentLanguageID(), LcData.GetCurrentCountryID(), false);
     this.serviceProfessionalID = serviceProfessionalID;
 }