コード例 #1
0
 private static int loadJob(string dir, string code, DateTime dateTime, out AbstractJobConfig config)
 {
     string str;
     config = null;
     int num = dirCheck(dir, code, out str);
     if (num == 0)
     {
         XmlDocument doc = new XmlDocument();
         try
         {
             XmlNode node;
             doc.Load(str);
             XmlAttribute attribute = doc.DocumentElement.Attributes["style"];
             if (((attribute == null) || (attribute.Value == "")) || (attribute.Value == "normal"))
             {
                 NormalConfig config2 = new NormalConfig();
                 num = config2.setDocument(doc);
                 if (num == 0)
                 {
                     config2.setDirectories(dir, GymErrPath, GuidePath);
                     num = config2.selectRecord(dateTime, out node);
                 }
                 config = config2;
                 return num;
             }
             if (attribute.Value == "combi")
             {
                 CombiConfig config3 = new CombiConfig();
                 num = config3.setDocument(doc);
                 if (num == 0)
                 {
                     config3.setDirectories(dir, GymErrPath, GuidePath);
                     for (int i = 0; i < config3.count; i++)
                     {
                         AbstractJobConfig config4;
                         num = createJobConfig(config3.configs[i].code, dateTime, out config4);
                         config3.configs[i].config = config4 as NormalConfig;
                     }
                 }
                 config = config3;
                 return num;
             }
             if (attribute.Value == "divide")
             {
                 DivideConfig config5 = new DivideConfig();
                 num = config5.setDocument(doc);
                 if (num == 0)
                 {
                     config5.setDirectories(dir, GymErrPath, GuidePath);
                     num = config5.selectRecord(dateTime, out node);
                 }
                 config = config5;
                 return num;
             }
             return -6;
         }
         catch (XmlException exception)
         {
             lastError = exception.Message + "\t" + exception.StackTrace;
             return -4;
         }
         catch (Exception exception2)
         {
             lastError = exception2.Message + "\t" + exception2.StackTrace;
             return -99;
         }
     }
     return num;
 }
コード例 #2
0
        public static int createJobConfig(string outcode, out AbstractJobConfig config)
        {
            int num;
            string str4;
            XmlDocument document2;
            config = null;
            string code = outcode.Substring(0, 6);
            if (!int.TryParse(outcode.Substring(6), out num))
            {
                return -10;
            }
            string dir = TemplatePath + @"recv\" + code + @"\";
            int num2 = dirCheck(dir, code, out str4);
            if (num2 != 0)
            {
                code = code.Substring(0, 4);
                dir = TemplatePath + @"recv\" + code + @"\";
                int num3 = dirCheck(dir, code, out str4);
                switch (num3)
                {
                    case 0:
                        goto Label_015D;

                    case -1:
                        return num2;
                }
                return num3;
            }
            XmlDocument document = new XmlDocument();
            try
            {
                document.Load(str4);
                XmlAttribute attribute = document.DocumentElement.Attributes["erase"];
                if ((attribute != null) && (attribute.Value.ToUpper() == "TRUE"))
                {
                    code = code.Substring(0, 4);
                    dir = TemplatePath + @"recv\" + code + @"\";
                    int num4 = dirCheck(dir, code, out str4);
                    switch (num4)
                    {
                        case 0:
                            goto Label_015D;

                        case -1:
                            return -8;
                    }
                    return num4;
                }
            }
            catch (XmlException exception)
            {
                lastError = exception.Message + "\t" + exception.StackTrace;
                return -4;
            }
            catch (Exception exception2)
            {
                lastError = exception2.Message + "\t" + exception2.StackTrace;
                return -99;
            }
        Label_015D:
            document2 = new XmlDocument();
            try
            {
                XmlNode node;
                document2.Load(str4);
                XmlAttribute attribute2 = document2.DocumentElement.Attributes["style"];
                if ((attribute2 == null) || (attribute2.Value == "normal"))
                {
                    NormalConfig config2 = new NormalConfig();
                    num2 = config2.setDocument(document2);
                    if (num2 == 0)
                    {
                        config2.setDirectories(dir, GymErrPath, GuidePath);
                        num2 = config2.selectRecord(num, out node);
                    }
                    config = config2;
                    return num2;
                }
                if ((attribute2.Value == "combi") || (attribute2.Value == "combination"))
                {
                    CombiConfig config3 = new CombiConfig();
                    num2 = config3.setDocument(document2);
                    if (num2 == 0)
                    {
                        config3.setDirectories(dir, GymErrPath, GuidePath);
                    }
                    config = config3;
                    return num2;
                }
                if (attribute2.Value == "divide")
                {
                    DivideConfig config4 = new DivideConfig();
                    num2 = config4.setDocument(document2);
                    if (num2 == 0)
                    {
                        config4.setDirectories(dir, GymErrPath, GuidePath);
                        num2 = config4.selectRecord(num, out node);
                    }
                    config = config4;
                    return num2;
                }
                return -6;
            }
            catch (XmlException exception3)
            {
                lastError = exception3.Message + "\t" + exception3.StackTrace;
                return -4;
            }
            catch (Exception exception4)
            {
                lastError = exception4.Message + "\t" + exception4.StackTrace;
                return -99;
            }
            return num2;
        }
コード例 #3
0
 public static int createJobConfig(string jobcode, string dispcode, DateTime dateTime, out AbstractJobConfig config)
 {
     config = null;
     string dir = TemplatePath + @"send\" + jobcode + @"\" + dispcode + @"\";
     string code = jobcode + dispcode;
     return loadJob(dir, code, dateTime, out config);
 }
コード例 #4
0
ファイル: Print.cs プロジェクト: huamanhtuyen/VNACCS
 public void printTemplate(AbstractJobConfig jobconf, List<string> data, bool previewFlg)
 {
     try
     {
         if (jobconf != null)
         {
             XmlDocument source = null;
             this.mConvMode = 0;
             if (data == null)
             {
                 this.mIsNullData = true;
             }
             if (this.mTimeStamp.Ticks == 0L)
             {
                 this.mTimeStamp = DateTime.Now;
             }
             this.JobConfig = jobconf;
             PrintXml xml = new PrintXml();
             if ((this.mJobConfig.jobStyle == JobStyle.normal) || (this.mJobConfig.jobStyle == JobStyle.combi))
             {
                 string str;
                 if (this.mJobConfig.jobStyle == JobStyle.combi)
                 {
                     this.mJobConfig = ((CombiConfig) this.mJobConfig).configs[1].config;
                 }
                 NormalConfig mJobConfig = (NormalConfig) this.mJobConfig;
                 if (mJobConfig.Print.Trim().Length == 0)
                 {
                     ConvertTemplate template = ConvertTemplate.CreateInstance(true);
                     str = mJobConfig.Display.Trim();
                     if (this.mCustomTemplatePath.Length > 0)
                     {
                         string fileName = Path.GetFileName(str);
                         str = this.mCustomTemplatePath.Trim(new char[] { '\\' }) + @"\" + fileName;
                     }
                     source = template.convertDisplayToReport(str);
                     this.mConvMode = 1;
                 }
                 else
                 {
                     source = new XmlDocument();
                     str = mJobConfig.Print.Trim();
                     if (this.mCustomTemplatePath.Length > 0)
                     {
                         string str3 = Path.GetFileName(str);
                         str = this.mCustomTemplatePath.Trim(new char[] { '\\' }) + @"\" + str3;
                     }
                     source.Load(str);
                     this.mConvMode = 0;
                 }
                 xml.PrintPageNo = 0;
                 xml.ConvertMode = this.mConvMode;
                 xml.JobConf = jobconf;
                 xml.InfoUniqueNo = this.mInputInfo;
                 xml.ServerRecvTime = this.mServerRecvTime;
                 xml.Contained = this.mContained;
                 xml.TimeStamp = this.mTimeStamp;
                 XmlDocument printXml = xml.createPrintXml(source, data);
                 this.execPrint(printXml, previewFlg);
             }
             else if (this.mJobConfig.jobStyle == JobStyle.divide)
             {
                 DivideConfig config2 = (DivideConfig) this.mJobConfig;
                 if (config2.printDivision == null)
                 {
                     throw new NaccsException(MessageKind.Error, 0x25c, Resources.ResourceManager.GetString("COM16"));
                 }
                 source = new XmlDocument();
                 XmlDocument[] documentArray = new XmlDocument[config2.printDivision.count];
                 XmlDocument itemxml = new XmlDocument();
                 itemxml.Load(config2.printDivision.iteminfo);
                 xml.PrintPageNo = 0;
                 for (int i = 0; i < config2.printDivision.count; i++)
                 {
                     string filename = config2.printDivision.templates[i].filename;
                     if (this.mCustomTemplatePath.Length > 0)
                     {
                         string str5 = Path.GetFileName(filename);
                         filename = this.mCustomTemplatePath.Trim(new char[] { '\\' }) + @"\" + str5;
                     }
                     source.Load(filename);
                     xml.ConvertMode = this.mConvMode;
                     xml.JobConf = jobconf;
                     xml.InfoUniqueNo = this.mInputInfo;
                     xml.ServerRecvTime = this.mServerRecvTime;
                     xml.Contained = this.mContained;
                     xml.TimeStamp = this.mTimeStamp;
                     documentArray[i] = xml.createPrintXml(source, itemxml, data);
                 }
                 XmlDocument document4 = documentArray[0];
                 for (int j = 1; j < config2.printDivision.count; j++)
                 {
                     foreach (XmlNode node in documentArray[j].SelectNodes("jobform/layout/page"))
                     {
                         XmlFunc.copyXmlNode(document4.SelectSingleNode("jobform/layout"), node);
                     }
                 }
                 this.execPrint(document4, previewFlg);
             }
         }
     }
     catch (NaccsException)
     {
         throw;
     }
     catch (Exception exception)
     {
         throw new NaccsException(MessageKind.Error, 0x261, exception.Message);
     }
 }
コード例 #5
0
 public static int createJobConfig(string jobcode, DateTime dateTime, out AbstractJobConfig config)
 {
     string str2;
     config = null;
     string dir = TemplatePath + @"send\";
     if (jobcode.Contains("."))
     {
         char[] separator = new char[] { '.' };
         string[] strArray = jobcode.Split(separator);
         string str3 = dir;
         dir = str3 + strArray[0] + @"\" + strArray[1] + @"\";
         str2 = strArray[0] + strArray[1];
     }
     else
     {
         dir = dir + jobcode + @"\";
         str2 = jobcode;
     }
     return loadJob(dir, str2, dateTime, out config);
 }
コード例 #6
0
ファイル: PrintThread.cs プロジェクト: huamanhtuyen/VNACCS
 public void TmThreadPrint(PrintStatus printMode, object sender, string key, int printFlg, AbstractJobConfig jobConfig, IData data, bool previewFlg)
 {
     this.mPrintMode = printMode;
     this.mSender = sender;
     this.mKey = key;
     this.mPrintFlg = printFlg;
     this.mJobConfig = jobConfig;
     this.mData = data;
     this.mPreviewFlg = previewFlg;
     this.ThreadTimer();
 }
コード例 #7
0
ファイル: CommonJobForm.cs プロジェクト: huamanhtuyen/VNACCS
        protected int IsValidJob(AbstractJobConfig config)
        {
            UserEnvironment environment = UserEnvironment.CreateInstance();
            SystemEnvironment environment2 = SystemEnvironment.CreateInstance();
            int num = 0;
            if (config.erase)
            {
                return -8;
            }
            if (!environment2.TerminalInfo.Debug || !environment.DebugFunction.UserKindFlag)
            {
                switch (environment2.TerminalInfo.UserKind)
                {
                    case 1:
                        if (config.general)
                        {
                            return num;
                        }
                        return -8;

                    case 2:
                        if (config.bank)
                        {
                            return num;
                        }
                        return -8;

                    case 3:
                        if (config.center)
                        {
                            return num;
                        }
                        return -8;

                    case 4:
                        if (config.kiosk)
                        {
                            return num;
                        }
                        return -8;
                }
            }
            return num;
        }
コード例 #8
0
ファイル: PrintManager.cs プロジェクト: huamanhtuyen/VNACCS
 private bool isHitCustom(AbstractJobConfig config)
 {
     bool flag = false;
     try
     {
         string directory = config.directory;
         string str3 = directory.ToUpper().Trim(new char[] { '\\' }) + @"\" + (directory.Substring(directory.Trim(new char[] { '\\' }).LastIndexOf('\\')).Trim(new char[] { '\\' }) + ".conf").ToUpper();
         for (int i = 0; i < this.mCustomList.Count; i++)
         {
             string str4 = (string) this.mCustomList[i];
             string str5 = CommaText.CommaTextToItems(str4)[1].ToUpper();
             if (str3.IndexOf(str5) > -1)
             {
                 return true;
             }
         }
     }
     catch
     {
         return flag;
     }
     return flag;
 }
コード例 #9
0
ファイル: PrintManager.cs プロジェクト: huamanhtuyen/VNACCS
 private void GetJobConfig(IData data, out AbstractJobConfig config)
 {
     int errcode = 0;
     string msg = "";
     char[] anyOf = new char[] { 'P', 'A', 'C', 'M' };
     this.mCombi = false;
     if ((data.Header.DataType.Trim().Length > 0) && (data.Header.DataType.IndexOfAny(anyOf) < 0))
     {
         config = null;
     }
     else
     {
         if (this.mJobConfig == null)
         {
             if (data.OutCode.Trim().Length > 0)
             {
                 msg = "Output Information Code[" + data.OutCode.Trim() + "]";
                 errcode = JobConfigFactory.createJobConfig(data.OutCode, out config);
             }
             else if (data.JobCode.Trim().Length > 0)
             {
                 DateTime now = DateTime.Now;
                 if (data.DispCode.Trim().Length == 0)
                 {
                     msg = "Service Code[" + data.JobCode.Trim() + "]";
                     errcode = JobConfigFactory.createJobConfig(data.JobCode.Trim(), now, out config);
                 }
                 else
                 {
                     msg = "Service Code[" + data.JobCode.Trim() + "." + data.DispCode.Trim() + "]";
                     errcode = JobConfigFactory.createJobConfig(data.JobCode.Trim(), data.DispCode.Trim(), now, out config);
                 }
             }
             else
             {
                 config = null;
                 throw new NaccsException(Naccs.Common.MessageKind.Error, 0x25c, Resources.ResourceManager.GetString("CORE77"));
             }
             if (errcode != 0)
             {
                 throw this.ConfigException(msg, errcode);
             }
         }
         else
         {
             config = this.mJobConfig;
             this.mJobConfig = null;
         }
         if (config.jobStyle == JobStyle.combi)
         {
             data.Style = JobStyle.combi;
             data.JobIndex = 1;
             if (data.OutCode.Trim().Length > 0)
             {
                 msg = "Output Information Code[" + data.SubCode.Trim() + "]";
                 errcode = JobConfigFactory.createJobConfig(data.SubCode, out config);
             }
             else
             {
                 try
                 {
                     config = ((CombiConfig) config).configs[1].config;
                 }
                 catch
                 {
                     config = null;
                     throw new NaccsException(Naccs.Common.MessageKind.Error, 0x25b, Resources.ResourceManager.GetString("CORE78"));
                 }
             }
             if (errcode != 0)
             {
                 throw this.ConfigException(msg, errcode);
             }
             this.mCombi = true;
         }
     }
 }
コード例 #10
0
ファイル: PrintManager.cs プロジェクト: huamanhtuyen/VNACCS
 private string GetCustomTempPath(IData data, AbstractJobConfig config)
 {
     string customPath = PathInfo.CreateInstance().CustomPath;
     if ((config == null) || !this.isHitCustom(config))
     {
         return "";
     }
     if (data.OutCode.Trim().Length > 0)
     {
         customPath = customPath.Trim(new char[] { '\\' }) + @"\Recv\";
         if (this.mCombi)
         {
             customPath = customPath + data.SubCode.Substring(0, 6) + @"\" + data.SubCode.Substring(6, 1) + @"\";
         }
         else
         {
             customPath = customPath + data.OutCode.Substring(0, 6) + @"\" + data.OutCode.Substring(6, 1) + @"\";
         }
         if (!Directory.Exists(customPath))
         {
             return "";
         }
     }
     else if (data.JobCode.Trim().Length > 0)
     {
         customPath = customPath.Trim(new char[] { '\\' }) + @"\Send\";
         if (this.mCombi)
         {
             customPath = customPath + data.SubCode.Replace(".", @"\") + @"\";
         }
         else
         {
             customPath = customPath + data.JobCode.Trim() + @"\";
             if (data.DispCode.Trim().Length > 0)
             {
                 customPath = customPath + data.DispCode.Trim() + @"\";
             }
         }
         if (!Directory.Exists(customPath))
         {
             return "";
         }
         string s = "0";
         foreach (string str3 in Directory.GetDirectories(customPath))
         {
             try
             {
                 string str4 = str3.Substring(str3.LastIndexOf('\\')).Trim(new char[] { '\\' });
                 if (int.Parse(str4) > int.Parse(s))
                 {
                     s = str4;
                 }
             }
             catch
             {
             }
         }
         customPath = customPath + s + @"\";
         if (!Directory.Exists(customPath))
         {
             return "";
         }
     }
     if (Directory.GetDirectories(customPath).Length == 0)
     {
         return "";
     }
     return customPath;
 }