当前位置: 首页>>代码示例>>C#>>正文


C# Repository.SqlQuery方法代码示例

本文整理汇总了C#中Repository.SqlQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Repository.SqlQuery方法的具体用法?C# Repository.SqlQuery怎么用?C# Repository.SqlQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Repository的用法示例。


在下文中一共展示了Repository.SqlQuery方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetUnReviewdClientsCount

        /// <summary>
        /// Gets the Count ofunreviewd clients.
        /// </summary>
        /// <param name="companyId">The company identifier.</param> 
        /// <param name="searchText"> The searchText </param>
        /// <returns> Result Count.</returns>
        public int GetUnReviewdClientsCount(string companyId, string searchText)
        {
            int count = 0;
            string orgCrmId = this.youfferContactService.GetOrgCRMId(companyId).CRMId;
            try
            {
                using (MySqlContext context = new MySqlContext())
                {
                    IRepository<vtiger_contactdetails> tmp = new Repository<vtiger_contactdetails>(context);
                    count = tmp.SqlQuery<int>("CALL GetUnReviewdClientsCount({0}, {1});", orgCrmId, searchText).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                this.LoggerService.LogException("GetUnReviewdClients :- " + ex.Message);
            }

            return count;
        }
开发者ID:fishonline,项目名称:API-1,代码行数:25,代码来源:OpportunityService.cs

示例2: GetMyClients

        /// <summary>
        /// Gets the clients.
        /// </summary>
        /// <param name="crmOrgId">The company identifier.</param>
        /// <param name="searchText"> THe searchText</param>
        /// <param name="lastpageId">The lastpage identifier.</param>
        /// <param name="fetchCount">The fetch count.</param>
        /// <param name="sortBy">The sort by.</param>
        /// <param name="direction">The direction.</param>
        /// <returns>
        /// List of VtigerPotentialData object.
        /// </returns>
        public List<VtigerPotentialData> GetMyClients(string crmOrgId, string searchText, int lastpageId, int fetchCount, string sortBy, string direction)
        {
            List<VtigerPotentialData> lst = new List<VtigerPotentialData>();

            lastpageId = lastpageId < 1 ? 1 : lastpageId;
            var startVal = (lastpageId - 1) * fetchCount;

            try
            {
                using (MySqlContext context = new MySqlContext())
                {
                    IRepository<vtiger_contactdetails> tmp = new Repository<vtiger_contactdetails>(context);
                    lst = tmp.SqlQuery<VtigerPotentialData>("CALL GetMyClients({0}, {1}, {2}, {3} );", crmOrgId, searchText, startVal, fetchCount).ToList();
                }
            }
            catch (Exception ex)
            {
                this.LoggerService.LogException("GetMyClients :- " + ex.Message);
            }

            return lst;
        }
开发者ID:fishonline,项目名称:API-1,代码行数:34,代码来源:OpportunityService.cs

示例3: GetUnReviewdClients1

        /// <summary>
        /// Gets the unreviewd clients.
        /// </summary>
        /// <param name="companyId">The company identifier.</param>
        /// <param name="searchText"> The searchText </param>
        /// <param name="lastpageId">The last page id. </param>
        /// <param name="fetchCount">The fetch count.</param>
        /// <returns>List of VtigerPotentialData object.</returns>
        public List<VtigerPotentialData> GetUnReviewdClients1(string companyId, string searchText, int lastpageId, int fetchCount)
        {
            lastpageId = lastpageId < 1 ? 1 : lastpageId;
            var startVal = (lastpageId - 1) * fetchCount;

            List<VtigerPotentialData> lst = new List<VtigerPotentialData>();
            string orgCrmId = this.youfferContactService.GetOrgCRMId(companyId).CRMId;

            try
            {
                using (MySqlContext context = new MySqlContext())
                {
                    IRepository<vtiger_contactdetails> tmp = new Repository<vtiger_contactdetails>(context);
                    lst = tmp.SqlQuery<VtigerPotentialData>("CALL GetUnReviewdClients({0}, {1}, {2}, {3} );", orgCrmId, searchText, startVal, fetchCount).ToList();
                }
            }
            catch (Exception ex)
            {
                this.LoggerService.LogException("GetUnReviewdClients :- " + ex.Message);
            }

            return lst;
        }
开发者ID:fishonline,项目名称:API-1,代码行数:31,代码来源:OpportunityService.cs

示例4: UpdateCashBalance

        /// <summary>
        /// Updates the cash balance.
        /// </summary>
        private void UpdateCashBalance()
        {
            try
            {
                using (MySqlContext dbContext = new MySqlContext())
                {
                    IRepository<vtiger_contactdetails> tmp = new Repository<vtiger_contactdetails>(dbContext);
                    var lst = tmp.SqlQuery<UpdateCashBalanceDto>("CALL UpdateCashBalance();").ToList();

                    foreach (var item in lst)
                    {
                        string orgId = string.Empty;
                        string crmUserId;

                        crmUserId = AppSettings.Get<string>(ConfigConstants.OrganisationId) + item.OrgId;
                        var user = this.userService.GetContactByCrmId(crmUserId);
                        if (user != null && !string.IsNullOrWhiteSpace(user.UserName))
                        {
                            orgId = user.Id;
                        }

                        ////Update Organisation's cash balance
                        OrganisationModel org = this.crmManagerService.GetOrganisation(orgId);
                        org.CashBalance += item.CashBalance;
                        this.crmManagerService.UpdateOrganisation(orgId, org);

                        var res = tmp.SqlQuery<int>("CALL UpdateCashBalanceStatus({0});", item.Id).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                this.loggerservice.LogException("UpdateCashBalance:- " + ex.Message);
            }
        }
开发者ID:fishonline,项目名称:API-1,代码行数:38,代码来源:SendNotification.cs

示例5: UpdateCreditBalance

        /// <summary>
        /// Updates the credit balance.
        /// </summary>
        private void UpdateCreditBalance()
        {
            try
            {
                using (MySqlContext dbContext = new MySqlContext())
                {
                    IRepository<vtiger_contactdetails> tmp = new Repository<vtiger_contactdetails>(dbContext);
                    var lst = tmp.SqlQuery<SendUpdateCreditBalanceMessageDto>("CALL SendUpdateCreditBalanceMsgAndNotification();").ToList();

                    foreach (var item in lst)
                    {
                        string orgId = string.Empty;
                        string crmUserId;

                        crmUserId = AppSettings.Get<string>(ConfigConstants.OrganisationId) + item.OrgId;
                        var user = this.userService.GetContactByCrmId(crmUserId);
                        if (user != null && !string.IsNullOrWhiteSpace(user.UserName))
                        {
                            orgId = user.Id;
                        }

                        ////Update Organisation's credit balance
                        OrganisationModel org = this.crmManagerService.GetOrganisation(orgId);
                        org.CreditBalance += item.CreditBalance;
                        this.crmManagerService.UpdateOrganisation(orgId, org);

                        string currency = org.BillCountry.ToLower() == "india" ? "₹" : "$";
                        string amount = currency + item.CreditBalance.ToString("#");

                        ////Send email to the organisation
                        this.authRepository.SendCreditBalanceEmail(orgId, org.AccountName, amount);

                        ////Send message and notification to organisation
                        MessagesDto message = new MessagesDto();
                        message.ModifiedBy = message.FromUser = message.CreatedBy = "YoufferAdmin";
                        message.IsDeleted = false;
                        message.CompanyId = AppSettings.Get<string>(ConfigConstants.SuperUserId);
                        message.UserId = message.ToUser = orgId;
                        message.Name = "Youffer Admin";
                        message.MediaId = 0;

                        MessageTemplatesDto msgTemplate = this.commonService.GetMessageTemplate(MessageTemplateType.UpdateCreditBalanceMsg);
                        msgTemplate.TemplateText = msgTemplate.TemplateText.Replace("{{Amount}}", amount);
                        message.Message = msgTemplate.TemplateText;
                        message = this.youfferMessageService.CreateMessage(message);

                        ////Notifications
                        SignalRHub hub = new SignalRHub();
                        UserBalanceModelDto balance = new UserBalanceModelDto { CashBalance = org.CashBalance, CreditBalance = org.CreditBalance };
                        hub.SendMessage(message.UserId, message);
                        hub.SendCreditUpdateMessage(message.UserId, balance);

                        string gcmId = item.GCMId;
                        string udId = item.UDId;

                        if (!string.IsNullOrEmpty(gcmId))
                        {
                            this.pushMessageService.SendMessageNotificationToAndroid(gcmId, message.Id.ToString(), message.Message, "Youffer", Notification.usermsg.ToString());
                            this.pushMessageService.SendCreditNotificationToAndroid(gcmId, message.Id.ToString(), amount, "Youffer", Notification.updatecreditbal.ToString());
                        }

                        if (!string.IsNullOrEmpty(udId))
                        {
                            int unreadMsgCount = this.youfferMessageService.GetUnreadMsgCount(message.UserId, false);
                            this.pushMessageService.SendMessageNotificationToiOS(udId, message.Id.ToString(), message.Message, "Youffer", unreadMsgCount, Notification.usermsg.ToString());
                            this.pushMessageService.SendCreditNotificationToiOS(udId, message.Id.ToString(), amount, "Youffer", unreadMsgCount, Notification.updatecreditbal.ToString());
                        }

                        var res = tmp.SqlQuery<int>("CALL UpdateCreditBalanceStatus({0});", item.Id).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                this.loggerservice.LogException("UpdateCreditBalance:- " + ex.Message);
            }
        }
开发者ID:fishonline,项目名称:API-1,代码行数:80,代码来源:SendNotification.cs

示例6: SendEnterNeedsMessageAndNotification

        /// <summary>
        /// Sends the enter needs message and notification.
        /// </summary>
        private void SendEnterNeedsMessageAndNotification()
        {
            try
            {
                using (MySqlContext dbContext = new MySqlContext())
                {
                    IRepository<vtiger_contactdetails> tmp = new Repository<vtiger_contactdetails>(dbContext);
                    var lst = tmp.SqlQuery<SendEnterPhoneAndNeedsMessageDto>("CALL SendEnterNeedsMessageAndNotification();").ToList();

                    foreach (var item in lst)
                    {
                        string userId = string.Empty;
                        string crmUserId;

                        crmUserId = AppSettings.Get<string>(ConfigConstants.ContactId) + item.contactId;
                        var user = this.userService.GetContactByCrmId(crmUserId);
                        if (user != null && !string.IsNullOrWhiteSpace(user.UserName))
                        {
                            userId = user.Id;
                        }

                        MessagesDto message = new MessagesDto();
                        message.ModifiedBy = message.FromUser = message.CreatedBy = "YoufferAdmin";
                        message.IsDeleted = false;
                        message.CompanyId = AppSettings.Get<string>(ConfigConstants.SuperUserId);
                        message.UserId = message.ToUser = userId;
                        message.Name = "Youffer Admin";
                        message.MediaId = 0;

                        MessageTemplatesDto msgTemplate = this.commonService.GetMessageTemplate(MessageTemplateType.EnterNeedsMsg);
                        message.Message = msgTemplate.TemplateText;

                        message = this.youfferMessageService.CreateMessage(message);

                        string gcmId = item.GCMId;
                        string udId = item.UDId;

                        if (!string.IsNullOrEmpty(gcmId))
                        {
                            this.pushMessageService.SendMessageNotificationToAndroid(gcmId, message.Id.ToString(), message.Message, "Youffer", Notification.companymsg.ToString());
                        }

                        if (!string.IsNullOrEmpty(udId))
                        {
                            int unreadMsgCount = this.youfferMessageService.GetUnreadMsgCount(message.UserId, false);
                            this.pushMessageService.SendMessageNotificationToiOS(udId, message.Id.ToString(), message.Message, "Youffer", unreadMsgCount, Notification.usermsg.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.loggerservice.LogException("SendEnterNeedsMessageAndNotification:- " + ex.Message);
            }
        }
开发者ID:fishonline,项目名称:API-1,代码行数:58,代码来源:SendNotification.cs

示例7: BroadcastMessageToYoufferInbox

        /// <summary>
        /// Broadcasts the message to youffer inbox.
        /// </summary>
        private void BroadcastMessageToYoufferInbox()
        {
            try
            {
                using (MySqlContext dbContext = new MySqlContext())
                {
                    IRepository<vtiger_contactdetails> tmp = new Repository<vtiger_contactdetails>(dbContext);
                    var lst = tmp.SqlQuery<BroadcastMessageFromCRMDto>("CALL BroadcastMessageToYoufferInbox();").ToList();
                    foreach (var item in lst)
                    {
                        MessagesDto message = new MessagesDto();
                        message.ModifiedBy = message.FromUser = message.CreatedBy = "YoufferAdmin";
                        message.IsDeleted = false;

                        string userId = string.Empty;
                        string crmUserId;
                        if (item.SendTo == "Organizations")
                        {
                            crmUserId = AppSettings.Get<string>(ConfigConstants.OrganisationId) + item.RecId;
                        }
                        else
                        {
                            crmUserId = AppSettings.Get<string>(ConfigConstants.ContactId) + item.RecId;
                        }

                        var user = this.userService.GetContactByCrmId(crmUserId);
                        if (user != null && !string.IsNullOrWhiteSpace(user.UserName))
                        {
                            userId = user.Id;
                        }

                        message.CompanyId = AppSettings.Get<string>(ConfigConstants.SuperUserId);
                        message.UserId = userId;
                        message.ToUser = userId;
                        message.Name = "Youffer Admin";
                        message.MediaId = 0;
                        message.Message = item.Message;

                        message = this.youfferMessageService.CreateMessage(message);

                        string gcmId = item.GCMId;
                        string udId = item.UDId;

                        if (!string.IsNullOrEmpty(gcmId))
                        {
                            this.pushMessageService.SendMessageNotificationToAndroid(gcmId, message.Id.ToString(), message.Message, "Youffer", item.SendTo == "Organizations" ? Notification.usermsg.ToString() : Notification.companymsg.ToString());
                        }

                        if (!string.IsNullOrEmpty(udId))
                        {
                            int unreadMsgCount = this.youfferMessageService.GetUnreadMsgCount(message.UserId, false);
                            this.pushMessageService.SendMessageNotificationToiOS(udId, message.Id.ToString(), message.Message, "Youffer", unreadMsgCount, Notification.usermsg.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.loggerservice.LogException("BroadcastMessageToYoufferInbox:- " + ex.Message);
            }
        }
开发者ID:fishonline,项目名称:API-1,代码行数:64,代码来源:SendNotification.cs

示例8: SendMessageToYoufferInbox

        /// <summary>
        /// Sends the message to youffer inbox.
        /// </summary>
        private void SendMessageToYoufferInbox()
        {
            try
            {
                using (MySqlContext dbContext = new MySqlContext())
                {
                    IRepository<vtiger_contactdetails> tmp = new Repository<vtiger_contactdetails>(dbContext);
                    var lst = tmp.SqlQuery<SendMessageFromCrmDto>("CALL SendMessageToYoufferInbox();").ToList();
                    List<string> succ = new List<string>();
                    List<string> fail = new List<string>();
                    foreach (var item in lst)
                    {
                        MessagesDto message = new MessagesDto();
                        message.ModifiedBy = message.FromUser = message.CreatedBy = "YoufferAdmin";
                        message.IsDeleted = false;

                        string userId = string.Empty;
                        string crmUserId;
                        if (item.setype == "Accounts")
                        {
                            crmUserId = AppSettings.Get<string>(ConfigConstants.OrganisationId) + item.sendmessage_tks_sendto;
                        }
                        else
                        {
                            crmUserId = AppSettings.Get<string>(ConfigConstants.ContactId) + item.sendmessage_tks_sendto;
                        }

                        var user = this.userService.GetContactByCrmId(crmUserId);
                        if (user != null && !string.IsNullOrWhiteSpace(user.UserName))
                        {
                            userId = user.Id;
                        }

                        message.CompanyId = AppSettings.Get<string>(ConfigConstants.SuperUserId);
                        message.UserId = userId;
                        message.ToUser = userId;
                        message.Name = "Youffer Admin";
                        message.MediaId = 0;
                        message.Message = item.sendmessage_tks_message;

                        message = this.youfferMessageService.CreateMessage(message);

                        if (message.Id > 0)
                        {
                            succ.Add(item.sendmessageid.ToString());
                        }
                        else
                        {
                            fail.Add(item.sendmessageid.ToString());
                        }

                        string gcmId = item.GCMId;
                        string udId = item.UDId;

                        if (!string.IsNullOrEmpty(gcmId))
                        {
                            this.loggerservice.LogException("GCMID - " + gcmId);
                            this.pushMessageService.SendMessageNotificationToAndroid(gcmId, message.Id.ToString(), message.Message, "Youffer", item.setype == "Accounts" ? Notification.usermsg.ToString() : Notification.companymsg.ToString());
                        }

                        if (!string.IsNullOrEmpty(udId))
                        {
                            int unreadMsgCount = this.youfferMessageService.GetUnreadMsgCount(message.UserId, false);
                            this.loggerservice.LogException("UDID - " + udId);
                            this.pushMessageService.SendMessageNotificationToiOS(udId, message.Id.ToString(), message.Message, "Youffer", unreadMsgCount, Notification.usermsg.ToString());
                        }
                    }

                    string passresult = succ.Any() ? succ.Aggregate((a, b) => a + "," + b) : string.Empty;
                    string failresult = fail.Any() ? fail.Aggregate((a, b) => a + "," + b) : string.Empty;
                    if (!string.IsNullOrWhiteSpace(passresult) || !string.IsNullOrWhiteSpace(failresult))
                    {
                        var res = tmp.SqlQuery<int>("CALL UpdateMessageStatus({0}, {1});", passresult, failresult).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                this.loggerservice.LogException("SendMessageToYoufferInboxFromCRM:- " + ex.Message);
            }
        }
开发者ID:fishonline,项目名称:API-1,代码行数:84,代码来源:SendNotification.cs


注:本文中的Repository.SqlQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。