예제 #1
0
        public static Plan_Campaign_Program_Tactic Get_Plan_Campaign_Program_Tactic(int tacticId)
        {
            Plan_Campaign_Program_Tactic objPlan_Campaign_Program_Tactic = new Plan_Campaign_Program_Tactic();

            var obj = db.Plan_Campaign_Program_Tactic.Where(tactic => tactic.IsDeleted == false && tactic.PlanTacticId == tacticId).Select(tactic => tactic).FirstOrDefault();

            objPlan_Campaign_Program_Tactic = obj;

            return(objPlan_Campaign_Program_Tactic);
        }
예제 #2
0
        public void Generate_Custom_Name_With_Tactic_Object()
        {
            Console.WriteLine("To Check Generate custom name with tactic object.\n");
            IntegrationEloquaClient controller = new IntegrationEloquaClient();

            HttpContext.Current = DataHelper.SetUserAndPermission();
            int clientId = ((RevenuePlanner.BDSService.User)(HttpContext.Current.Session["User"])).CID;
            Plan_Campaign_Program_Tactic objTactic = new Plan_Campaign_Program_Tactic();

            objTactic = DataHelper.GetPlanTactic(clientId);
            string result = controller.TestGenerateCustomName(objTactic, clientId);

            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "  : Pass \n The Assert Value result:  " + result);
            Assert.IsTrue(string.IsNullOrEmpty(result));
        }
예제 #3
0
        public void LinkToOtherPlan_with_entityid()
        {
            Console.WriteLine("To check to identify identify the clone type  with entityid,planid.\n");
            HttpContext.Current = DataHelper.SetUserAndPermission();
            RevenuePlanner.Helpers.Clonehelper Clonehelper = new Helpers.Clonehelper();
            MRPEntities db = new MRPEntities();
            Plan_Campaign_Program_Tactic objTactic = new Plan_Campaign_Program_Tactic();
            int UserId = ((RevenuePlanner.BDSService.User)(HttpContext.Current.Session["User"])).ID;
            //string CommaSeparatedPlanId = DataHelper.GetPlanId().ToString();
            //List<int> lstPlanids = CommaSeparatedPlanId.Split(',').ToList().Select(id => Convert.ToInt32(id)).ToList();
            List <int> lstPlanids     = db.Plans.Where(pl => pl.CreatedBy == UserId && pl.IsDeleted == false).Select(pl => pl.PlanId).Take(5).ToList();
            List <int> tactic         = db.Plan_Campaign_Program_Tactic.Where(id => lstPlanids.Contains(id.Plan_Campaign_Program.Plan_Campaign.PlanId)).Select(tactictype => tactictype.PlanTacticId).ToList();
            int        PlanTacticId   = tactic.FirstOrDefault();
            int        ParentEntityId = db.Plan_Campaign_Program_Tactic.Where(tt => tt.PlanTacticId == PlanTacticId).Select(tt => tt.PlanProgramId).FirstOrDefault();
            string     entityId       = lstPlanids.FirstOrDefault().ToString() + "_" + tactic.FirstOrDefault().ToString();
            int        _clone         = Clonehelper.LinkToOtherPlan(null, string.Empty, Convert.ToInt32(entityId.Split('_')[1]), Convert.ToInt32(entityId.Split('_')[0]), ParentEntityId, false);

            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value clone:  " + _clone);
            Assert.AreNotEqual(0, _clone);
        }
예제 #4
0
        public void GetAllCustomFields_With_TacticIds_List()
        {
            Console.WriteLine("To Get All custom fields name with tactic object.\n");
            HttpContext.Current = DataHelper.SetUserAndPermission();
            int clientId = ((RevenuePlanner.BDSService.User)(HttpContext.Current.Session["User"])).CID;
            Plan_Campaign_Program_Tactic objTactic = new Plan_Campaign_Program_Tactic();

            objTactic = DataHelper.GetPlanTactic(clientId);
            List <int> tacticIds = new List <int>();

            tacticIds.Add(objTactic.PlanTacticId);
            List <int> programIds = new List <int>();

            tacticIds.Add(objTactic.PlanProgramId);
            List <int> campaignIds = new List <int>();

            tacticIds.Add(objTactic.Plan_Campaign_Program.PlanCampaignId);
            List <ViewByModel> CustomFields = RevenuePlanner.Helpers.Common.GetCustomFields(tacticIds, programIds, campaignIds);

            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "  : Pass \n The Assert Value CustomFields.Count:  " + CustomFields.Count);
            Assert.IsNotNull(CustomFields.Count);
        }
예제 #5
0
파일: Common.cs 프로젝트: mtikoian/Gameplan
        /// <summary>
        /// Function generate custom name for tactic using abbreviation.
        /// Added by Mitesh Vaishnav on 04/12/2014
        /// #1000 - Custom naming: Campaign name structure
        /// </summary>
        /// <param name="objTactic">Contains details of tactic</param>
        /// <param name="CustomFields">Contains details of custom fields of particular tactic</param>
        /// <returns></returns>
        public static string GenerateCustomName(Plan_Campaign_Program_Tactic objTactic, List <CampaignNameConvention> SequencialOrderedTableList, List <CustomFiledMapping> mappingCustomFields)
        {
            StringBuilder customTacticName = new StringBuilder();
            int           fieldlength;

            if (objTactic != null)
            {
                //Fetch custom name convention sequence
                if (SequencialOrderedTableList != null) //Added by rahul Shah
                {
                    if (SequencialOrderedTableList.Count > 0)
                    {
                        foreach (CampaignNameConvention objCampaignNameConvention in SequencialOrderedTableList)
                        {
                            fieldlength = 0;
                            if (objCampaignNameConvention.CustomNameCharNo.HasValue)
                            {
                                fieldlength = objCampaignNameConvention.CustomNameCharNo.Value;
                            }

                            if (objCampaignNameConvention.TableName == Enums.CustomNamingTables.CustomField.ToString())
                            {
                                var customobj = mappingCustomFields.Where(a => a.CustomFieldId == objCampaignNameConvention.CustomFieldId && a.EntityId == objTactic.PlanTacticId).FirstOrDefault();
                                if (customobj != null)
                                {
                                    // Added by Viral: #2053: Trim/add charcters while generating external name based on configuration
                                    if (fieldlength != 0 && !string.IsNullOrEmpty(customobj.CustomNameValue) && (customobj.CustomNameValue.Length > fieldlength))
                                    {
                                        customobj.CustomNameValue = customobj.CustomNameValue.Substring(0, fieldlength);
                                    }
                                    customTacticName.Append(RemoveSpaceAndUppercaseFirst(customobj.CustomNameValue) + "_");
                                }
                            }
                            else if (objCampaignNameConvention.TableName == Enums.CustomNamingTables.Plan_Campaign_Program_Tactic.ToString())
                            {
                                string tacticTitle = RemoveSpaceAndUppercaseFirst(System.Web.HttpUtility.HtmlDecode(objTactic.Title));
                                // Added by Viral: #2053: Trim/add charcters while generating external name based on configuration
                                if ((fieldlength != 0) && (!string.IsNullOrEmpty(tacticTitle)) && (tacticTitle.Length > fieldlength))
                                {
                                    tacticTitle = tacticTitle.Substring(0, fieldlength);
                                }
                                customTacticName.Append(tacticTitle + "_");
                            }
                            else if (objCampaignNameConvention.TableName == Enums.CustomNamingTables.TacticType.ToString())
                            {
                                string tacticTypeTitle = !string.IsNullOrEmpty(objTactic.TacticType.Abbreviation) ? RemoveSpaceAndUppercaseFirst(objTactic.TacticType.Abbreviation) : RemoveSpaceAndUppercaseFirst(objTactic.TacticType.Title);
                                // Added by Viral: #2053: Trim/add charcters while generating external name based on configuration
                                if (fieldlength != 0 && !string.IsNullOrEmpty(tacticTypeTitle) && (tacticTypeTitle.Length > fieldlength))
                                {
                                    tacticTypeTitle = tacticTypeTitle.Substring(0, fieldlength);
                                }
                                customTacticName.Append(tacticTypeTitle + "_");
                            }
                        }
                        if (customTacticName.ToString().Length > 0)
                        {
                            var index = customTacticName.ToString().LastIndexOf('_');
                            if (index > 0)
                            {
                                customTacticName.Remove(index, 1);
                                string replaceMultipleUnderscore = Regex.Replace(customTacticName.ToString(), "_+", "_");
                                customTacticName.Clear();
                                customTacticName.Append(replaceMultipleUnderscore);
                            }
                        }
                    }
                    else
                    {
                        objTactic.Title = RemoveSpaceAndUppercaseFirst(objTactic.Title);
                        customTacticName.Append(objTactic.Title);
                    }
                }
            }

            return(customTacticName.ToString());
        }