public static commonReturn findByID(SqlConnection pCON, string sw_id) //기존 권한 내역이 존재하는지 여부를 알아내기위해 { commonReturn return2 = new commonReturn(); string str = ""; str = @"select * from MENU_PERMISSION where sw_id = @sw_id"; try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@sw_id", sw_id); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn findByWorkOrderID(SqlConnection pCON, string id) //작업지시 기준 조회 { commonReturn return2 = new commonReturn(); string str = ""; str = @"select a.*, b.*, c.MACHINE_NAME, d.sw_name, e.bs_name, f.gm_name, g.sj_name, h.jp_name, h.jp_num, h.car, h.model, h.mtrl_num, h.cavity, h.cycle_t from JAKEOP_SILJEOK a left outer join JAKEOP_JISI b on (a.jisi_id = b.jisi_id) left outer join SEOLBI c on (b.MACHINE_CODE = c.MACHINE_CODE) left outer join SAWON d on (a.sw_id = d.sw_id) left outer join BUSEO e on (a.bs_id = e.bs_id) left outer join GEUNMU f on (a.gm_id = f.gm_id) left outer join JEPUM h on (b.jp_id = h.jp_id) left outer join SUJI g on (h.sj_id = g.sj_id) where a.jisi_id= @jisi_id "; try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@jisi_id", id); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
private DataRow readMachineInfo(string MachineID) { DataRow row = null; commonReturn MachineInfo = new commonReturn(); MachineInfo = fx_machineCode.findByID(commonVar.DBconn, MachineID); if (MachineInfo.Message == "" && MachineInfo.Dataset.Tables[0].Rows.Count > 0) { row = MachineInfo.Dataset.Tables[0].Rows[0]; selectedInfo.MachineNum = Convert.ToInt32(row["MACHINE_NUMBER"]); selectedInfo.MachineName = Convert.ToString(row["MACHINE_NAME"]); selectedInfo.MachineType = Convert.ToString(row["MACHINE_TYPE"]); } else { selectedInfo.MachineNum = 0; selectedInfo.MachineName = string.Empty; selectedInfo.MachineType = string.Empty; } return(row); }
private void conditionalRead() { string use = ""; if (chk_use.Checked == true) { use = "Y"; } else { use = "N"; } commonReturn Return = new commonReturn(); Return = fx_resinCode.findByName(commonVar.DBconn, txt_name.Text, use); if (Return.Message == "") { ds_resinCode = Return.Dataset; gridControl1.DataSource = Return.Dataset.Tables[0].DefaultView; } else { MessageBox.Show(Return.Message, "DB 에러!"); } }
public static commonReturn ReadErrorDetails(SqlConnection pCON, bool is_add, string id) { commonReturn return2 = new commonReturn(); string str = string.Empty; if (is_add) { str = @"select a.*, 0 as qt_br from BULRYANG_WONIN a"; } else { str = @"select a.*, b.qt_br from BULRYANG_WONIN a left outer join JAKEOP_SILJEOK_BR b on (a.br_id = b.br_id) where siljeok_id like '%' + @siljeok_id + '%' ;"; } try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@siljeok_id", id); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn read_all(SqlConnection pCON, string chk) //조회함수 { commonReturn return2 = new commonReturn(); string str = ""; if (chk == "Y") { str = @"select * from BUSEO where use_chk = 'Y' order by bs_id"; } else { str = @"select * from BUSEO order by bs_id"; } try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn findByID(SqlConnection pCON, string id) { commonReturn return2 = new commonReturn(); string str = ""; str = @"select * from BUSEO where bs_id = @bs_id "; try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@bs_id", id); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn SQLExecuteNonQuery(SqlConnection pCON, SqlCommand pCMD) { commonReturn commonReturn = new commonReturn(); try { if (pCON.State != ConnectionState.Open) { pCON.Open(); } pCMD.Connection = pCON; pCMD.CommandTimeout = 120; commonReturn.ExeCount = pCMD.ExecuteNonQuery(); commonReturn.Code = 1; commonReturn.Message = ""; return(commonReturn); } catch (Exception ex) { commonReturn.Code = -1; commonReturn.Message = ex.ToString(); } finally { pCMD.Dispose(); } return(commonReturn); }
public static commonReturn findBy2Param(SqlConnection pCON, string name, string dept) { commonReturn return2 = new commonReturn(); string str = ""; str = @"select a.*, b.bs_name from SAWON a left outer join BUSEO b on (a.bs_id = b.bs_id) where a.use_chk = 'Y' and a.sw_name like '%' + @name + '%' and b.bs_name like '%' + @dept + '%' order by b.bs_name, a.sw_id"; try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@name", name); pCMD.Parameters.AddWithValue("@dept", dept); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn write(SqlConnection pCON, bool is_add, SqlCommand pCMD) { commonReturn return2 = new commonReturn(); string str = ""; if (is_add == true) //추가일때 { str = @"insert into BULRYANG_WONIN (br_id, br_detail, br_gbn, use_chk, seq_num) values (@br_id, @br_detail, @br_gbn, @use_chk, @seq_num)"; } else //수정일때 { str = @"update BULRYANG_WONIN set br_detail=@br_detail, br_gbn=@br_gbn, use_chk = @use_chk, seq_num = @seq_num where br_id = @br_id"; } try { pCMD.CommandText = str; pCMD.Connection = pCON; return2 = DBsql.SQLExecuteNonQuery(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn SQLExecuteDS(SqlConnection pCON, SqlCommand pCMD) { commonReturn commonReturn = new commonReturn(); SqlDataAdapter DA = new SqlDataAdapter(); try { if (pCON.State != ConnectionState.Open) { pCON.Open(); } pCMD.Connection = pCON; pCMD.CommandTimeout = 0; if (pCMD.CommandType != CommandType.StoredProcedure) { pCMD.CommandType = System.Data.CommandType.Text; } DA.SelectCommand = pCMD; DA.Fill(commonReturn.Dataset); commonReturn.Code = 1; } catch (Exception ex) { commonReturn.Code = -1; commonReturn.Message = ex.ToString(); } finally { pCMD.Dispose(); } return(commonReturn); }
private void btn_delete_Click(object sender, EventArgs e) { parentRow = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (parentRow == null) { MessageBox.Show("삭제할 자료를 선택하세요."); } else { DialogResult question = MessageBox.Show("선택하신 자료를 삭제하시겠습니까?", "삭제", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (question == DialogResult.Yes) { if (edit.Visible == true) { MessageBox.Show("삭제 불가능 상태입니다. 뒤로가기 버튼을 누르세요."); return; } bizID = parentRow["ec_id"].ToString(); commonReturn Return = new commonReturn(); Return = fx_bizCode.delete_ec(commonVar.DBconn, bizID); if (Return.Message == "") { parentRow.Delete(); } else { MessageBox.Show(Return.Message, "DB 에러!"); } } }//else }
private void read_grid1() //업체코드 그리드 { string use = ""; if (chk_use.Checked == true) { use = "Y"; } else { use = "N"; } commonReturn Return = new commonReturn(); Return = fx_bizCode.read_all_ec(commonVar.DBconn, use); if (Return.Message == "") { ds_bizCode = Return.Dataset; gridControl1.DataSource = Return.Dataset.Tables[0].DefaultView; } else { MessageBox.Show(Return.Message, "DB 에러!"); } }
public static commonReturn write(SqlConnection pCON, SqlCommand pCMD) { commonReturn return2 = new commonReturn(); string str = ""; str = @"insert into MENU_PERMISSION (sw_id, menu_access, menu_add, menu_upd, menu_del, menu_search, menu_print, menu_convert, parent_id, child_id) values (@sw_id, @menu_access, @menu_add, @menu_upd, @menu_del, @menu_search, @menu_print, @menu_convert, @parent_id, @child_id)"; try { pCMD.CommandText = str; pCMD.Connection = pCON; return2 = DBsql.SQLExecuteNonQuery(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
private void conditionalRead() { if (commonVar.DBconn.State == ConnectionState.Closed) { commonVar.DBconn.ConnectionString = commonVar.dbConnectionString; } string use = ""; if (chk_use.Checked == true) { use = "Y"; } else { use = "N"; } commonReturn Return = new commonReturn(); Return = fx_errorCode.findByMsg(commonVar.DBconn, txt_msg.Text, use); if (Return.Message == "") { ds_errorCode = Return.Dataset; gridControl1.DataSource = Return.Dataset.Tables[0].DefaultView; } else { MessageBox.Show(Return.Message, "DB 에러!"); } }
private void btn_delete_Click(object sender, EventArgs e) { parentRow = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (parentRow == null) { MessageBox.Show("삭제할 자료를 선택하세요."); } else { DialogResult question = MessageBox.Show("선택하신 자료를 삭제하시겠습니까?", "삭제", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (question == DialogResult.Yes) { deptID = parentRow["bs_id"].ToString(); if (commonVar.DBconn.State == ConnectionState.Closed) { commonVar.DBconn.ConnectionString = commonVar.dbConnectionString; } commonReturn Return = new commonReturn(); Return = fx_deptCode.delete(commonVar.DBconn, deptID); if (Return.Message == "") { parentRow.Delete(); parentRow.AcceptChanges(); } else { MessageBox.Show(Return.Message, "DB 에러!"); } } }//else }
public static commonReturn write(SqlConnection pCON, bool is_add, SqlCommand pCMD) { commonReturn return2 = new commonReturn(); string str = ""; if (is_add == true) //추가일때 { str = @"insert into BUSEO (bs_id, bs_name, use_chk) values (@bs_id, @bs_name, @use_chk)"; } else //수정일때 { str = @"update BUSEO set bs_name=@bs_name, use_chk=@use_chk where bs_id = @bs_id"; } try { pCMD.CommandText = str; pCMD.Connection = pCON; return2 = DBsql.SQLExecuteNonQuery(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
private void read() { if (commonVar.DBconn.State == ConnectionState.Closed) { commonVar.DBconn.ConnectionString = commonVar.dbConnectionString; commonVar.DBconn.Open(); } string use = ""; if (chk_use.Checked == true) { use = "Y"; } else { use = "N"; } commonReturn Return = new commonReturn(); Return = fx_deptCode.read_all(commonVar.DBconn, use); if (Return.Message == "") { ds_deptCode = Return.Dataset; gridControl1.DataSource = Return.Dataset.Tables[0].DefaultView; } else { MessageBox.Show(Return.Message, "DB 에러!"); } }
public static commonReturn findByName(SqlConnection pCON, string name, string chk) { commonReturn return2 = new commonReturn(); string str = ""; if (chk == "Y") { str = @"select * from BUSEO where bs_name like '%' + @name + '%' and use_chk = @chk"; } else { str = @"select * from BUSEO where bs_name like '%' + @name + '%' "; } try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@name", name); pCMD.Parameters.AddWithValue("@chk", chk); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn write(SqlConnection pCON, bool is_add, SqlCommand pCMD) { commonReturn return2 = new commonReturn(); string str = ""; if (is_add == true) //추가일때 { str = @"insert into ERROR (err_id, err_msg, server_id, use_chk) values (@err_id, @err_msg, @server_id, @use_chk)"; } else //수정일때 { str = @"update ERROR set err_msg=@err_msg, server_id = @server_id, use_chk=@use_chk where err_id = @err_id"; } try { pCMD.CommandText = str; pCMD.Connection = pCON; return2 = DBsql.SQLExecuteNonQuery(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
private void read() { string use = ""; if (chk_use.Checked == true) { use = "Y"; } else { use = "N"; } commonReturn Return = new commonReturn(); Return = fx_resinCode.readResinRecords(commonVar.DBconn, use); if (Return.Message == "") { ds_resinCode = Return.Dataset; gridControl1.DataSource = Return.Dataset.Tables[0].DefaultView; } else { MessageBox.Show(Return.Message, "DB 에러!"); } }
public static commonReturn read_all(SqlConnection pCON, string chk) //조회함수 { commonReturn return2 = new commonReturn(); string str = ""; if (chk == "Y") { str = @"select a.*, b.sj_name from JEPUM a left outer join SUJI b on (a.sj_id = b.sj_id) where a.use_chk = 'Y' "; } else { str = @"select *, b.sj_name from JEPUM a left outer join SUJI b on (a.sj_id = b.sj_id)"; } try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn ReadWorkOrder(SqlConnection pCON, string id) //작업지시 조회 { commonReturn return2 = new commonReturn(); string str = ""; str = @"select a.*, b.jp_name, b.jp_num, b.car, b.model, b.mtrl_num, b.now_stock, b.cavity as original_cavity, b.cycle_t as original_cycle, b.sj_id, b.sj_id, b.jp_stdpaper, c.MACHINE_NAME, d.sw_name, e.bs_name, f.ec_name, g.sj_name from JAKEOP_JISI a left outer join JEPUM b on (a.jp_id = b.jp_id) left outer join SEOLBI c on (a.MACHINE_CODE = c.MACHINE_CODE) left outer join SAWON d on (a.wr_sw_id = d.sw_id) left outer join BUSEO e on (a.wr_bs_id = e.bs_id) left outer join EOPCHE f on (a.mnf_id = f.ec_id) left outer join SUJI g on (b.sj_id = g.sj_id) where a.jisi_id = @jisi_id"; try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@jisi_id", id); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn findByID(SqlConnection pCON, string id) { commonReturn return2 = new commonReturn(); string str = ""; str = @"select a.*, b.sj_name from JEPUM a left outer join SUJI b on (a.sj_id = b.sj_id) where a.jp_id = @id "; try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@id", id); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn ReadBreakTimeDetails(SqlConnection pCON, bool is_add, string id) { commonReturn return2 = new commonReturn(); string str = string.Empty; if (is_add) { str = @"select a.*, '00:00' as start_time, '00:00' as end_time, '00:00' as bgd_time from BIGADONG a;"; } else { str = @"select a.*, b.start_time, b.end_time, b.bgd_time from BIGADONG a left outer join JAKEOP_SILJEOK_BGD b on (a.bgd_id = b.bgd_id) where siljeok_id like '%' + @siljeok_id + '%' "; } try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@siljeok_id", id); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
public static commonReturn findByCondition(SqlConnection pCON, string gbn, string name) { commonReturn return2 = new commonReturn(); string str = ""; str = @"select * from EOPCHE where ec_gbn_name like '%' + @gbn + '%' and ec_name like '%' + @name + '%' "; try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@gbn", gbn); pCMD.Parameters.AddWithValue("@name", name); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
private DataRow readMoldInfo(string MoldID) { DataRow row = null; commonReturn MoldInfo = new commonReturn(); MoldInfo = fx_moldCode.findByID(commonVar.DBconn, MoldID); if (MoldInfo.Message == "" && MoldInfo.Dataset.Tables[0].Rows.Count > 0) { row = MoldInfo.Dataset.Tables[0].Rows[0]; selectedInfo.MoldModel = Convert.ToString(row["model"]); selectedInfo.MoldName = Convert.ToString(row["gh_name"]); selectedInfo.MoldNum = Convert.ToString(row["gh_num"]); selectedInfo.MoldShot = Convert.ToInt32(row["accumulated"]); selectedInfo.MoldCavity = Convert.ToString(row["cavity"]); } else { selectedInfo.MoldModel = string.Empty; selectedInfo.MoldName = string.Empty; selectedInfo.MoldNum = string.Empty; selectedInfo.MoldShot = 0; selectedInfo.MoldCavity = string.Empty; } return(row); }
public static commonReturn findByGbn(SqlConnection pCON, string gbn, string chk) { commonReturn return2 = new commonReturn(); string str = ""; if (chk == "Y") { str = @"select * from EOPCHE where ec_gbn_name like '%' + @gbn + '%' and trade_chk = @chk"; } else { str = @"select * from EOPCHE where ec_gbn like '%' + @gbn + '%' "; } try { SqlCommand pCMD = new SqlCommand { CommandText = str, Connection = pCON }; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@gbn", gbn); pCMD.Parameters.AddWithValue("@chk", chk); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }
private void btn_delete_Click(object sender, EventArgs e) { parentRow = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (parentRow == null) { MessageBox.Show("삭제할 자료를 선택하세요."); } else { DialogResult question = MessageBox.Show("선택하신 자료를 삭제하시겠습니까?", "삭제", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (question == DialogResult.Yes) { nonOpID = parentRow["bgd_id"].ToString(); commonReturn Return = new commonReturn(); Return = fx_nonOperationCode.delete(commonVar.DBconn, nonOpID); if (Return.Message == "") { parentRow.Delete(); } else { MessageBox.Show(Return.Message, "DB 에러!"); } } }//else }
public static commonReturn delete(SqlConnection pCON, string id) { commonReturn return2 = new commonReturn(); string str = ""; try { SqlCommand pCMD = new SqlCommand(); str = @"BEGIN TRY BEGIN TRAN update SEOLBI set Maptype=null where MACHINE_CODE=@MACHINE_CODE delete from SEOLBI where MACHINE_CODE = @MACHINE_CODE update SEOLBI set MapType=null where MACHINE_CODE = @MACHINE_CODE delete from SEOLBI where MACHINE_CODE = @MACHINE_CODE COMMIT TRAN END TRY BEGIN CATCH ROLLBACK TRAN END CATCH "; pCMD.CommandText = str; pCMD.Connection = pCON; pCMD.Parameters.Clear(); pCMD.Parameters.AddWithValue("@MACHINE_CODE", id); return2 = DBsql.SQLExecuteDS(pCON, pCMD); } catch (Exception exception) { return2.Message = exception.ToString(); } return(return2); }