private bool UpdateTrans_State() { bool result = false; foreach (DataGridViewRow item in gViewPayInfo.Rows) { //MessageBox.Show(item.Cells["trans_State_Com"].Value.ToString()); if ((bool)item.Cells["trans_State_Com"].FormattedValue == true) { item.Cells["Transport_state"].Value = "배송 완료"; } else if ((bool)item.Cells["trans_State_Com"].FormattedValue == false) { item.Cells["Transport_state"].Value = "배송 중"; } Transport_InfoVO ti = new Transport_InfoVO(item.Cells["waybill_ID"].Value.ToString(), item.Cells["transport_State"].Value.ToString()); if (tDao.UpdateTransportState(ti)) { result = true; } else { result = false; } } return(result); }
public bool UpdateTransportState(Transport_InfoVO ti) { string query = "UpdateTransportState"; SqlParameter[] sqlp = { new SqlParameter("transport_State", ti.Transport_State), new SqlParameter("waybill_ID", ti.Waybill_ID) }; return(con.SendExqueteQuery(query, sqlp)); }
internal bool UpdateTransportWaybill(Transport_InfoVO ti, string oldwaybillID, int pay_ID) { string query = "UpdateTransportWaybill"; SqlParameter[] sqlp = { new SqlParameter("oldWaybill_ID", oldwaybillID), new SqlParameter("waybill_ID", ti.Waybill_ID), new SqlParameter("pay_ID", pay_ID), new SqlParameter("transport_State", ti.Transport_State) }; return(con.SendExqueteQuery(query, sqlp)); }
public bool InsertTransport(Transport_InfoVO ti, int pay_ID) { string query = "InsertTransport"; SqlParameter[] sqlp = { new SqlParameter("seller_no", ti.Seller_no), new SqlParameter("waybill_ID", ti.Waybill_ID), new SqlParameter("pay_ID", pay_ID), new SqlParameter("transport_State", ti.Transport_State) }; return(con.SendExqueteQuery(query, sqlp)); }
private void button1_Click(object sender, EventArgs e) { try { for (int i = 0; i < gViewPayInfo.RowCount; i++) { bool result = false; if (!string.IsNullOrEmpty(gViewPayInfo["Waybill_ID", i].Value.ToString())) { string oldwaybill = gViewPayInfo["Waybill_ID", i].Value.ToString(); } try { result = (bool)gViewPayInfo["trans_State_Com", i].Value; } catch (Exception) { } //MessageBox.Show(result.ToString()); if (result) { trans_State = "배송 완료"; } else { trans_State = "배송 중"; } if (string.IsNullOrEmpty(lstOldWaybill[i]) && !string.IsNullOrEmpty(gViewPayInfo["Waybill_ID", i].Value.ToString())) { Transport_InfoVO tVo = new Transport_InfoVO(0, Form1.CompanyNo, gViewPayInfo["Waybill_ID", i].Value.ToString(), trans_State); try { tDao.InsertTransport(tVo, (int)gViewPayInfo["Pay_ID", i].Value); } catch (Exception) { } //MessageBox.Show("Test1"); } else if (!string.IsNullOrEmpty(gViewPayInfo["Waybill_ID", i].Value.ToString())) { // && lstPInfo[i].Waybill_ID != gViewPayInfo["Waybill_ID", i].Value.ToString() Transport_InfoVO tVo = new Transport_InfoVO(0, Form1.CompanyNo, gViewPayInfo["Waybill_ID", i].Value.ToString(), trans_State); try { tDao.UpdateTransportWaybill(tVo, lstOldWaybill[i], (int)gViewPayInfo["Pay_ID", i].Value); } catch (Exception) { } //MessageBox.Show(lstOldWaybill[i]); //MessageBox.Show(tVo.Waybill_ID); } if (gViewPayInfo["Waybill_ID", i].Value.ToString() != lstOldWaybill[i] && !string.IsNullOrEmpty(lstOldWaybill[i])) { Transport_InfoVO tVo = new Transport_InfoVO(0, Form1.CompanyNo, gViewPayInfo["Waybill_ID", i].Value.ToString(), trans_State); try { tDao.InsertTransport(tVo, (int)gViewPayInfo["Pay_ID", i].Value); } catch (Exception) { } } } } catch (Exception) { } this.OnLoad(null); rdoShowAll.Checked = true; //int i = 0; //foreach (DataGridViewRow item in gViewPayInfo.Rows) //{ // try // { // Payment_InfoVO pay = new Payment_InfoVO // ( // (int)item.Cells["Pay_ID"].Value, // item.Cells["order_ID"].Value.ToString(), // item.Cells["User_Ship_ID"].Value.ToString(), // (int)item.Cells["Seller_No"].Value, // (int)item.Cells["Pay_count"].Value, // (int)item.Cells["Pay_Price"].Value, // item.Cells["Waybill_ID"].Value.ToString(), // item.Cells["Cus_name"].Value.ToString(), // item.Cells["User_addr"].Value.ToString(), // item.Cells["Stock_ID"].Value.ToString(), // item.Cells["Order_require"].Value.ToString(), // item.Cells["Ship_require"].Value.ToString(), // item.Cells["Transport_state"].Value.ToString(), // item.Cells["User_name"].Value.ToString() // ); // Transport_InfoVO ti = new Transport_InfoVO(Form1.CompanyNo, pay.Waybill_ID); // if (string.IsNullOrEmpty(lstPInfo[i].Waybill_ID) == false) // { // tDao.UpdateTransportWaybill(lstPInfo[i].Waybill_ID, pay.Waybill_ID); // pDao.UpdatePaymentInfo(pay); // } // else if (string.IsNullOrEmpty(lstPInfo[i].Waybill_ID) == true && string.IsNullOrEmpty(item.Cells["Waybill_ID"].Value.ToString()) == false) // { // tDao.InsertTransport(ti); // pDao.UpdatePaymentInfo(pay); // } // if ((bool)item.Cells["trans_State_Com"].FormattedValue == true) // { // item.Cells["Transport_state"].Value = "배송 완료"; // } // else if ((bool)item.Cells["trans_State_Com"].FormattedValue == false) // { // item.Cells["Transport_state"].Value = "배송 중"; // } // Transport_InfoVO ti2 = new Transport_InfoVO(item.Cells["waybill_ID"].Value.ToString(), item.Cells["transport_State"].Value.ToString()); // tDao.UpdateTransportState(ti2); // } // catch (Exception) // { // MessageBox.Show("저장 실패"); // } // if (string.IsNullOrEmpty(item.Cells["Transport_State"].Value.ToString()) == false && item.Cells["Transport_State"].Value.ToString().Contains("전")) // { // continue; // } // else // { // Payment_InfoVO pay = new Payment_InfoVO( // (int)item.Cells["Pay_ID"].Value, // item.Cells["order_ID"].Value.ToString(), // item.Cells["User_Ship_ID"].Value.ToString(), // (int)item.Cells["Seller_No"].Value, // (int)item.Cells["Pay_count"].Value, // (int)item.Cells["Pay_Price"].Value, // item.Cells["Waybill_ID"].Value.ToString(), // item.Cells["Cus_name"].Value.ToString(), // item.Cells["User_addr"].Value.ToString(), // item.Cells["Stock_ID"].Value.ToString(), // item.Cells["Order_require"].Value.ToString(), // item.Cells["Ship_require"].Value.ToString(), // item.Cells["Transport_state"].Value.ToString(), // item.Cells["User_name"].Value.ToString() // ); // Transport_InfoVO ti = new Transport_InfoVO(Form1.CompanyNo, pay.Waybill_ID); // if (string.IsNullOrEmpty(lstPInfo[i].Waybill_ID) == false) // { // try // { // tDao.InsertTransport(ti); // pDao.UpdatePaymentInfo(pay); // } // catch (Exception) // { // tDao.UpdateTransportWaybill(lstPInfo[i].Waybill_ID, pay.Waybill_ID); // pDao.UpdatePaymentInfo(pay); // } // } // } // i++; //} //if (UpdateTrans_State()) //{ // result3 = true; //} //else //{ // result3 = false; //} //if (result && result3) //{ // MessageBox.Show("저장 완료"); //} //this.OnLoad(null); //rdoShowAll.Checked = true; }