Пример #1
0
        public bool set_task_notes_db(long task_id, long file_id, string content, file_type.ft_type_content type, DateTime ct, DateTime lwt, out string out_notes)
        {
            bool res = false; out_notes = "";

            if (type == file_type.ft_type_content.info)
            {
                db_conn.exec(core.parse_query("lib-notes.set-task-notes", new string[, ] {
                    { "task_id", task_id.ToString() }, { "file_id", file_id.ToString() }
                    , { "ct", ct.ToString("yyyy-MM-dd HH:mm:ss") }, { "lwt", lwt.ToString("yyyy-MM-dd HH:mm:ss") }
                })
                             , pars: new System.Data.Common.DbParameter[] { new SqlParameter("@content", System.Data.SqlDbType.VarChar)
                                                                            {
                                                                                Value = content
                                                                            } });
                out_notes = content; res = true;
            }
            else if (type == file_type.ft_type_content.source)
            {
                string key_from = "###FROM_NOTES###", key_to = "###TO_NOTES###";
                int    from_n = content.IndexOf(key_from), to_n = from_n >= 0 ? content.IndexOf(key_to, from_n + 1) : -1;
                if (from_n >= 0 && to_n > 0)
                {
                    string notes = content.Substring(from_n + key_from.Length, to_n - from_n - key_from.Length - 1).Trim(new char[] { ' ', '\n', '\r' });
                    db_conn.exec(core.parse_query("lib-notes.set-task-notes", new string[, ] {
                        { "task_id", task_id.ToString() }, { "file_id", file_id.ToString() }
                        , { "ct", ct.ToString("yyyy-MM-dd HH:mm:ss") }, { "lwt", lwt.ToString("yyyy-MM-dd HH:mm:ss") }
                    })
                                 , pars: new System.Data.Common.DbParameter[] { new SqlParameter("@content", System.Data.SqlDbType.VarChar)
                                                                                {
                                                                                    Value = notes
                                                                                } });
                    out_notes = notes; res = true;
                }
            }
            return(res);
        }
Пример #2
0
 public bool set_task_notes_db(long task_id, long file_id, string content, file_type.ft_type_content type, DateTime ct, DateTime lwt)
 {
     return(set_task_notes_db(task_id, file_id, content, type, ct, lwt, out string out_notes));
 }