Beispiel #1
0
        public void Upload(CCmnUploadData ud)
        {
            string re  = "";
            string msg = "";

            uploadSAP(ud.Data as CPKCheckUpload, out re, out msg);
        }
Beispiel #2
0
        public void uploadSAP(CPKCheckUpload uploadData, out string sapRe, out string sapMsg)
        {
            sapRe  = "";
            sapMsg = "";

            CCmnUploadData ud = new CCmnUploadData();

            ud.Guid       = Guid.NewGuid().ToString();
            ud.Data       = uploadData;
            ud.IsUpload   = 0;
            ud.CreateTime = DateTime.Now;
            ud.HU         = uploadData.mHu;
            CSqliteDataService.saveToSqlite(ud);

            //upload
            SAPDataService.uploadPKCheck(uploadData, out sapRe, out sapMsg);

            if (sapRe != "S")
            {
                CSqliteDataService.updateMsgToSqlite(ud.Guid, sapMsg);
                playSoundWarn();
                dmButton1_exception_query.BackColor = Color.OrangeRed;
            }
            else
            {
                CSqliteDataService.delUploadFromSqlite(ud.Guid);
            }
        }
Beispiel #3
0
        public static void saveToSqlite(CCmnUploadData d)
        {
            string sql    = string.Format("INSERT INTO UploadData(Guid,Data,IsUpload,CreateTime,HU) VALUES('{0}','{1}',0,'{2}','{3}')", d.Guid, JsonConvert.SerializeObject(d.Data), d.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), d.HU);
            int    result = SqliteDBHelp.ExecuteSql(sql);

            if (result <= 0)
            {
                LogHelper.WriteLine(JsonConvert.SerializeObject(d.Data));
            }
        }
Beispiel #4
0
        private void btnReturn_Click(object sender, EventArgs e)
        {
            List <DataGridViewRow> rows = GetCheckedRows();

            if (rows != null && rows.Count > 0)
            {
                if (MetroMessageBox.Show(this, "确认要清除记录吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.OK)
                {
                    foreach (DataGridViewRow row in rows)
                    {
                        CCmnUploadData box = row.Tag as CCmnUploadData;
                        CSqliteDataService.delUploadFromSqlite(box.Guid);
                    }
                }
            }
            if (rows != null && rows.Count > 0)
            {
                MetroMessageBox.Show(this, "成功清除", "提示");
                initData();
            }
        }
Beispiel #5
0
        private void btnReupload_Click(object sender, EventArgs e)
        {
            List <DataGridViewRow> rows = GetCheckedRows();

            if (rows != null && rows.Count > 0)
            {
                Thread t = new Thread(new ThreadStart(() =>
                {
                    ShowLoading("正在上传...");
                    foreach (DataGridViewRow row in rows)
                    {
                        CCmnUploadData box = row.Tag as CCmnUploadData;
                        CSqliteDataService.delUploadFromSqlite(box.Guid);
                        mUploadMethod.Upload(box);
                    }
                    initData();
                    HideLoading();
                }));
                t.IsBackground = true;
                t.Start();
            }
        }
Beispiel #6
0
        public static List <CCmnUploadData> GetAllUploadFromSqlite <T>()
        {
            List <CCmnUploadData> result = new List <CCmnUploadData>();

            string    sql = string.Format("SELECT Guid,Data,IsUpload,CreateTime,MSG,HU FROM UploadData order by CreateTime");
            DataTable dt  = SqliteDBHelp.GetTable(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    CCmnUploadData ud = new CCmnUploadData();
                    ud.Guid       = row["Guid"].ToString();
                    ud.Data       = JsonConvert.DeserializeObject <T>(row["Data"].ToString());
                    ud.IsUpload   = uint.Parse(row["IsUpload"].ToString());
                    ud.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
                    ud.MSG        = row["MSG"].ToString();
                    ud.HU         = row["HU"].ToString();
                    result.Add(ud);
                }
                return(result);
            }
            return(result);
        }
Beispiel #7
0
 void UploadMsgFormMethod.Upload(CCmnUploadData ud)
 {
     CDianShangOutCheckUploadData box = ud.Data as CDianShangOutCheckUploadData;
 }