示例#1
0
        public int GetTable(STVPBelWebData param, out DataTable table, out string msg)
        {
            int ret = 0;

            msg   = null;
            table = new DataTable("MAIN");
            try
            {
                using (OracleConnection connet = new OracleConnection(config.connectionstring))
                {
                    connet.Open();
                    if (connet.State != ConnectionState.Open)
                    {
                        log.LogLine(string.Format("No connection to DB Oracle. CS: {0}", config.connectionstring)); return(1);
                    }

                    string query = string.Format("SELECT FileName, SUM(AMOUNT) AS AMOUNT, SUM(FEEAMOUNT) AS COMISSION from Rcd.VALID_BELWEBDATA  group by FileName order by FileName ");

                    OracleCommand     cmd = new OracleCommand(query, connet);
                    OracleDataAdapter da  = new OracleDataAdapter(cmd);
                    da.Fill(table);
                }
            }
            catch (Exception ex) { log.LogLine("CBelWebData.GetTable() " + ex.Message); ret = -1; msg = ex.Message; }
            return(ret);
        }
示例#2
0
        private void StartProc(object sender, DoWorkEventArgs e)
        {
            string msg = null;

            try
            {
                foreach (STFileData file in lst_filedata)
                {
                    if (file.status == 0 || (file.status == 2 && reloadflag))
                    {
                        curr_file = file;

                        if (!read_file(curr_file.filename, out msg))
                        {
                            log.LogLine(msg); lst_filedata = change_status_file(file.filename, 1, msg);
                        }
                        else if (!load_file(sender, e, out msg))
                        {
                            log.LogLine(msg);
                        }
                    }
                }

                if (moveflag)
                {
                    MoveFiles();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.TargetSite + " " + ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
示例#3
0
        public int GetTable(STVPAssistData param, out DataTable table, out string msg)
        {
            int ret = 0;

            msg = null;
            OracleConnection connet = new OracleConnection();

            table = new DataTable("MAIN");

            try
            {
                connet = new OracleConnection(config.connectionstring);
                connet.Open();
                if (connet.State != ConnectionState.Open)
                {
                    log.LogLine(string.Format("No connection to DB Oracle. CS: {0}", config.connectionstring)); return(1);
                }

                string query = string.Format(" SELECT T.FileDate, T.FileName, T.AMOUNT, T.COMISSION , T1.AMOUNT AS Payment, T1.AMOUNT-T.AMOUNT AS NEG FROM " +
                                             " (SELECT FileDate, FileName, SUM(AMOUNT) AS AMOUNT, SUM(COMMISSION) AS COMISSION from Rcd.VALID_ASSISTDATA_CSV  group by FileDate, FileName) T  " +
                                             "LEFT JOIN Rcd.Valid_Payment T1 ON T.FileDate = T1.PDATE order by T.FileDate");

                OracleCommand     cmd = new OracleCommand(query, connet);
                OracleDataAdapter da  = new OracleDataAdapter(cmd);
                da.Fill(table);
            }
            catch (Exception ex) { log.LogLine("CAssistData.GetTable() " + ex.Message); ret = -1; msg = ex.Message; }
            return(ret);
        }
示例#4
0
        public int GetTable(STVPRCPData param, out DataTable table, out string msg)
        {
            int ret = 0;

            msg = null;
            OracleConnection connet = new OracleConnection();

            table = new DataTable("RCPMAIN");

            try
            {
                connet = new OracleConnection(config.connectionstring);
                connet.Open();
                if (connet.State != ConnectionState.Open)
                {
                    log.LogLine(string.Format("No connection to DB Oracle. CS: {0}", config.connectionstring)); return(1);
                }

                string query = string.Format(" SELECT T1.dd,T1.AmountRCP, T2.AmountPC, T1.AmountRCP-T2.AmountPC AS Diff FROM ( SELECT TRUNC(DOCDATE) AS DD, sum(S_DIIS) AS AmountRCP " +
                                             "FROM Rcd.VALID_RCPDATA  WHERE EMTCODETO=300 AND  DOCDATE>=:1 AND DOCDATE<=:2 group by TRUNC(DOCDATE) ) T1 " +
                                             "LEFT JOIN (SELECT PDATE, AMOUNT AS AmountPC FROM Rcd.VALID_AMOUNT_PC WHERE APPCODE=300) T2  ON T1.DD=T2.PDATE order by T1.DD ");

                OracleCommand cmd = new OracleCommand(query, connet);
                cmd.Parameters.Add(crp(OracleType.DateTime, param.dtbegin, "1", false));
                cmd.Parameters.Add(crp(OracleType.DateTime, param.dtend, "2", false));
                OracleDataAdapter da = new OracleDataAdapter(cmd);
                da.Fill(table);
            }
            catch (Exception ex) { log.LogLine("CRcpData.GetTable() " + ex.Message); ret = -1; msg = ex.Message; }
            return(ret);
        }
示例#5
0
        // Drive&Pay
        public List <STValidData> GetData(STValidDataParam viewparam)
        {
            List <STValidData> list_data = new List <STValidData>();

            try
            {
                //  if (viewparam.type == 2) list_data = GetData1(viewparam);
                //  if (viewparam.type == 1) list_data = GetData2(viewparam);
                //  if (viewparam.type == 3) list_data = GetData3(viewparam);
            }
            catch (Exception ex) { log.LogLine(ex.Message); }
            return(list_data);
        }
示例#6
0
        private void StartProc(object sender, DoWorkEventArgs e)
        {
            string msg = null;

            try
            {
                if (!read_file(out msg))
                {
                    log.LogLine(msg); return;
                }
                if (!load_file(sender, e, out msg))
                {
                    log.LogLine(msg);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.TargetSite + " " + ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
示例#7
0
 public void OnFaulted(Exception e)
 {
     XLog.LogLine("Task Exception : " + e.Message);
     Messenger.Default.Send(new DialogContent
     {
         Title   = "Task Exception",
         Content = e.Message
     }, Token);
 }
示例#8
0
        private bool read_file(string FileName, out string msg)
        {
            msg = null;
            int i = 0;

            try
            {
                string FilePath = Path.Combine(inpath, FileName);

                string[] arr_lines = File.ReadAllLines(FilePath);
                // если файл пустой  - ошибка
                if (arr_lines.Length <= 0)
                {
                    msg = "Empty file."; return(false);
                }

                data = new List <STRowPayment>();
                STRowPayment item = new STRowPayment();

                for (i = 0; i < arr_lines.Length; i++)
                {
                    item = new STRowPayment();

                    string[] words = arr_lines[i].Split(';');

                    if (create_row(words[0], words[1], out item, out msg))
                    {
                        data.Add(item);
                    }
                    else
                    {
                        log.LogLine(string.Format("Erorr row's reading {0}, {1})", i, msg));
                    }
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                log.LogLine("File wasn't read.");
                return(false);
            }

            return(true);
        }
        public void HandDebugMessage(string msg)
        {
            string xMsg = DateTime.Now.ToString("HH:mm:ss ffff") + " => " + msg;

            lock (lockObject)
            {
                consoleBuilder.AppendLine(xMsg);
                XLog.LogLine(xMsg);
                ConsoleMsg = consoleBuilder.ToString();
            }
        }
 private void OnDataChanged(DataTable data, BindingList <CellMonitor> items)
 {
     if (data == null || data.Rows.Count <= 0 || data.Columns.Count <= 0)
     {
         if (items.Count > 0)
         {
             OnItemChanged(new CellMonitor[] { }, items);
         }
     }
     else
     {
         int rowCount    = data.Rows.Count;
         int columnCount = data.Columns.Count;
         List <CellMonitor> changedList = new List <CellMonitor>();
         List <CellMonitor> removedList = new List <CellMonitor>();
         for (int i = 0; i < items.Count; i++)
         {
             CellMonitor item = items[i];
             if (item == null)
             {
                 continue;
             }
             var row = data.Select($"{PrimaryKey} = {item.PrimaryKeyValue}");
             if (row == null || row.Length <= 0 || row.Length >= item.ColumnIndex)
             {
                 removedList.Add(item);
             }
             else
             {
                 string newValue = row[0].ItemArray[item.ColumnIndex].ToString();
                 if (!newValue.Equals(item.OriginValue))
                 {
                     item.NewValue = newValue;
                     changedList.Add((CellMonitor)item.Clone());
                     item.OriginValue = newValue;
                 }
                 else
                 {
                     XLog.LogLine($"No change of {item.OriginValue} -> {newValue}.");
                 }
             }
         }
         if (changedList.Count > 0 || removedList.Count > 0)
         {
             OnItemChanged(changedList, removedList);
         }
     }
 }
示例#11
0
        public List <STEmitent> GetData(int trcode)
        {
            List <STEmitent> list_data = new List <STEmitent>();

            STEmitent        item;
            OracleConnection connet = new OracleConnection();

            try
            {
                connet = new OracleConnection(config.connectionstring);
                connet.Open();
                if (connet.State != ConnectionState.Open)
                {
                    log.LogLine(string.Format("No connection to DB Oracle. CS: {0}", config.connectionstring)); return(list_data);
                }

                string query = string.Format("SELECT EmtCode,EmtName,Address,Phone,PostIndex,E_mail,BankCode,Account, " +
                                             "DeptCode,Shifr_OKPO,Shifr_UNN,Shifr_OKED,TransCode,PeriodBeg,PeriodEnd,DirectName," +
                                             "BuchName,CBSCode,ConnectionString,EmtShortName FROM {0}.Emitent WHERE TransCode={1} ORDER BY EmtCode",
                                             "RCD", trcode);

                OracleCommand    cmd    = new OracleCommand(query, connet);
                OracleDataReader reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        item = new STEmitent();

                        item.code      = reader.GetInt32(0);
                        item.name      = reader["EmtName"].ToString().Trim();
                        item.address   = reader["Address"].ToString().Trim();
                        item.phone     = reader["Phone"].ToString().Trim();
                        item.postindex = reader["PostIndex"].ToString().Trim();
                        item.email     = reader["E_mail"].ToString().Trim();
                        if (!reader.IsDBNull(6))
                        {
                            item.bankcode = reader.GetInt32(6);
                        }
                        item.account = reader["Account"].ToString().Trim();
                        if (!reader.IsDBNull(8))
                        {
                            item.deptcode = reader.GetInt32(8);
                        }
                        item.OKPO = reader["Shifr_OKPO"].ToString().Trim();
                        item.UNN  = reader["Shifr_UNN"].ToString().Trim();
                        item.OKED = reader["Shifr_OKED"].ToString().Trim();
                        if (!reader.IsDBNull(12))
                        {
                            item.transcode = reader.GetInt32(12);
                        }
                        if (!reader.IsDBNull(13))
                        {
                            item.periodbegin = reader.GetDateTime(13);
                        }
                        if (!reader.IsDBNull(14))
                        {
                            item.periodend = reader.GetDateTime(14);
                        }
                        item.directname = reader["DirectName"].ToString().Trim();
                        item.buchname   = reader["BuchName"].ToString().Trim();
                        if (!reader.IsDBNull(17))
                        {
                            item.CBScode = reader.GetInt32(17);
                        }
                        if (!reader.IsDBNull(18))
                        {
                            item.c_string = reader.GetString(18);
                        }
                        else
                        {
                            item.c_string = null;
                        }
                        if (!reader.IsDBNull(19))
                        {
                            item.shortname = reader.GetString(19);
                        }
                        else
                        {
                            item.shortname = null;
                        }

                        list_data.Add(item);
                    }
                }

                reader.Dispose();
            }
            catch (Exception ex) { log.LogLine(ex.Message); if (connet.State == ConnectionState.Open)
                                   {
                                       connet.Close();
                                   }
            }

            return(list_data);
        }
示例#12
0
        private bool read_file(out string msg)
        {
            msg = null;

            Excel._Application app = new Excel.Application();

            try
            {
                //  string FilePath = Path.Combine(inpath, FileName);

                Excel._Workbook book = app.Workbooks.Open(FilePath, Missing.Value, Missing.Value,
                                                          Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
                                                          Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
                                                          Missing.Value, Missing.Value);
                Excel.Sheets     sheets = book.Worksheets;
                Excel._Worksheet sheet;

                sheet = (Excel._Worksheet)sheets.get_Item(1);

                Excel.Range range;

                data = new List <STRowUpdateContract>();

                int lastRow = sheet.UsedRange.Rows.Count;

                for (int i = 1; i <= lastRow; i++)
                {
                    range = sheet.get_Range(string.Format("A{0}", i), Missing.Value);
                    if (range.Value2 == null)
                    {
                        continue;
                    }
                    string s = Convert.ToString(range.Value2).Trim();

                    if (!is_d(s))
                    {
                        continue;
                    }
                    else
                    {
                        STRowUpdateContract item = new STRowUpdateContract();

                        range = sheet.get_Range(string.Format("A{0}", i), Missing.Value);
                        if (range.Value2 != null)
                        {
                            item.contrcode = Convert.ToInt32(range.Value2);
                        }
                        else
                        {
                            item.contrcode = -1;
                        }

                        range = sheet.get_Range(string.Format("B{0}", i), Missing.Value);
                        if (range.Value2 != null)
                        {
                            item.mdmcode = Convert.ToString(range.Value2).Trim();
                        }
                        else
                        {
                            item.mdmcode = null;
                        }

                        if (item.contrcode > 0 && !string.IsNullOrEmpty(item.mdmcode))
                        {
                            data.Add(item);
                        }
                    }
                }
                app.Quit();
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                log.LogLine("File wasn't read.");
                return(false);
            }
            finally { app.Quit(); }

            return(true);
        }
示例#13
0
        private void StartProc(object sender, DoWorkEventArgs e)
        {
            string msg = null;

            try
            {
                cr = 0;
                foreach (STFileData file in lst_filedata)
                {
                    if (file.status == 0 || (file.status == 2 && reloadflag))
                    {
                        curr_file = file;
                        //c_date = getfiledate(curr_file.filename);
                        switch (m_app.Code)
                        {
                        case 300:
                        {
                            List <STRowAssistDataCsv> container1 = new List <STRowAssistDataCsv>();
                            if (clAssist.ReadFile(file.filename, out container1, out msg) != 0)
                            {
                                log.LogLine(msg); lst_filedata = change_status_file(file.filename, 1, msg);
                            }
                            else if (load_file1(sender, e, container1, file.filename, out msg) != 0)
                            {
                                log.LogLine(msg);
                            }
                        }
                        break;

                        case 305:
                        {
                            List <BGPBmobileRow> container3 = new List <BGPBmobileRow>();
                            if (clBGPBmobile.ReadFile(file.filename, out container3, out msg) != 0)
                            {
                                log.LogLine(msg); lst_filedata = change_status_file(file.filename, 1, msg);
                            }
                            else if (load_file3(sender, e, container3, out msg) != 0)
                            {
                                log.LogLine(msg);
                            }
                        }
                        break;

                        case 306:
                        {
                            JFile jfile = new JFile();
                            if (clUP.ReadFile(file.filename, out jfile, out msg) != 0)
                            {
                                log.LogLine(msg); lst_filedata = change_status_file(file.filename, 1, msg);
                            }
                            else if (load_file2(sender, e, jfile, file.filename, out msg) != 0)
                            {
                                log.LogLine(msg);
                            }
                        }
                        break;
                        }
                    }

                    cr++;
                }

                if (moveflag)
                {
                    MoveFiles(m_app.PathIN, m_app.PathArch);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.TargetSite + " " + ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
示例#14
0
        private bool read(SqlDataReader reader, out STRowRcpData data, out string msg)
        {
            bool ret = true;

            data = new STRowRcpData();
            msg  = null;
            try
            {
                if (!reader.IsDBNull(0))
                {
                    data.SHIFTDATE = reader.GetDateTime(0);
                }
                if (!reader.IsDBNull(1))
                {
                    data.SALESUM = reader.GetDouble(1);
                }
                if (!reader.IsDBNull(2))
                {
                    data.EMTCODEFRM = reader.GetInt32(2);
                }
                if (!reader.IsDBNull(3))
                {
                    data.AZSCODE = reader.GetInt32(3);
                }
                if (!reader.IsDBNull(4))
                {
                    data.DOCNUMBER = reader.GetInt32(4);
                }
                if (!reader.IsDBNull(5))
                {
                    data.POSNUMBER = reader.GetInt32(5);
                }
                if (!reader.IsDBNull(6))
                {
                    data.DOCDATE = reader.GetDateTime(6);
                }
                if (!reader.IsDBNull(7))
                {
                    data.OPERCODE = reader.GetInt32(7);
                }
                if (!reader.IsDBNull(8))
                {
                    data.REALDOSE = reader.GetDouble(8);
                }
                if (!reader.IsDBNull(9))
                {
                    data.PRICE = reader.GetDouble(9);
                }
                if (!reader.IsDBNull(10))
                {
                    data.CURRCODE = reader.GetInt32(10);
                }
                if (!reader.IsDBNull(11))
                {
                    data.EMTCODETO = reader.GetInt32(11);
                }
                if (!reader.IsDBNull(12))
                {
                    data.VSTYPE = reader.GetInt32(12);
                }
                if (!reader.IsDBNull(13))
                {
                    data.VSCODE = reader.GetInt32(13);
                }
                if (!reader.IsDBNull(14))
                {
                    data.WTCASHTYPE = reader.GetInt32(14);
                }
                if (!reader.IsDBNull(15))
                {
                    data.DESCRIPT = reader.GetString(15);
                }
                if (!reader.IsDBNull(16))
                {
                    data.CARDBANK = reader.GetString(16);
                }
                if (!reader.IsDBNull(17))
                {
                    data.RRN = reader.GetString(17);
                }
                if (!reader.IsDBNull(18))
                {
                    data.S_DIIS = reader.GetDouble(18);
                }
                if (!reader.IsDBNull(19))
                {
                    data.NAMEPRODUCT = reader.GetString(19);
                }
            }
            catch (Exception ex) { log.LogLine("CBookOwner.read() " + ex.Message); msg = ex.Message; ret = false; }
            return(ret);
        }
示例#15
0
 public void OnProcessUpdated()
 {
     XLog.LogLine("ProcessUpdated.");
 }
示例#16
0
        private int GetContainer(STParam param, out List <STDataReest> container, out string msg)
        {
            int ret = 0;

            container = new List <STDataReest>();
            msg       = null;
            OracleConnection connect = new OracleConnection();
            STDataReest      item;

            try
            {
                connect = new OracleConnection(config.connectionstring);
                connect.Open();
                if (connect.State != ConnectionState.Open)
                {
                    log.LogLine(string.Format("No connection to DB Oracle. CS: {0}", config.connectionstring)); return(1);
                }

                string strdate = "ShiftDate";
                if (!param.sh)
                {
                    strdate = "DocDate";
                }

                string query = string.Format("Select RRN, SHIFTDATE, DOCDATE, S_DIIS, PRICE, REALDOSE, NAMEPRODUCT, EMTCODEFRM, AZSCODE ,DOCNUMBER,POSNUMBER, CURRCODE,CARDBANK  FROM Rcd.VALID_RCPDATA " +
                                             "WHERE {0}>=:1 AND {0}<=:2 AND EmtCodeTo=:3 ORDER BY RRN", strdate);

                OracleCommand cmd = new OracleCommand(query, connect);
                cmd.Parameters.Add(crp(OracleType.DateTime, param.dtBegin, "1", false));
                cmd.Parameters.Add(crp(OracleType.DateTime, param.dtEnd, "2", false));
                cmd.Parameters.Add(crp(OracleType.Int32, param.app_code, "3", false));
                OracleDataReader reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        item = new STDataReest();


                        if (!reader.IsDBNull(0))
                        {
                            item.RRN = reader.GetString(0);
                        }
                        if (!reader.IsDBNull(1))
                        {
                            item.ShiftDate = reader.GetDateTime(1);
                        }
                        if (!reader.IsDBNull(2))
                        {
                            item.DocDate = reader.GetDateTime(2);
                        }
                        if (!reader.IsDBNull(3))
                        {
                            item.Amount = reader.GetDouble(3);
                        }
                        if (!reader.IsDBNull(4))
                        {
                            item.Price = reader.GetDouble(4);
                        }
                        if (!reader.IsDBNull(5))
                        {
                            item.Quantity = reader.GetDouble(5);
                        }
                        if (!reader.IsDBNull(6))
                        {
                            item.NameProduct = reader.GetString(6);
                        }
                        if (!reader.IsDBNull(7))
                        {
                            item.EmtCodeFrm = reader.GetInt32(7);
                        }
                        if (!reader.IsDBNull(8))
                        {
                            item.AzsCode = reader.GetInt32(8);
                        }
                        if (!reader.IsDBNull(9))
                        {
                            item.DocNumber = reader.GetInt32(9);
                        }
                        if (!reader.IsDBNull(10))
                        {
                            item.PosNumber = reader.GetInt32(10);
                        }
                        if (!reader.IsDBNull(11))
                        {
                            item.Currency = reader.GetInt32(11);
                        }
                        if (!reader.IsDBNull(12))
                        {
                            item.CardBank = reader.GetString(12);
                        }

                        container.Add(item);
                    }
                }

                reader.Dispose();
            }
            catch (Exception ex) { msg = ex.Message; return(-1); }
            return(ret);
        }
示例#17
0
 public RequestReceipt OnRetryRequest(string msg)
 {
     XLog.LogLine("Task request retry.\n" + msg);
     return(RequestReceipt.OK);
 }
示例#18
0
 public void OnRequested(string msg)
 {
     XLog.LogLine("Task is in requesting.");
 }
示例#19
0
 public void OnTaskCanceled()
 {
     XLog.LogLine("Task is canceled.");
 }