public DashboardTarget GetTargetData(string CustomerId, bool IsValue)
        {
            DashboardTarget     objDashboardTarget = new DashboardTarget();
            List <TargetMaster> objTargetMaster    = new List <TargetMaster>();

            using (var context = new ChitaleDBContext())
            {
                objTargetMaster = context.TargetMasters.Where(x => x.CustomerId == CustomerId && x.TargetFromDate.Value.Month == DateTime.Today.Month &&
                                                              x.TargetFromDate.Value.Year == DateTime.Today.Year).ToList();

                if (objTargetMaster != null)
                {
                    if (IsValue)
                    {
                        objDashboardTarget.TargetValueWise  = (decimal)objTargetMaster.Sum(x => x.TargetProductAmt);
                        objDashboardTarget.AchiveValueWise  = 0;
                        objDashboardTarget.TargetVolumeWise = 0;
                        objDashboardTarget.AchiveVolumeWise = 0;
                    }
                    else
                    {
                        objDashboardTarget.TargetVolumeWise = (decimal)objTargetMaster.Sum(x => x.TargetProductVolume);
                        objDashboardTarget.AchiveVolumeWise = 0;
                        objDashboardTarget.TargetValueWise  = 0;
                        objDashboardTarget.AchiveValueWise  = 0;
                    }
                }
            }
            return(objDashboardTarget);
        }
        public List <NoActionParticipantData> GetNoActionParticipantsData(string type, string CustomerId, string CustomerType)
        {
            List <NoActionParticipantData> objData = new List <NoActionParticipantData>();

            using (var context = new ChitaleDBContext())
            {
                try
                {
                    //if (CustomerType == "Sales Executive")
                    //{
                    //    CustomerType = "SalesExecutive";
                    //}
                    //else if (CustomerType == "ASM (Sales Manager)")
                    //{
                    //    CustomerType = "AreaSalesManager";
                    //}
                    //else if (CustomerType == "Sales Officer")
                    //{
                    //    CustomerType = "SalesOfficer";
                    //}
                    //else if (CustomerType == "Sales Representative")
                    //{
                    //    CustomerType = "SalesRepresentative";
                    //}
                    //else if (CustomerType == "State Head")
                    //{
                    //    CustomerType = "StateHead";
                    //}
                    //else if (CustomerType == "Zonal Head")
                    //{
                    //    CustomerType = "ZonalHead";
                    //}
                    //else if (CustomerType == "National Head")
                    //{
                    //    CustomerType = "NationalHead";
                    //}
                    objData = context.Database.SqlQuery <NoActionParticipantData>("Chitale_NoActionByParticipant2 @pi_Date, @pi_CustomerId, @pi_CustomerType,@pi_SelectedType",
                                                                                  new SqlParameter("@pi_Date", DateTime.Now.ToString("yyyy-MM-dd")),
                                                                                  new SqlParameter("@pi_CustomerId", CustomerId),
                                                                                  new SqlParameter("@pi_CustomerType", CustomerType),
                                                                                  new SqlParameter("@pi_SelectedType", type)).ToList <NoActionParticipantData>();

                    foreach (var item in objData)
                    {
                        item.LastInvoiceDateStr = item.LastInvoiceDate.ToString("dd-MM-yyyy");
                        item.BalancePointsStr   = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDouble(item.BalancePoints));
                    }

                    if (objData != null)
                    {
                        objData = objData.OrderBy(x => Convert.ToInt32(x.DaysSinceLastInvoice)).ToList();
                    }
                }
                catch (Exception ex)
                {
                    newexception.AddException(ex);
                }
            }
            return(objData);
        }
        public DashboardLostOpp GetDashboardLostOppData(string CustomerId, bool IsBTD)
        {
            DashboardLostOpp         objDashboardLostOpp  = new DashboardLostOpp();
            List <TransactionMaster> objtransactionmaster = new List <TransactionMaster>();

            using (var context = new ChitaleDBContext())
            {
                if (IsBTD)
                {
                    objtransactionmaster = context.TransactionMasters.Where(x => x.CustomerId == CustomerId).ToList();
                }
                else
                {
                    objtransactionmaster = context.TransactionMasters.Where(x => x.CustomerId == CustomerId && x.OrderDatetime.Value.Month == DateTime.Today.Month &&
                                                                            x.OrderDatetime.Value.Year == DateTime.Today.Year).ToList();
                }
                if (objtransactionmaster != null)
                {
                    objDashboardLostOpp.LateOrder   = (decimal)objtransactionmaster.Where(x => x.TxnType == "Purchase").Sum(x => x.PenaltyPoints);
                    objDashboardLostOpp.CancelOrder = (decimal)objtransactionmaster.Where(x => x.TxnType == "Cancel Order").Sum(x => x.PenaltyPoints);
                    objDashboardLostOpp.TgtVsAch    = (decimal)objtransactionmaster.Where(x => x.TxnType == "tgt vs ach").Sum(x => x.PenaltyPoints);
                    objDashboardLostOpp.SCMOrder    = (decimal)objtransactionmaster.Where(x => x.TxnType == "SCM").Sum(x => x.PenaltyPoints);
                }
            }
            return(objDashboardLostOpp);
        }
        public List <SelectListItem> GetClusterList()
        {
            List <ClusterMaster>  objlist      = new List <ClusterMaster>();
            List <SelectListItem> clusterItems = new List <SelectListItem>();

            try
            {
                using (var context = new ChitaleDBContext())
                {
                    objlist = context.ClusterMasters.OrderBy(s => s.Cluster).ToList();

                    foreach (var item in objlist)
                    {
                        clusterItems.Add(new SelectListItem
                        {
                            Text  = item.Cluster,
                            Value = Convert.ToString(item.SlNo)
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                newexception.AddException(ex);
            }
            return(clusterItems);
        }
        public List <ParticipantListForManagement> GetSubParticipantListForMgt(string Id, string ParticipantType)
        {
            List <ParticipantListForManagement> lstparticipantListsformgt = new List <ParticipantListForManagement>();

            try
            {
                using (var context = new ChitaleDBContext())
                {
                    lstparticipantListsformgt = context.Database.SqlQuery <ParticipantListForManagement>("sp_KYBLoadParticipant_MFC @pi_LoginId, @pi_Datetime, @pi_DataType, @pi_City,@pi_Cluster ,@pi_SubCluster,@pi_Id,@pi_ParticipantType",
                                                                                                         new SqlParameter("@pi_LoginId", ""),
                                                                                                         new SqlParameter("@pi_Datetime", DateTime.Now.ToString("dd-MM-yyyy")),
                                                                                                         new SqlParameter("@pi_DataType", ""),
                                                                                                         new SqlParameter("@pi_City", ""),
                                                                                                         new SqlParameter("@pi_Cluster", ""),
                                                                                                         new SqlParameter("@pi_SubCluster", ""),
                                                                                                         new SqlParameter("@pi_Id", Id),
                                                                                                         new SqlParameter("@pi_ParticipantType", ParticipantType)

                                                                                                         ).ToList <ParticipantListForManagement>();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(lstparticipantListsformgt);
        }
        public List <NoActionParticipantData> GetNoActionParticipantsData(string type, string CustomerId, string CustomerType)
        {
            List <NoActionParticipantData> objData = new List <NoActionParticipantData>();

            using (var context = new ChitaleDBContext())
            {
                try
                {
                    objData = context.Database.SqlQuery <NoActionParticipantData>("Chitale_NoActionByParticipant2 @pi_Date, @pi_CustomerId, @pi_CustomerType,@pi_SelectedType",
                                                                                  new SqlParameter("@pi_Date", DateTime.Now.ToString("yyyy-MM-dd")),
                                                                                  new SqlParameter("@pi_CustomerId", CustomerId),
                                                                                  new SqlParameter("@pi_CustomerType", CustomerType),
                                                                                  new SqlParameter("@pi_SelectedType", type)).ToList <NoActionParticipantData>();

                    foreach (var item in objData)
                    {
                        item.LastInvoiceDateStr = item.LastInvoiceDate.ToString("dd-MM-yyyy");
                    }

                    if (objData != null)
                    {
                        objData = objData.OrderBy(x => Convert.ToInt32(x.DaysSinceLastInvoice)).ToList();
                    }
                }
                catch (Exception ex)
                {
                    newexception.AddException(ex);
                }
            }
            return(objData);
        }
        public List <SelectListItem> GetCityList(int Subcluster)
        {
            List <CityMaster>     objCitylist = new List <CityMaster>();
            List <SelectListItem> CityItems   = new List <SelectListItem>();

            try
            {
                using (var context = new ChitaleDBContext())
                {
                    objCitylist = context.CityMasters.Where(s => s.SubClusterId == Subcluster).ToList();
                    foreach (var item in objCitylist)
                    {
                        CityItems.Add(new SelectListItem
                        {
                            Text  = item.City,
                            Value = Convert.ToString(item.SlNo)
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                newexception.AddException(ex);
            }
            return(CityItems);
        }
        public List <ParticipantListForManagement> GetSubParticipantListForEmp(string Id, string ParticipantType, string CustomerType, string CustomerId)
        {
            List <ParticipantListForManagement> lstparticipantListsformgt = new List <ParticipantListForManagement>();

            try
            {
                //if (CustomerType == "Sales Executive")
                //{
                //    CustomerType = "SalesExecutive";
                //}
                //else if (CustomerType == "ASM (Sales Manager)")
                //{
                //    CustomerType = "AreaSalesManager";
                //}
                //else if (CustomerType == "Sales Officer")
                //{
                //    CustomerType = "SalesOfficer";
                //}
                //else if (CustomerType == "Sales Representative")
                //{
                //    CustomerType = "SalesRepresentative";
                //}
                //else if (CustomerType == "State Head")
                //{
                //    CustomerType = "StateHead";
                //}
                //else if (CustomerType == "Zonal Head")
                //{
                //    CustomerType = "ZonalHead";
                //}
                //else if (CustomerType == "National Head")
                //{
                //    CustomerType = "NationalHead";
                //}
                using (var context = new ChitaleDBContext())
                {
                    lstparticipantListsformgt = context.Database.SqlQuery <ParticipantListForManagement>("sp_KYBParticipant_Emp @pi_LoginId, @pi_Datetime, @pi_CustomerType,@pi_ParticipantId,@pi_ParticipantType",
                                                                                                         new SqlParameter("@pi_LoginId", CustomerId),
                                                                                                         new SqlParameter("@pi_Datetime", DateTime.Now.ToString("dd-MM-yyyy")),
                                                                                                         new SqlParameter("@pi_CustomerType", CustomerType),
                                                                                                         new SqlParameter("@pi_ParticipantId", Id),
                                                                                                         new SqlParameter("@pi_ParticipantType", ParticipantType)

                                                                                                         ).ToList <ParticipantListForManagement>();

                    if (lstparticipantListsformgt != null)
                    {
                        lstparticipantListsformgt = lstparticipantListsformgt.OrderBy(x => x.CurrentRank).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(lstparticipantListsformgt);
        }
        public CustomerDetail GetCustomerDetail(string CustomerId, string CustomerType)
        {
            CustomerDetail objCustomerDetail = new CustomerDetail();

            using (var context = new ChitaleDBContext())
            {
                objCustomerDetail = context.CustomerDetails.Where(x => x.CustomerId == CustomerId && x.CustomerType == CustomerType).FirstOrDefault();
            }
            return(objCustomerDetail);
        }
        public string GetOTP(string MobileNo)
        {
            string OTP = string.Empty;

            using (var context = new ChitaleDBContext())
            {
                OTP = context.OTPMaintenances.Where(x => x.MobileNo == MobileNo).OrderByDescending(z => z.Datetime).Select(y => y.OTP).FirstOrDefault();
            }
            return(OTP);
        }
Exemple #11
0
        public RedemptionValue GetRedeemptionData(string Type)
        {
            RedemptionValue objData = new RedemptionValue();

            using (var context = new ChitaleDBContext())
            {
                objData = context.RedemptionValues.Where(x => x.Status == "00" && x.Type == Type).FirstOrDefault();
            }
            return(objData);
        }
        public string GetNameOfParticipant(string CustomerId)
        {
            string Name = "";

            using (var context = new ChitaleDBContext())
            {
                Name = context.CustomerDetails.Where(x => x.CustomerId == CustomerId).Select(y => y.CustomerName).FirstOrDefault();
            }

            return(Name);
        }
        public List <CustomerDetail> Bottom5Participants(string type)
        {
            List <CustomerDetail> objTop5Participant = new List <CustomerDetail>();

            using (var context = new ChitaleDBContext())
            {
                objTop5Participant = context.CustomerDetails.Where(a => a.CustomerType == type).OrderBy(x => x.Points).Take(5).ToList();
            }

            return(objTop5Participant);
        }
        public List <Top5LostParticipants> GetTop5LostParticipant(string type)
        {
            List <Top5LostParticipants> objTop5Participant = new List <Top5LostParticipants>();

            using (var context = new ChitaleDBContext())
            {
                objTop5Participant = context.Database.SqlQuery <Top5LostParticipants>("sp_GetTop5LostParticipants @pi_CustomerType", new SqlParameter("@pi_CustomerType", type)).ToList <Top5LostParticipants>();
            }

            return(objTop5Participant);
        }
 public void AddException(tblErrorLog objerrorlog)
 {
     using (var context = new ChitaleDBContext())
     {
         try
         {
             context.tblErrorLogs.Add(objerrorlog);
             context.SaveChanges();
         }
         catch (Exception ex)
         {
         }
     }
 }
        public List <Top5TgtVsAchPerformanceEmp> GetTop5TgtVsAchPerformanceEmp(string type, string CustomerId, string CustomerType)
        {
            List <Top5TgtVsAchPerformanceEmp> objTop5TgtVsAchPerformanceEmp = new List <Top5TgtVsAchPerformanceEmp>();

            using (var context = new ChitaleDBContext())
            {
                objTop5TgtVsAchPerformanceEmp = context.Database.SqlQuery <Top5TgtVsAchPerformanceEmp>("sp_GetTgtVsAchEmployee @pi_CustomerType, @pi_CustomerId, @pi_Type",
                                                                                                       new SqlParameter("@pi_CustomerType", type),
                                                                                                       new SqlParameter("@pi_CustomerId", CustomerId),
                                                                                                       new SqlParameter("@pi_Type", CustomerType)).ToList <Top5TgtVsAchPerformanceEmp>();
            }

            return(objTop5TgtVsAchPerformanceEmp);
        }
        public List <TgtvsAchMaster> GetProductData(string CustomerId, string MonthVal, string YearVal)
        {
            List <TgtvsAchMaster> objTgtvsAchMaster = new List <TgtvsAchMaster>();

            using (var context = new ChitaleDBContext())
            {
                if (MonthVal == "" && YearVal == "")
                {
                    objTgtvsAchMaster = context.TgtvsAchMasters.Where(x => x.CustomerId == CustomerId && x.ProductType == "Product" &&
                                                                      x.Date.Value.Month == DateTime.Now.Month && x.Date.Value.Year == DateTime.Now.Year).ToList();
                    foreach (var item in objTgtvsAchMaster)
                    {
                        item.ValuePoints  = null;
                        item.VolumePoints = null;
                    }
                }
                else
                {
                    var month = Convert.ToInt32(MonthVal);
                    var year  = Convert.ToInt32(YearVal);
                    objTgtvsAchMaster = context.TgtvsAchMasters.Where(x => x.CustomerId == CustomerId && x.ProductType == "Product" &&
                                                                      x.Date.Value.Month == month && x.Date.Value.Year == year).ToList();
                    if (DateTime.Now.Month == month && DateTime.Now.Year == year)
                    {
                        foreach (var item in objTgtvsAchMaster)
                        {
                            item.ValuePoints  = null;
                            item.VolumePoints = null;
                        }
                    }
                }
            }
            if (objTgtvsAchMaster != null)
            {
                if (objTgtvsAchMaster.Count > 0)
                {
                    foreach (var item in objTgtvsAchMaster)
                    {
                        item.VolFocusStr = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDecimal(item.VolumeTgt));
                        item.VolAchStr   = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDecimal(item.VolumeAch));
                        item.VolPtsStr   = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDecimal(item.VolumePoints));
                        item.ValFocusStr = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDecimal(item.ValueTgt));
                        item.ValAchStr   = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDecimal(item.ValueAch));
                        item.ValPtsStr   = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDecimal(item.ValuePoints));
                    }
                }
            }
            return(objTgtvsAchMaster);
        }
        public NoActionModelTile GetNoActionParticipantsTilesData(string CustomerId, string CustomerType)
        {
            NoActionModelTile objData = new NoActionModelTile();

            using (var context = new ChitaleDBContext())
            {
                try
                {
                    //if (CustomerType == "Sales Executive")
                    //{
                    //    CustomerType = "SalesExecutive";
                    //}
                    //else if (CustomerType == "ASM (Sales Manager)")
                    //{
                    //    CustomerType = "AreaSalesManager";
                    //}
                    //else if (CustomerType == "Sales Officer")
                    //{
                    //    CustomerType = "SalesOfficer";
                    //}
                    //else if (CustomerType == "Sales Representative")
                    //{
                    //    CustomerType = "SalesRepresentative";
                    //}
                    //else if (CustomerType == "State Head")
                    //{
                    //    CustomerType = "StateHead";
                    //}
                    //else if (CustomerType == "Zonal Head")
                    //{
                    //    CustomerType = "ZonalHead";
                    //}
                    //else if (CustomerType == "National Head")
                    //{
                    //    CustomerType = "NationalHead";
                    //}
                    objData = context.Database.SqlQuery <NoActionModelTile>("Chitale_NoActionByParticipant1 @pi_Date, @pi_CustomerId, @pi_CustomerType",
                                                                            new SqlParameter("@pi_Date", DateTime.Now.ToString("yyyy-MM-dd")),
                                                                            new SqlParameter("@pi_CustomerId", CustomerId),
                                                                            new SqlParameter("@pi_CustomerType", CustomerType)).FirstOrDefault <NoActionModelTile>();
                }
                catch (Exception ex)
                {
                    newexception.AddException(ex);
                }
            }
            return(objData);
        }
        public DashboardParticipantsummary GetSummeryDetails(string CustomerId, string CustomerType, string IsBTD)
        {
            DashboardParticipantsummary objDashboardsummary  = new DashboardParticipantsummary();
            List <TransactionMaster>    objtransactionmaster = new List <TransactionMaster>();

            using (var context = new ChitaleDBContext())
            {
                objDashboardsummary = context.Database.SqlQuery <DashboardParticipantsummary>("sp_DashboardSeg_Participant @pi_CustomerId,@pi_CustomerType,@pi_Date,@pi_BTDType",
                                                                                              new SqlParameter("@pi_CustomerId", CustomerId),
                                                                                              new SqlParameter("@pi_CustomerType", CustomerType),
                                                                                              new SqlParameter("@pi_Date", DateTime.Now.ToString("yyyy-MM-dd")),
                                                                                              new SqlParameter("@pi_BTDType", IsBTD)
                                                                                              ).FirstOrDefault <DashboardParticipantsummary>();
            }
            return(objDashboardsummary);
        }
        public List <ManagementOrderToRavanaPerformance> GetManagementOrderToRavanaPerformance(string type)
        {
            List <ManagementOrderToRavanaPerformance> objdata = new List <ManagementOrderToRavanaPerformance>();

            using (var context = new ChitaleDBContext())
            {
                try
                {
                    objdata = context.Database.SqlQuery <ManagementOrderToRavanaPerformance>("sp_GetOrderToRavanaPerformance @pi_CustomerType", new SqlParameter("@pi_CustomerType", type)).ToList <ManagementOrderToRavanaPerformance>();
                }
                catch (Exception ex)
                {
                }
            }
            return(objdata);
        }
        public ManagementDashboardLostOpp GetManagementDashboardLostOpp(string type)
        {
            ManagementDashboardLostOpp objLostOpp = new ManagementDashboardLostOpp();

            using (var context = new ChitaleDBContext())
            {
                try
                {
                    objLostOpp = context.Database.SqlQuery <ManagementDashboardLostOpp>("sp_GetAvgOrderToRavanaDate @pi_CustomerType", new SqlParameter("@pi_CustomerType", type)).FirstOrDefault <ManagementDashboardLostOpp>();
                }
                catch (Exception ex)
                {
                }
            }
            return(objLostOpp);
        }
        public List <CustomerDetail> Bottom5Participants(string type, string CustomerId, string CustomerType)
        {
            List <CustomerDetail> objTop5Participant = new List <CustomerDetail>();

            using (var context = new ChitaleDBContext())
            {
                try
                {
                    List <string> Ids = new List <string>();
                    if (CustomerType == "SalesExecutive")
                    {
                        Ids = context.SalesmanMappings.Where(x => x.SalesExecutive == CustomerId).Select(y => y.ParticipantId).ToList();
                    }
                    if (CustomerType == "SalesManager")
                    {
                        Ids = context.SalesmanMappings.Where(x => x.AreaSalesManager == CustomerId).Select(y => y.ParticipantId).ToList();
                    }
                    if (CustomerType == "SalesOfficer")
                    {
                        Ids = context.SalesmanMappings.Where(x => x.SalesOfficer == CustomerId).Select(y => y.ParticipantId).ToList();
                    }
                    if (CustomerType == "SalesRepresentative")
                    {
                        Ids = context.SalesmanMappings.Where(x => x.SalesRepresentative == CustomerId).Select(y => y.ParticipantId).ToList();
                    }
                    if (CustomerType == "NationalHead")
                    {
                        Ids = context.SalesmanMappings.Where(x => x.NationalHead == CustomerId).Select(y => y.ParticipantId).ToList();
                    }
                    if (CustomerType == "ZonalHead")
                    {
                        Ids = context.SalesmanMappings.Where(x => x.ZonalHead == CustomerId).Select(y => y.ParticipantId).ToList();
                    }
                    if (CustomerType == "StateHead")
                    {
                        Ids = context.SalesmanMappings.Where(x => x.StateHead == CustomerId).Select(y => y.ParticipantId).ToList();
                    }
                    objTop5Participant = context.CustomerDetails.Where(a => a.CustomerType == type && Ids.Contains(a.CustomerId)).OrderBy(x => x.Points).Take(5).OrderByDescending(y => y.Points).ToList();
                }
                catch (Exception ex)
                {
                    newexception.AddException(ex);
                }
            }

            return(objTop5Participant);
        }
Exemple #23
0
        public List <GenerateOTPList> GenerateOTP(string Type, string CashIncentive, string Infrastructure, string Deposit, string Promotion)
        {
            List <GenerateOTPList> objData = new List <GenerateOTPList>();

            using (var context = new ChitaleDBContext())
            {
                objData = context.Database.SqlQuery <GenerateOTPList>("sp_RedemptionOTP @pi_LoginId, @pi_CashIncentive, @pi_InfraStructure, @pi_Deposit, @pi_Promotion, @pi_Datetime,@pi_Type",
                                                                      new SqlParameter("@pi_LoginId", ""),
                                                                      new SqlParameter("@pi_CashIncentive", CashIncentive),
                                                                      new SqlParameter("@pi_InfraStructure", Infrastructure),
                                                                      new SqlParameter("@pi_Deposit", Deposit),
                                                                      new SqlParameter("@pi_Promotion", Promotion),
                                                                      new SqlParameter("@pi_Datetime", DateTime.Now.ToString("dd-MM-yyyy")),
                                                                      new SqlParameter("@pi_Type", Type)).ToList <GenerateOTPList>();
            }
            return(objData);
        }
        public List <OrderVsRavanaDay> GetOrderVsRavanaDayData(string CustomerId)
        {
            List <OrderVsRavanaDay> objData = new List <OrderVsRavanaDay>();

            using (var context = new ChitaleDBContext())
            {
                try
                {
                    objData = context.OrderVsRavanaDays.Where(x => x.CustomerId == CustomerId).ToList();
                }
                catch (Exception ex)
                {
                    newexception.AddException(ex);
                }
            }

            return(objData);
        }
        public List <ManagementTGTVsACHPerformance> GetManagementTGTVsACHPerformance(string type)
        {
            List <ManagementTGTVsACHPerformance> lstData = new List <ManagementTGTVsACHPerformance>();

            using (var context = new ChitaleDBContext())
            {
                var lstResult = from s in context.CustomerDetails
                                join sa in context.TgtvsAchMasters on s.CustomerId equals sa.CustomerId
                                where sa.CustomerType == type && sa.ProductType == "Over All"
                                select new ManagementTGTVsACHPerformance
                {
                    CustomerName        = s.CustomerName,
                    VolumeAchPercentage = sa.VolumeAchPercentage
                };

                lstData = lstResult.OrderByDescending(x => x.VolumeAchPercentage).Take(5).ToList();
            }
            return(lstData);
        }
Exemple #26
0
        public ChitaleSPResponse ValidateOTP(string Type, string CashIncentive, string Infrastructure, string Deposit, string Promotion, string OTP1, string OTP2)
        {
            ChitaleSPResponse objData = new ChitaleSPResponse();

            using (var context = new ChitaleDBContext())
            {
                objData = context.Database.SqlQuery <ChitaleSPResponse>("sp_RedemptionValues @pi_LoginId, @pi_CashIncentive, @pi_InfraStructure, @pi_Deposit, @pi_Promotion, @pi_Datetime,@pi_Type,@pi_OTPValue1,@pi_OTPValue2",
                                                                        new SqlParameter("@pi_LoginId", ""),
                                                                        new SqlParameter("@pi_CashIncentive", CashIncentive),
                                                                        new SqlParameter("@pi_InfraStructure", Infrastructure),
                                                                        new SqlParameter("@pi_Deposit", Deposit),
                                                                        new SqlParameter("@pi_Promotion", Promotion),
                                                                        new SqlParameter("@pi_Datetime", DateTime.Now.ToString("dd-MM-yyyy")),
                                                                        new SqlParameter("@pi_Type", Type),
                                                                        new SqlParameter("@pi_OTPValue1", OTP1),
                                                                        new SqlParameter("@pi_OTPValue2", OTP2)).FirstOrDefault <ChitaleSPResponse>();
            }
            return(objData);
        }
        public List <ParticipantList> GetParticipantList(string CustomerId, string CustomerType)
        {
            List <ParticipantList> lstparticipantLists = new List <ParticipantList>();

            try
            {
                using (var context = new ChitaleDBContext())
                {
                    lstparticipantLists = context.Database.SqlQuery <ParticipantList>("Chitale_ParticipantList @pi_LoginId, @pi_Datetime, @pi_CustomerId, @pi_CustomerType",
                                                                                      new SqlParameter("@pi_LoginId", ""),
                                                                                      new SqlParameter("@pi_Datetime", DateTime.Now.ToString("yyyy-MM-dd")),
                                                                                      new SqlParameter("@pi_CustomerId", CustomerId),
                                                                                      new SqlParameter("@pi_CustomerType", CustomerType)).ToList <ParticipantList>();



                    if (lstparticipantLists != null)
                    {
                        lstparticipantLists = lstparticipantLists.OrderBy(x => Convert.ToInt32(x.Rank)).ToList();
                    }
                    List <ParticipantList> lstparticipantListsNew = new List <ParticipantList>();
                    foreach (var item in lstparticipantLists)
                    {
                        if (item.Rank == "0")
                        {
                            lstparticipantListsNew.Add(item);
                        }
                    }
                    foreach (var item in lstparticipantListsNew)
                    {
                        lstparticipantLists.Remove(item);
                    }

                    lstparticipantLists.AddRange(lstparticipantListsNew);
                }
            }
            catch (Exception ex)
            {
                newexception.AddException(ex);
            }

            return(lstparticipantLists);
        }
        public NoActionModelTile GetNoActionParticipantsTilesData(string CustomerId, string CustomerType)
        {
            NoActionModelTile objData = new NoActionModelTile();

            using (var context = new ChitaleDBContext())
            {
                try
                {
                    objData = context.Database.SqlQuery <NoActionModelTile>("Chitale_NoActionByParticipant1 @pi_Date, @pi_CustomerId, @pi_CustomerType",
                                                                            new SqlParameter("@pi_Date", DateTime.Now.ToString("yyyy-MM-dd")),
                                                                            new SqlParameter("@pi_CustomerId", CustomerId),
                                                                            new SqlParameter("@pi_CustomerType", CustomerType)).FirstOrDefault <NoActionModelTile>();
                }
                catch (Exception ex)
                {
                    newexception.AddException(ex);
                }
            }
            return(objData);
        }
        public bool RedeemptionRequest(tblRedemptionRequest objRedeem)
        {
            bool status = false;

            using (var context = new ChitaleDBContext())
            {
                try
                {
                    context.tblRedemptionRequests.Add(objRedeem);
                    context.SaveChanges();
                    status = true;
                }
                catch (Exception ex)
                {
                    newexception.AddException(ex);
                }
            }

            return(status);
        }
        public bool GenerateOTP(OTPMaintenance objOTP)
        {
            bool status = false;

            using (var context = new ChitaleDBContext())
            {
                try
                {
                    context.OTPMaintenances.Add(objOTP);
                    context.SaveChanges();
                    status = true;
                }
                catch (Exception ex)
                {
                    newexception.AddException(ex);
                }
            }

            return(status);
        }