using AR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls.WebParts;
using System.Windows.Forms;
using UniMarc.Properties;

namespace UniMarc
{
    public class LoginInfo
    {
        public string UserName { get; set; }
        public string CompanyIdx { get; set; }
        public string CompanyName { get; set; }
    }
    public static class PUB
    {
        public static arUtil.Log log;
        public static UserSetting setting;
        public static LoginInfo user;
        public static void Init()
        {
            #region "Log setting"
            var logsubdir = "{yyyy|MM|dd}";
            string tPath = string.Format("{0}\\LOG", AppDomain.CurrentDomain.BaseDirectory).Replace("\\\\", "\\"); ;
            PUB.log = new arUtil.Log(tPath);
            PUB.log.SubDirectory = logsubdir;
            PUB.log.FileNameFormat = "{yyMMdd}";
            #endregion

            setting = new UserSetting();
            setting.Load();

            user = new LoginInfo();
        }

        /// <summary>
        /// 빈 MARC String 을 생성한다
        /// </summary>
        /// <param name="ISBN13"></param>
        /// <param name="BookName"></param>
        /// <param name="Author"></param>
        /// <param name="Publisher"></param>
        /// <param name="Price"></param>
        /// <returns></returns>
        public static string MakeEmptyMarc(string ISBN13, string BookName, string Author, string Publisher, int Price)
        {
            string yyMMdd = DateTime.Now.ToString("yyMMdd");
            string yyyy = DateTime.Now.ToString("yyyy");
            string Empty_008 = yyMMdd + "s" + yyyy + "                  000   kor  ▲";
            var tag_008 = Empty_008.Replace("▲", "");
            string Empty_text = string.Format(
                "020\t  \t▼a{1}▼c\\{5}▲\n" +
                "056\t  \t▼a▼25▲\n" +
                "100\t  \t▼a{2}▲\n" +
                "245\t  \t▼a{2}▼d{3}▲\n" +
                "260\t  \t▼b{4}▲\n" +
                "300\t  \t▼a▼c▲\n" +
                "653\t  \t▼a▲\n" +
                "700\t  \t▼a▲\n" +
                "950\t  \t▼b\\{5}▲\n",
                Empty_008, ISBN13, BookName, Author, Publisher, Price);
            return Empty_text;
        }
    }


}
