zoukankan      html  css  js  c++  java
  • 读取txt文件修改数据库

    public void DealEfileReturn(FileInfo file)
    {
    long totalRecords = 0;
    IList<EfileList> list = Baosight.BPMS.Core.Adapter.BPMSDocUtil.QueryEfileList(0, -1, new SqlFilter("projectNo='090410'and BusinessKey1='13CNSHG3200019A0' "), new SqlSort("order by BusinessKey1"), out totalRecords);
    if (list.Count > 0)
    {
    //预存字符串的变量
    string str = "";

    if (file.Exists)
    {
    using (StreamReader streamReader = new StreamReader(file.FullName, Encoding.Default))
    {
    while (streamReader.Peek() >= 0)
    {
    str = streamReader.ReadLine();
    if (str.Length > 0)
    {
    //调用事务处理
    using (DbTransactionWrapper wrapper = new DbTransactionWrapper())
    {
    string[] data = Regex.Split(str, "&&");
    #region MyRegion

    //foreach (string item in data)
    //{
    EfileList entity = new EfileList();

    entity.ProjectNo = StringFormat(data[0].Trim());
    entity.BusinessKey1 = StringFormat(data[1].Trim());
    entity.BusinessKey2 = StringFormat(data[2].Trim());

    string flas = StringFormat(data[3].Trim());

    entity.EfileConfirmDate = DateTimeFormat(data[4]);

    if (flas == "1")
    {
    Database db = DatabaseFactory.CreateDatabase(DATABASE_INSTANCE_NAME);

    string sql = string.Format(@"UPDATE T_SYS_EFILE_LIST SET EfileStatus='02',EfileConfirmDate='" + entity.EfileConfirmDate + "' WHERE projectNo='" + entity.ProjectNo + "'and BusinessKey1='" + entity.BusinessKey1 + "' and BusinessKey2='" + entity.BusinessKey2 + "'");

    int i = db.ExecuteNonQuery(CommandType.Text, sql);
    }

    else if (flas == "0")
    {
    Database db = DatabaseFactory.CreateDatabase(DATABASE_INSTANCE_NAME);

    string sql = string.Format(@"UPDATE T_SYS_EFILE_LIST SET EfileStatus='11',EfileConfirmDate='" + entity.EfileConfirmDate + "' WHERE projectNo='" + entity.ProjectNo + "'and BusinessKey1='" + entity.BusinessKey1 + "' and BusinessKey2='" + entity.BusinessKey2 + "'");

    int i = db.ExecuteNonQuery(CommandType.Text, sql);
    }
    //}
    #endregion
    wrapper.Commit();


    }
    }
    }
    streamReader.Close();
    }
    }
    else
    {
    throw (new Exception());
    }

    }

    }

  • 相关阅读:
    系统分析与设计——作业9
    系统分析与设计——作业8
    系统分析与设计——作业7
    系统分析与设计——作业6
    系统分析与设计——作业5
    系统分析与设计——作业4
    从循环添加事件谈起对JS闭包的理解
    对JS prototype的理解
    系统分析与设计——作业2
    JavaScript 预编译(变量提升和函数提升的原理)
  • 原文地址:https://www.cnblogs.com/zmmlczy/p/3877841.html
Copyright © 2011-2022 走看看