Esempio n. 1
0
    public string GetPageOgTitle()
    {
        string ttid   = GetPageTTID();
        string userid = GetPageUserID();

        if (!string.IsNullOrEmpty(ttid))
        {
            DefectBase d = getDefect();
            if (d != null)
            {
                return(d.SUMMARY.Replace("\"", """).Replace("\'", "'"));
            }
        }
        else if (!string.IsNullOrEmpty(userid))
        {
            return((new MPSUser(userid)).LOGIN + "'s Live Plan");
        }
        else if (!string.IsNullOrEmpty(GetPageVerson()))
        {
            return("Change Log");
        }
        else if (!string.IsNullOrEmpty(GetPageFilter()))
        {
            return(StoredDefectsFilter.GetName(int.Parse(GetPageFilter())));
        }
        else if (!string.IsNullOrEmpty(GetPageTracker()))
        {
            return((new Tracker(int.Parse(GetPageTracker()))).NAME);
        }
        return("");
    }
Esempio n. 2
0
    public BuildRequest getInstallRequest(string machine)
    {
        DefectBuild  b = DefectBuild.GetTask2Build(machine, DefectBuild.BuildType.releasebuild);
        BuildRequest r = new BuildRequest();

        if (b != null)
        {
            DefectBase def  = new DefectBase(Defect.GetTTbyID(b.DEFID));
            DefectUser user = new DefectUser(int.Parse(def.AUSER));
            r.ID   = b.ID;
            r.TTID = def.ID;
            r.COMM = b.NOTES;
            string em = user.EMAIL.Trim();
            if (string.IsNullOrEmpty(em))
            {
                r.USER = "******";
            }
            else
            {
                r.USER = em.Substring(0, em.IndexOf("@")).ToUpper();
            }
            r.SUMMARY = def.SUMMARY;
            r.BRANCH  = def.BRANCH;
        }
        return(r);
    }
Esempio n. 3
0
    protected override void PostStore()
    {
        if (this.IsModified())
        {
            LastGlobalModifier = DateTime.Now;
        }
        if (IsModifiedCol(_AsUser))
        {
            if (!string.IsNullOrEmpty(_reassignedFrom))
            {
                NotifyHub.NotifyPlanChange((new DefectUser(int.Parse(_reassignedFrom)).TRID));
            }

            //when task is reassigned order in new list should be changed.
            DefectBase d = new DefectBase(ID);
            if (d.ORDER != ORDER)
            {
                d.ORDER = ORDER;
                d.Store();
                return;
            }
        }

        if (!string.IsNullOrEmpty(AUSER))
        {
            NotifyHub.NotifyPlanChange((new DefectUser(int.Parse(AUSER)).TRID));
        }
        NotifyHub.NotifyDefectChange(ID);
    }
Esempio n. 4
0
    public void setschedule(List <TTBackOrder> ttids, List <string> unschedule)
    {
        if (!CurrentContext.Valid)
        {
            return;
        }

        foreach (var ttid in unschedule)
        {
            Defect d = new Defect(Convert.ToInt32(ttid));
            d.ORDER = -1;
            d.Store();
        }

        foreach (var ttid in ttids)
        {
            DefectBase d;
            if (ttid.moved)
            {
                d = new Defect(ttid.ttid);                 //will add history record about moving
            }
            else
            {
                d = new DefectBase(ttid.ttid);
            }
            if (d.BACKORDER != ttid.backorder)
            {
                d.BACKORDER = ttid.backorder;
                d.Store();
            }
        }
    }
Esempio n. 5
0
    public List <DefectPlan> getunplanned(string userid)
    {
        CurrentContext.Validate();
        DefectBase d = new DefectBase();

        return(DefectPlan.Convert2Plan(d.EnumUnPlan(string.IsNullOrEmpty(userid) ? CurrentContext.User.TTUSERID : Convert.ToInt32(userid))));
    }
Esempio n. 6
0
    public static void UpdateEDD()
    {
        //one mass update per time
        lock (_lockEDD)
        {
            if (DateTime.Compare(_EDDDate, DefectBase.LastGlobalModifier) > 0)
            {
                return;
            }

            //cache all vacations
            List <DefectBase> vacs = Vacations.EnumCloseVacations(DateTime.Today, 365);

            DefectBase d = new DefectBase();
            foreach (var u in DefectUser.Enum())
            {
                if (!u.ACTIVE)
                {
                    continue;
                }
                string          sid      = u.ID.ToString();
                List <DateTime> vacDates = new List <DateTime>();
                foreach (var v in vacs)
                {
                    if (v.AUSER == sid)
                    {
                        vacDates.Add(DateTime.ParseExact(v.DATE, IdBasedObject.defDateFormat, CultureInfo.InvariantCulture));
                    }
                }

                DateTime dat = DateTime.Today.AddDays(1);

                foreach (var task in d.EnumPlan(u.ID))
                {
                    while (dat.DayOfWeek == DayOfWeek.Saturday || dat.DayOfWeek == DayOfWeek.Sunday)
                    {
                        dat = dat.AddDays(1);
                    }
                    while (vacDates.Exists(x => dat.Date.CompareTo(x) == 0))
                    {
                        dat = dat.AddDays(1);
                    }
                    int hours = Math.Max(task.ESTIM - task.SPENT, 0) + dat.Hour;
                    dat = dat.AddHours(-dat.Hour);
                    int days = hours / 8;
                    hours = hours % 8;
                    dat   = dat.AddDays(days);
                    dat   = dat.AddHours(hours);
                    task.SetEDD(dat.Date);
                }
            }
            _EDDDate = DateTime.Now;
        }
    }
Esempio n. 7
0
    public static List <DefectBase> EnumScheduled(string date, string email)
    {
        DefectsFilter f = new DefectsFilter();

        f.startDateScheduled = date;
        f.endDateScheduled   = DateTime.ParseExact(date, defDateFormat, CultureInfo.InvariantCulture).AddDays(1).ToString(defDateFormat);
        f.orderer            = email;
        DefectBase temp = new DefectBase();

        return(temp.Enum(f, 100));
    }
Esempio n. 8
0
 DefectBase getDefect()
 {
     if (defectedURl == null)
     {
         string ttid = GetPageTTID();
         if (!string.IsNullOrEmpty(ttid))
         {
             defectedURl = new DefectBase(ttid);
         }
     }
     return(defectedURl);
 }
Esempio n. 9
0
    public List <DefectBase> Enum(DefectsFilter f, int maxrecs = 400)
    {
        string where = PrepareQueryForEnum(f, true);
        List <DefectBase> ls = new List <DefectBase>();

        foreach (DataRow r in GetRecords(where, maxrecs))
        {
            DefectBase d = new DefectBase();
            d.Load(r);
            ls.Add(d);
        }
        return(ls);
    }
Esempio n. 10
0
    public int newTask4MeNow(string summary)
    {
        if (string.IsNullOrEmpty(summary))
        {
            return(-1);
        }
        DefectBase d = new DefectBase(Defect.New(summary));

        d.AUSER = CurrentContext.TTUSERID.ToString();
        d.ESTIM = 1;
        d.DISPO = DefectDispo.GetWorkingRec().ToString();
        d.ORDER = 1;
        d.Store();
        return(d.ID);
    }
Esempio n. 11
0
    public List <DefectBase> EnumPlanLim(int userid, int max)    //zero for unlimited number
    {
        string            w_where  = DefectDispo.PlanableDefectFilter();
        string            w_where2 = DefectSeverity.PlanableDefectFilter();
        List <DefectBase> ls       = new List <DefectBase>();

        string where = string.Format(" WHERE (({0} = {1}) AND ({2} is not null) {3} {5}) ORDER BY {4}.{2} DESC", _AsUser, userid, _Order, w_where, _Tabl, w_where2);
        foreach (DataRow r in GetRecords(where, max))
        {
            DefectBase d = new DefectBase();
            d.Load(r);
            d._id = r[_ID].ToString();
            ls.Add(d);
        }
        return(ls);
    }
Esempio n. 12
0
    public List <DefectBase> EnumUnPlan(int userid)
    {
        string            w_where1 = DefectDispo.PlanableDefectFilter();
        string            w_where2 = DefectSeverity.PlanableDefectFilter();
        List <DefectBase> ls       = new List <DefectBase>();

        string where = string.Format(" WHERE (({0} = {1}) AND ({2} is null) {3} {4}) ORDER BY {5} DESC", _AsUser, userid, _Order, w_where1, w_where2, _ID);
        foreach (DataRow r in GetRecords(where))
        {
            DefectBase d = new DefectBase();
            d.Load(r);
            d._id = r[_ID].ToString();
            ls.Add(d);
        }
        return(ls);
    }
Esempio n. 13
0
    public string GetPageOgImage()
    {
        string basepath = HttpContext.Current.Request.Url.Scheme +
                          "://" +
                          HttpContext.Current.Request.Url.Host + ":" +
                          HttpContext.Current.Request.Url.Port.ToString() +
                          HttpContext.Current.Request.ApplicationPath;

        if (!string.IsNullOrEmpty(GetPageVerson()))
        {
            return(basepath + $"/images/vlog.png");
        }
        if (!string.IsNullOrEmpty(GetPageFilter()))
        {
            return(basepath + $"/images/filter.png");
        }
        if (!string.IsNullOrEmpty(GetPageTracker()))
        {
            int idcl = (new Tracker(int.Parse(GetPageTracker()))).IDCLIENT;
            if (idcl > 0)
            {
                return(basepath + "/getUserImg.ashx?ttid=" + idcl.ToString());
            }
            return(basepath + $"/images/tracker.png");
        }
        string userid = GetPageUserID();

        if (userid != "")
        {
            return(basepath + "/getUserImg.ashx?id=" + userid);
        }
        string img = GetPageCustomImg();

        if (!string.IsNullOrEmpty(img))
        {
            return(basepath + $"/images/{img}");
        }

        DefectBase d       = getDefect();
        int        dispoid = -1;

        if (d != null)
        {
            dispoid = int.Parse(d.DISPO);
        }
        return($"{basepath}/getTaskImg.ashx?id={dispoid}");
    }
Esempio n. 14
0
 public DefectPlan(DefectBase db)
 {
     this.ID           = db.ID;
     this.SUMMARY      = db.SUMMARY;
     this.SMODTRID     = db.SMODTRID;
     this.SMODIFIER    = db.SMODIFIER;
     this.DISPO        = int.Parse(db.DISPO);
     this.SPENT        = db.SPENT;
     this.IDREC        = db.IDREC;
     this.ESTIM        = db.ESTIM;
     this.FIRE         = db.FIRE;
     this.VERSION      = db.VERSION;
     this.AUSER        = db.AUSER;
     this.ORDER        = db.ORDER;
     this.EDD          = db.EDD;
     this.PRIMARYESTIM = db.PRIMARYESTIM;
     this.TYPE         = db.TYPE;
 }
Esempio n. 15
0
    public int newTask(string summary)
    {
        if (string.IsNullOrEmpty(summary))
        {
            return(-1);
        }
        DefectBase d = new DefectBase(Defect.New(summary));

        d.ESTIM = 1;
        List <int> disp = DefectDispo.EnumCanStartIDs();

        if (disp.Count > 0)
        {
            d.DISPO = disp[0].ToString();
        }
        d.Store();
        return(d.ID);
    }
Esempio n. 16
0
    string GetPageCustomImg()
    {
        if (HttpContext.Current == null || HttpContext.Current.Request == null)
        {
            return("");
        }
        object o = HttpContext.Current.Request.QueryString[StaticSettings.ogImg];

        if (o == null)
        {
            DefectBase d = getDefect();
            if (d != null && d.FIRE)
            {
                return("taskfire.png");
            }
            return("");
        }
        return(o.ToString());
    }
Esempio n. 17
0
    public static List <DefectBase> EnumModified(string date, string email)
    {
        DefectsFilter f = new DefectsFilter();

        f.startDateModified = date;
        f.endDateModified   = DateTime.ParseExact(date, defDateFormat, CultureInfo.InvariantCulture).AddDays(1).ToString(defDateFormat);
        DefectUser u = DefectUser.FindByEmail(email);

        if (u != null)
        {
            f.modifiedUsers = new List <int>()
            {
                u.ID
            };
        }
        DefectBase temp = new DefectBase();

        return(temp.Enum(f, 100));
    }
Esempio n. 18
0
    public int planTask(string summary, int ttuserid)
    {
        if (string.IsNullOrEmpty(summary))
        {
            return(-1);
        }
        DefectBase d = new DefectBase(Defect.New(summary));

        d.AUSER = ttuserid == -1 ? CurrentContext.TTUSERID.ToString() : ttuserid.ToString();
        d.ESTIM = 1;
        List <int> disp = DefectDispo.EnumCannotStartIDs();

        if (disp.Count > 0)
        {
            d.DISPO = disp[0].ToString();
        }
        d.ORDER = 1;
        d.Store();
        return(d.ID);
    }
Esempio n. 19
0
 protected override void OnChangeColumn(string col, string val)
 {
     if (col == _stat)
     {
         DefectBase db      = new DefectBase(TTID);
         string     ttimg   = "";
         var        st      = GetBuildStatus();
         var        success = !(st == BuildStatus.failed || st == BuildStatus.cancelled);
         if (!success)
         {
             ttimg = FailImage;
         }
         NotifyHub.NotifyBuildStatusChange(ID, TTID, int.Parse(db.AUSER), STATUSTXT, ttimg);
         if (success && db.TYPE != DefectType.DbType().ToString())
         {
             var branch   = db.BRANCH.ToUpper();
             var settings = Settings.CurrentSettings;
             if (branch != "MASTER" && branch != "RELEASE" && !string.IsNullOrEmpty(settings.DATABASEPATTERN))
             {
                 var pattern   = settings.DATABASEPATTERN.ToUpper();
                 var git       = new Git(settings.WORKGITLOCATION);
                 var gitBranch = git.GetBranch(branch);
                 var commits   = gitBranch.EnumCommits(1, 100);
                 foreach (var commit in commits)
                 {
                     var files = commit.EnumFiles();
                     foreach (var file in files)
                     {
                         if (file.Name.ToUpper().Contains(pattern))
                         {
                             NotifyHub.NotifyBuildStatusChange(ID, TTID, int.Parse(db.AUSER), "Build System has detected database changes in task commit. But the task is not marked as requiring database changes. Please update the task! This is a warning message and you do not need to start the build again - only check the task!", FailImage);
                             return;
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 20
0
    static public string Push(string ttid)
    {
        CurrentContext.ValidateAdmin();
        if (!Lock())
        {
            return("Locked by another user!");
        }
        Git           git = getGit();
        List <string> res = new List <string>();

        DefectBase d = new DefectBase(ttid);

        res.AddRange(git.PushOrigin());
        git.DeleteBranch(d.BRANCH);
        res.AddRange(git.Status());

        DefectUser ttu  = new DefectUser(d.AUSER);
        MPSUser    mpu  = new MPSUser(ttu.TRID);
        string     mess = $"Task commit has been pushed to master by {CurrentContext.UserName()}{Settings.CurrentSettings.GetTTAnchor(d.ID, "git-pull-request.png")}";

        TasksBot.SendMessage(mpu.CHATID, mess);
        return(string.Join(Environment.NewLine, res.ToArray()).Replace(Environment.NewLine, "<br/>"));
    }
Esempio n. 21
0
    public string GetPageOgDesc()
    {
        string ttid   = GetPageTTID();
        string userid = GetPageUserID();

        if (!string.IsNullOrEmpty(ttid))
        {
            DefectBase d = getDefect();
            if (d != null)
            {
                string add = "";
                if (!string.IsNullOrEmpty(d.VERSION))
                {
                    add = $", inlcuded into {d.VERSION}";
                }
                return($"{d.GetTaskUserName()} ({d.ESTIM} hrs) - {d.GetTaskDispoName()}{add}");
            }
        }
        else if (!string.IsNullOrEmpty(userid))
        {
            return((new MPSUser(userid)).PERSON_NAME);
        }
        return("Click to see details.");
    }
Esempio n. 22
0
    public void addVacation(string summary, int ttuserid, int num)
    {
        if (string.IsNullOrEmpty(summary) || ttuserid < 1 || num < 1 || num > 100)
        {
            return;
        }
        for (int i = 0; i < num; i++)
        {
            DefectBase d = new DefectBase(Defect.New(summary + " #" + (i + 1).ToString()));
            d.AUSER = ttuserid.ToString();
            d.ESTIM = 8;
            d.COMP  = DefectComp.GetVacationRec()[0].ToString();
            List <int> disp = DefectDispo.EnumCannotStartIDs();
            if (disp.Count > 0)
            {
                d.DISPO = disp[0].ToString();
            }
            d.DATE = new DateTime(DateTime.Now.Year, 12, 31).ToString(defDateFormat);
            d.Store();
        }
        MPSUser mpu = new MPSUser(new DefectUser(ttuserid).TRID);

        TasksBot.SendMessage(mpu.CHATID, $"{num} vacation tasks have been created for you by {CurrentContext.UserName()}");
    }
Esempio n. 23
0
 public DefectEventDefect(int id)
     : base(id)
 {
     DEFECT = new DefectBase(Defect.GetTTbyID(DEFECTID));
 }
Esempio n. 24
0
    private static string ShortenUrl(string url, int max)
    {
        string urlUp = url.ToUpper();

        if (urlUp.Contains(ttident))
        {
            string     ttid = urlUp.Substring(urlUp.IndexOf(ttident) + ttident.Length);
            DefectBase d    = new DefectBase(Convert.ToInt32(ttid));
            return("TT" + ttid + " " + d.SUMMARY);
        }
        if (urlUp.Contains(wikiident))
        {
            string page = urlUp.Substring(urlUp.IndexOf(wikiident) + wikiident.Length);
            return("WIKI: " + page.Replace("_", " ").Replace("#", " - "));
        }
        if (urlUp.Contains(imgident))
        {
            string page = urlUp.Substring(urlUp.IndexOf(wikiident) + wikiident.Length);
            return("Attachment: click to see.");
        }

        if (url.Length <= max)
        {
            return(url);
        }

        // Remove the protocal
        int startIndex = url.IndexOf("://");

        if (startIndex > -1)
        {
            url = url.Substring(startIndex + 3);
        }

        if (url.Length <= max)
        {
            return(url);
        }

        // Remove the folder structure
        int firstIndex = url.IndexOf("/") + 1;
        int lastIndex  = url.LastIndexOf("/");

        if (firstIndex < lastIndex)
        {
            url = url.Replace(url.Substring(firstIndex, lastIndex - firstIndex), "...");
        }

        if (url.Length <= max)
        {
            return(url);
        }

        // Remove URL parameters
        int queryIndex = url.IndexOf("?");

        if (queryIndex > -1)
        {
            url = url.Substring(0, queryIndex);
        }

        if (url.Length <= max)
        {
            return(url);
        }

        // Remove URL fragment
        int fragmentIndex = url.IndexOf("#");

        if (fragmentIndex > -1)
        {
            url = url.Substring(0, fragmentIndex);
        }

        if (url.Length <= max)
        {
            return(url);
        }

        // Shorten page
        firstIndex = url.LastIndexOf("/") + 1;
        lastIndex  = url.LastIndexOf(".");
        if (lastIndex - firstIndex > 10)
        {
            string page   = url.Substring(firstIndex, lastIndex - firstIndex);
            int    length = url.Length - max + 3;
            url = url.Replace(page, "..." + page.Substring(length));
        }

        return(url);
    }
Esempio n. 25
0
    public List <DefectBase> gettasks(DefectsFilter f)
    {
        DefectBase enm = new DefectBase();

        return(enm.Enum(f));
    }
Esempio n. 26
0
 public List <DefectBase> enumUnusedVacations()
 {
     return(DefectBase.EnumUnusedVacations());
 }
Esempio n. 27
0
    protected override void PostStore()
    {
        DefectBase db = new DefectBase(TTID);

        NotifyHub.NotifyBuildChange(ID, TTID, int.Parse(db.AUSER), STATUSTXT);
    }