public string getProjectDirectoryString()
 {
     if (DatabaseHandler.isNull(project_directory))
     {
         return("");
     }
     return("Project Directory:\n\n" + "<" + project_directory + ">");
 }
 public string getEmailHeader()
 {
     if (DatabaseHandler.isNull(project_number))
     {
         return("");
     }
     return("[" + this.project_number + "] - ");
 }
        public override string SetProperty(CookDBDataContext db, string prop, string value)
        {
            string msg = "";
            bool   add = true;

            if (prop.Equals("hours"))
            {
                decimal h = Decimal.Parse(value);
                if (!h.Equals(this.hours))
                {
                    msg       += this.hours + " -> " + h;
                    this.hours = h;
                }
            }
            else if (prop.Equals("contact_id"))
            {
                if (!DatabaseHandler.isNull(value))
                {
                    int cid = int.Parse(value);
                    if (cid != this.contact_id)
                    {
                        msg += (this.Contact != null ? this.Contact.contact_name : "") + " -> "
                               + Contact.getContactName(db, cid);
                        this.contact_id = cid;
                    }
                }
            }
            else if (prop.Equals("hour_type"))
            {
                int ht = int.Parse(value);
                if (ht != this.hour_type)
                {
                    msg += (this.AssessmentHourType != null ? this.AssessmentHourType.assessment_hour_type : "") + " -> "
                           + db.AssessmentHourTypes.Single(a => a.assessment_hour_type_id == ht).assessment_hour_type;
                    this.hour_type = ht;
                }
            }
            else
            {
                //description
                add = false;
                msg = base.SetProperty(db, prop, value);
            }
            if (add && msg.Length > 0)
            {
                msg = prop + ": " + msg + "\n";
            }
            return(msg);
        }
 public override string SetProperty(CookDBDataContext db, string prop, string value)
 {
     if (prop.Equals("primary"))
     {
         if (!DatabaseHandler.isNull(value))
         {
             bool p = bool.Parse(value);
             if (this.primary != p)
             {
                 string msg = prop + ": " + this.primary + " -> " + p + "\n";
                 this.primary = p;
                 return(msg);
             }
         }
         return("");
     }
     return(base.SetProperty(db, prop, value));
 }
        public override string SetProperty(CookDBDataContext db, string prop, string value)
        {
            string msg = prop + ": ";

            if (prop.Equals("contact_id"))
            {
                if (!DatabaseHandler.isNull(value))
                {
                    int cid = int.Parse(value);
                    if (cid != this.contact_id)
                    {
                        msg += (this.Contact != null ? this.Contact.contact_name : "") + " -> "
                               + Contact.getContactName(db, cid);
                        this.contact_id = cid;
                    }
                }
            }
            return(msg);
        }
        public static IQueryable <ProjectContact> getContactsFromRequest(CookDBDataContext db, HttpRequest req)
        {
            IQueryable <ProjectContact> q = db.ProjectContacts;

            if (!DatabaseHandler.isNull(req.Params.Get("project_id")))
            {
                q = q.Where(a => a.project_id == int.Parse(req.Params.Get("project_id")));
            }

            if (!DatabaseHandler.isNull(req.Params.Get("contact_id")))
            {
                q = q.Where(a => a.contact_id == int.Parse(req.Params.Get("contact_id")));
            }

            if (!DatabaseHandler.isNull(req.Params.Get("contact_type")))
            {
                q = q.Where(a => a.contact_type == int.Parse(req.Params.Get("contact_type")));
            }
            return(q);
        }
Ejemplo n.º 7
0
 public static bool isNull(string str)
 {
     return(DatabaseHandler.isNull(str));
 }