예제 #1
0
        public static bool InsertNormalData(Model_NormalData data)
        {
            data.OrderDate = data.OrderDate.Substring(0, data.OrderDate.IndexOf(" ") + 1);
            string sqlStr = "insert into T_PRODUCE_CALLBACK(linename,linecode,customername,customercode,billcode,orderdate,packageno,null1,cigarettename,cigarettecode,cigarettenum," +
                            "CUSTOMERPHONE,CUSTOMERADDRESS,CUSTOMERSEQ,CUSDELIVERSEQ,CUSPACKAGESEQ,CUSTOTALPACKAGE,LINEPACKAGESEQ,LINETOTALPACKAGE,PACKAGENUM,CUSTOMERNUM,LABELINGSTATUS,ID,PNO) values('" +
                            data.LineName + "','" + data.LineCode + "','" +
                            data.CusName + "','" + data.CusCode + "','" + data.BillCode + "','" + data.OrderDate + "','" + data.PackageNo + "','" + data.Null1 + "','" +
                            data.CigName + "','" + data.CigCode + "','" +
                            data.CigNum + "','" + data.CusPhoneNum + "','" + data.CusAddress + "','" +
                            data.CusSeq + "','" + data.CusDeliverSeq + "','" +
                            data.CusPackageSeq + "','" + data.CusTotalPackage + "','" + data.LinePackageSeq + "','" +
                            data.LineTotalPackage + "','" + data.PackageNum + "','" + data.CusNum + "','" + data.LabelingStatus + "','" + data.ID + "'," + data.PNo + ")";

            return(OracleHelper.ExecuteNonQuery(OracleHelper.ConnectionString, System.Data.CommandType.Text, sqlStr) > 0);
        }
예제 #2
0
        public static List <Model_NormalData> ReadNormalFile(string path, out string msg)
        {
            StreamReader            reader;
            List <Model_NormalData> list = new List <Model_NormalData>();
            string strs = "";

            try
            {
                reader = new StreamReader(path, Encoding.Default);
                string line;
                int    k = 0;
                int    j = 1;
                while ((line = reader.ReadLine()) != null)
                {
                    string[] str = new string[31];
                    str = line.Split(',');

                    if (Convert.ToInt32(str[21]) > 1)
                    {
                        for (int i = 0; i < Convert.ToInt32(str[21]); i++)
                        {
                            Model_NormalData data = new Model_NormalData()
                            {
                                LineName         = str[16],
                                LineCode         = str[15],
                                CusName          = str[9],
                                CusCode          = str[8],
                                BillCode         = str[7],
                                OrderDate        = str[5],
                                PackageNo        = Convert.ToInt32(str[6]),
                                CigName          = str[19],
                                CigCode          = str[18],
                                CigNum           = "1",
                                CusPhoneNum      = str[14],
                                CusAddress       = str[13],
                                CusSeq           = str[10],
                                CusDeliverSeq    = str[17],
                                CusPackageSeq    = str[24],
                                CusTotalPackage  = str[25],
                                LinePackageSeq   = str[26],
                                LineTotalPackage = str[27],
                                PackageNum       = str[22],
                                CusNum           = str[23],
                            };
                            k++;
                            data.Null1 = j;
                            list.Add(data);
                            line = null;
                        }
                    }
                    else
                    {
                        Model_NormalData data = new Model_NormalData()
                        {
                            LineName         = str[16],
                            LineCode         = str[15],
                            CusName          = str[9],
                            CusCode          = str[8],
                            BillCode         = str[7],
                            OrderDate        = str[5],
                            PackageNo        = Convert.ToInt32(str[6]),
                            CigName          = str[19],
                            CigCode          = str[18],
                            CigNum           = str[21],
                            CusPhoneNum      = str[14],
                            CusAddress       = str[13],
                            CusSeq           = str[10],
                            CusDeliverSeq    = str[17],
                            CusPackageSeq    = str[24],
                            CusTotalPackage  = str[25],
                            LinePackageSeq   = str[26],
                            LineTotalPackage = str[27],
                            PackageNum       = str[22],
                            CusNum           = str[23],
                        };
                        data.Null1 = j;
                        k++;
                        list.Add(data);
                        line = null;
                    }
                    if (k.ToString() == str[22])
                    {
                        j++;
                        k = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                strs = ex.Message;
            }
            msg = strs;

            return(list);
        }