private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < dgvCompany.Rows.Count && e.RowIndex > -1) { if (dgvCompany.Rows[e.RowIndex].Cells[5].Value == null) { item = new CompanyVO { Company_ID = Convert.ToInt32(dgvCompany.Rows[e.RowIndex].Cells[0].Value), Company_Name = dgvCompany.Rows[e.RowIndex].Cells[1].Value.ToString(), Company_AddrNumber = dgvCompany.Rows[e.RowIndex].Cells[2].Value.ToString(), Company_Address = dgvCompany.Rows[e.RowIndex].Cells[3].Value.ToString(), Company_Number = dgvCompany.Rows[e.RowIndex].Cells[4].Value.ToString(), CodeTable_CodeID = dgvCompany.Rows[e.RowIndex].Cells[6].Value.ToString(), Company_Owner = dgvCompany.Rows[e.RowIndex].Cells[8].Value.ToString() }; } else { item = new CompanyVO { Company_ID = Convert.ToInt32(dgvCompany.Rows[e.RowIndex].Cells[0].Value), Company_Name = dgvCompany.Rows[e.RowIndex].Cells[1].Value.ToString(), Company_AddrNumber = dgvCompany.Rows[e.RowIndex].Cells[2].Value.ToString(), Company_Address = dgvCompany.Rows[e.RowIndex].Cells[3].Value.ToString(), Company_Number = dgvCompany.Rows[e.RowIndex].Cells[4].Value.ToString(), Company_Fax = dgvCompany.Rows[e.RowIndex].Cells[5].Value.ToString(), CodeTable_CodeID = dgvCompany.Rows[e.RowIndex].Cells[6].Value.ToString(), Company_Owner = dgvCompany.Rows[e.RowIndex].Cells[8].Value.ToString() }; } } }
public bool InsertCompany(CompanyVO vo) { using (SqlCommand cmd = new SqlCommand()) { string sql = "InsertCompany"; cmd.Connection = new SqlConnection(this.ConnectionString); cmd.CommandText = sql; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); // cmd.Parameters.AddWithValue("@company_id", vo.company_id); cmd.Parameters.AddWithValue("@company_code", vo.company_code); cmd.Parameters.AddWithValue("@company_name", vo.company_name); cmd.Parameters.AddWithValue("@company_type", vo.company_type); cmd.Parameters.AddWithValue("@company_ceo", vo.company_ceo); cmd.Parameters.AddWithValue("@company_cnum", vo.company_cnum); cmd.Parameters.AddWithValue("@company_btype", vo.company_btype); cmd.Parameters.AddWithValue("@company_gtype", vo.company_gtype); cmd.Parameters.AddWithValue("@user_id", vo.user_id); cmd.Parameters.AddWithValue("@company_email", vo.company_email); cmd.Parameters.AddWithValue("@company_phone", vo.company_phone); cmd.Parameters.AddWithValue("@company_fax", vo.company_fax); cmd.Parameters.AddWithValue("@company_yn", vo.company_yn); cmd.Parameters.AddWithValue("@company_uadmin", vo.company_uadmin); cmd.Parameters.AddWithValue("@company_udate", vo.company_udate); cmd.Parameters.AddWithValue("@company_comment", vo.company_comment); // cmd.Parameters.AddWithValue("@company_order_code", vo.company_order_code); var successRow = cmd.ExecuteNonQuery(); cmd.Connection.Close(); return(successRow > 0); } }
/// <summary> /// Constructor /// </summary> public Company(CompanyVO companyVO) { ID = companyVO.CompanyID; Name = companyVO.Name; NameWithID = companyVO.Name + " - " + ID; IsSelected = companyVO.IsSelected; }
private void InsertCompany() { CompanyVO item = new CompanyVO { Company_Name = txtCompanyName.Text, Company_Number = maskedCompanyNumber.Text, Company_Fax = maskedCompanyFaxNumber.Text, CodeTable_CodeID = cboCompanyDivision.SelectedValue.ToString(), Company_Owner = txtCompanyOwner.Text, Company_Address = addrCompany.Address1 + " " + addrCompany.Address2, Company_AddrNumber = addrCompany.Zipcode }; if (item.Company_Fax.Replace("-", "").Trim().Length < 10) { item.Company_Fax = null; } try { StandardService service = new StandardService(); service.InsertCompany(item); } catch (Exception err) { Log.WriteError(err.Message, err); } }
/// <summary> /// Transpose Model object to Value Object /// </summary> /// <param name="userId">user Id</param> /// <returns>Value object</returns> public CompanyVO Transpose() { CompanyVO companyVO = new CompanyVO(); companyVO.Name = this.Name; companyVO.CompanyID = this.ID; companyVO.IsSelected = this.IsSelected; return(companyVO); }
public CompanyProductPopupForm(string employeeName, bool IsDataExists, CompanyVO company) { InitializeComponent(); this.IsDataExists = IsDataExists; this.employeeName = employeeName; if (IsDataExists == true) { this.companyVO = company; } }
private void UpdateInfo(CompanyVO item) { code = item.Company_ID; txtCompanyName.Text = item.Company_Name; maskedCompanyNumber.Text = item.Company_Number; maskedCompanyFaxNumber.Text = item.Company_Fax; txtCompanyOwner.Text = item.Company_Owner; addrCompany.Zipcode = item.Company_AddrNumber; string[] str = item.Company_Address.Split(' '); addrCompany.Address1 = str[0]; addrCompany.Address2 = str[1]; division = item.CodeTable_CodeID; }
/// <summary> /// vo에 id, 거래처명, 거래분류, 대표명, 사업자번호, 업종, 업태, 이메일, 번호, 팩스, 우편번호, 주소, 상세주소, 비고를 넣어 DB의 내용을 수정한다. /// 작성자: 최현호 / 작성일: 210212 /// </summary> /// <param name="vo"></param> /// <returns></returns> public bool Update(CompanyVO vo) { try { string sql = @"update TBL_COMPANY set company_name = @company_name, company_type = @company_type, company_ceo = @company_ceo, company_cnum = @company_cnum, company_btype = @company_btype, company_gtype = @company_gtype, company_email = @company_email, company_phone = @company_phone, company_fax = @company_fax, company_ZipCode = @company_ZipCode, company_Address = @company_Address, company_DetAddress = @company_DetAddress, company_uadmin = @company_uadmin, company_udate = @company_udate, company_comment = @company_comment where company_id = @company_id"; using (SqlCommand cmd = new SqlCommand(sql, conn)) { cmd.Parameters.AddWithValue("@company_name", vo.company_name); cmd.Parameters.AddWithValue("@company_type", vo.company_type); cmd.Parameters.AddWithValue("@company_ceo", vo.company_ceo); cmd.Parameters.AddWithValue("@company_cnum", vo.company_cnum); cmd.Parameters.AddWithValue("@company_btype", vo.company_btype); cmd.Parameters.AddWithValue("@company_gtype", vo.company_gtype); cmd.Parameters.AddWithValue("@company_email", vo.company_email); cmd.Parameters.AddWithValue("@company_phone", vo.company_phone); cmd.Parameters.AddWithValue("@company_fax", vo.company_fax); cmd.Parameters.AddWithValue("@company_ZipCode", vo.company_ZipCode); cmd.Parameters.AddWithValue("@company_Address", vo.company_Address); cmd.Parameters.AddWithValue("@company_DetAddress", vo.company_DetAddress); cmd.Parameters.AddWithValue("@company_uadmin", vo.company_uadmin); cmd.Parameters.AddWithValue("@company_udate", vo.company_udate); cmd.Parameters.AddWithValue("@company_comment", vo.company_comment); cmd.Parameters.AddWithValue("@company_id", vo.company_id); int iRowAffect = cmd.ExecuteNonQuery(); conn.Close(); return(iRowAffect > 0); } } catch (Exception) { throw; } }
/// <summary> /// Get list of comapanies associated with user /// </summary> /// <param name="userId">user id</param> /// <returns>list of associated company</returns> public List <CompanyVO> GetAssociatedCompanyByUserID(int userId) { List <CompanyVO> associatedCompanyList = new List <CompanyVO>(); List <UserCompanyMapping> userCompanyMapping = mdbDataContext.UserCompanyMappings.Where(u => u.UserID == userId && u.IsActive == true).ToList(); foreach (var item in userCompanyMapping) { CompanyVO company = new CompanyVO(); company.CompanyID = item.CompanyID; company.IsSelected = true; associatedCompanyList.Add(company); } return(associatedCompanyList); }
private void BuildBrand() { StringBuilder html = new StringBuilder(); CompanyVO company = dh.GetCompanyByID(accountInfo.Company_ID); if (company != null) { html.Append("<a class=\"navbar-brand\">" + company.Company_Name + " - ERP系统</a>"); } else { html.Append("<a class=\"navbar-brand\">ERP系统后台</a>"); } BrandLiteral.Text = html.ToString(); }
public CompanyInsUp(EditMode editMode, CompanyVO item) { InitializeComponent(); if (editMode == EditMode.Insert) { lblName.Text = "거래처 등록"; mode = "Insert"; pbxTitle.Image = Resources.AddFile_32x32; } else { lblName.Text = "거래처 수정"; mode = "Update"; pbxTitle.Image = Resources.Edit_32x32; UpdateInfo(item); } }
private void btnConfirm_Click(object sender, EventArgs e) { try { CompanyVO vo = new CompanyVO(); List <ProductSimpleVO> prodListVO = new List <ProductSimpleVO>(); vo.company_id = Convert.ToInt32((txtCompany_Id.Text.Length > 0) ? txtCompany_Id.Text:"0"); vo.company_name = txtCompany_Name.Text; vo.company_seq = Convert.ToInt32((nudCompany_seq.Text.Length > 0) ? nudCompany_seq.Text : "0"); vo.company_type = cboCompany_Type.SelectedValue.ToString(); vo.first_regist_employee = employeeName; vo.final_regist_employee = employeeName; if (listBoxProduct.Items.Count > 0) { foreach (string prodInfo in listBoxProduct.Items) { prodListVO.Add(new ProductSimpleVO { Product_ID = Convert.ToInt32(prodInfo.Split('/')[0]), Product_Name = prodInfo.Split('/')[1] } ); } } if (service.SaveCompany(vo, prodListVO)) { MessageBox.Show("정상적으로 저장되었습니다."); this.DialogResult = DialogResult.OK; this.Close(); } } catch (Exception err) { throw err; } }
private void Readed(object sender, ReadEventArgs e) { if (((MainForm)this.MdiParent).ActiveMdiChild == this) { int comCode = int.Parse(e.ReadMsg.Trim().Replace("\r", "").Replace("\n", "")); foreach (DataGridViewRow dgvr in dgvCompanyList.Rows) { if (dgvr.Cells["company_id"].Value.ToInt() == comCode) { dgvr.Selected = true; break; } } if (MessageBox.Show("수정하시겠습니까?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) { CompanyVO company = new CompanyVO(); company.company_id = Convert.ToInt32(dgvCompanyList.SelectedRows[0].Cells[1].Value); company.company_name = dgvCompanyList.SelectedRows[0].Cells[2].Value.ToString(); company.company_type = dgvCompanyList.SelectedRows[0].Cells[3].Value.ToString(); company.company_seq = Convert.ToInt32(dgvCompanyList.SelectedRows[0].Cells[4].Value); CompanyProductPopupForm cpp = new CompanyProductPopupForm(emp.Employee_name, true, company); if (cpp.ShowDialog() == DialogResult.OK) { dgvCompanyList.Columns.Clear(); CompanyForm_Load(null, null); } return; } this.GetMdiParent().ClearStrs(); } }
public bool UpdateCompany(CompanyVO item) { string sql = "Update Company set Company_Name = @Company_Name, Company_Address1 = @Company_Address1, Company_Address2 = @Company_Address2, Company_Number = @Company_Number, Company_Fax = @Company_Fax, CodeTable_CodeID = @CodeTable_CodeID, Company_Owner = @Company_Owner where Company_ID = @Company_ID "; string[] str = item.Company_Address.Split(' '); try { using (SqlCommand cmd = new SqlCommand(sql, conn)) { cmd.Parameters.AddWithValue("@Company_Name", item.Company_Name); cmd.Parameters.AddWithValue("@Company_Address1", str[0]); cmd.Parameters.AddWithValue("@Company_Address2", str[1]); cmd.Parameters.AddWithValue("@Company_Number", item.Company_Number); if (item.Company_Fax == null) { cmd.Parameters.AddWithValue("@Company_Fax", DBNull.Value); } else { cmd.Parameters.AddWithValue("@Company_Fax", item.Company_Fax); } cmd.Parameters.AddWithValue("@CodeTable_CodeID", item.CodeTable_CodeID); cmd.Parameters.AddWithValue("@Company_Owner", item.Company_Owner); cmd.Parameters.AddWithValue("@Company_ID", item.Company_ID); conn.Open(); var rowsAffected = cmd.ExecuteNonQuery(); return(rowsAffected > 0); } } catch { throw; } finally { conn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { switch (Request.QueryString["type"]) { case "company": CompanyVO auxEmp = new CompanyVO(); auxEmp = (CompanyVO)EntityExtractor.create(EntityExtractor.EMP_EXTRACTOR).getDetails(int.Parse(Request.QueryString["id"])); ReportManager.Instance.createReport(auxEmp, this, 1); break; case "ods": ODSVO auxOds = new ODSVO(); auxOds = (ODSVO)EntityExtractor.create(EntityExtractor.ODS_EXTRACTOR).getDetails(int.Parse(Request.QueryString["id"])); ReportManager.Instance.createReport(auxOds, this, 2); break; case "cooperant": CooperantVO auxCoop = new CooperantVO(); auxCoop = (CooperantVO)EntityExtractor.create(EntityExtractor.COOP_EXTRACTOR).getDetails(int.Parse(Request.QueryString["id"])); ReportManager.Instance.createReport(auxCoop, this, 3); break; } }
private void dgvCompanyList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) //업데이트 할떄 더블클릭 { if (e.RowIndex < 0) { return; } else { CompanyVO company = new CompanyVO(); company.company_id = Convert.ToInt32(dgvCompanyList.SelectedRows[0].Cells[1].Value); company.company_name = dgvCompanyList.SelectedRows[0].Cells[2].Value.ToString(); company.company_type = dgvCompanyList.SelectedRows[0].Cells[3].Value.ToString(); company.company_seq = Convert.ToInt32(dgvCompanyList.SelectedRows[0].Cells[4].Value); CompanyProductPopupForm cpp = new CompanyProductPopupForm(emp.Employee_name, true, company); if (cpp.ShowDialog() == DialogResult.OK) { dgvCompanyList.Columns.Clear(); CompanyForm_Load(null, null); } } }
public EntityVO getDetails(int i) { FVSL_LINQDataContext dbcon = new FVSL_LINQDataContext(); CompanyVO EMP = new CompanyVO(); try { List<EMP_Empresa> resultset = dbcon.MAPA_EMP_DETAILS(i).ToList(); if (resultset.Count == 1) { EMP = FEMP(resultset[0]); } return EMP; } catch (Exception e) { Logging.WriteError(e.StackTrace.ToString()); return null; } }
/// <summary> /// vo에 거래처명, 거래분류, 대표명, 사업자번호, 업종, 업태, 이메일, 번호, 팩스, 우편번호, 주소, 상세주소, 비고를 넣어 새로 등록한다 /// 작성자: 최현호 / 작성일: 210212 /// </summary> /// <param name="vo"></param> /// <returns></returns> public bool Insert(CompanyVO vo) { try { string sql = @"insert into TBL_COMPANY(company_name, company_type, company_ceo, company_cnum, company_btype, company_gtype, company_email, company_phone, company_fax, company_ZipCode, company_Address, company_DetAddress, company_comment) values (@company_name, @company_type, @company_ceo, @company_cnum, @company_btype, @company_gtype, @company_email, @company_phone, @company_fax, @company_ZipCode, @company_Address, @company_DetAddress, @company_comment)"; using (SqlCommand cmd = new SqlCommand(sql, conn)) { cmd.Parameters.AddWithValue("@company_name", vo.company_name); cmd.Parameters.AddWithValue("@company_type", vo.company_type); cmd.Parameters.AddWithValue("@company_ceo", vo.company_ceo); cmd.Parameters.AddWithValue("@company_cnum", vo.company_cnum); cmd.Parameters.AddWithValue("@company_btype", vo.company_btype); cmd.Parameters.AddWithValue("@company_gtype", vo.company_gtype); cmd.Parameters.AddWithValue("@company_email", vo.company_email); cmd.Parameters.AddWithValue("@company_phone", vo.company_phone); cmd.Parameters.AddWithValue("@company_fax", vo.company_fax); cmd.Parameters.AddWithValue("@company_ZipCode", vo.company_ZipCode); cmd.Parameters.AddWithValue("@company_Address", vo.company_Address); cmd.Parameters.AddWithValue("@company_DetAddress", vo.company_DetAddress); cmd.Parameters.AddWithValue("@company_comment", vo.company_comment); int iRowAffect = cmd.ExecuteNonQuery(); conn.Close(); return(iRowAffect > 0); } } catch (Exception) { throw; } }
public EMPTemplate(CompanyVO emp) { this.Id = BaseTemplate.COMPANY_TEMPLATE; this._emp = emp; }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtCodeCompany.Text == "" || txtNameCompany.Text == "" || cboCompanyType.SelectedIndex == 0) { MessageBox.Show("필수항목이 입력되지 않았습니다, 다시 확인해주세요", "입력확인", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); this.DialogResult = DialogResult.None; return; } CompanyVO VO = new CompanyVO(); VO.company_code = txtCodeCompany.Text; VO.company_name = txtNameCompany.Text; VO.company_type = cboCompanyType.SelectedValue.ToString(); VO.company_gtype = txtGtype.Text; VO.user_id = Convert.ToInt32(cboUser.SelectedValue); VO.company_email = txtEmail.Text; VO.company_phone = txtPhone.Text; VO.company_fax = txtFax.Text; VO.company_yn = cboYN.SelectedValue.ToString(); VO.company_comment = txtComment.Text; VO.company_uadmin = txtAdmin.Text; VO.company_udate = txtUdate.Text; VO.company_cnum = txtCnum.Text; VO.company_ceo = txtCEO.Text; VO.company_btype = txtbtype.Text; bool bResult = false; if (mode == EditMode.Input) { bResult = R_service.InsertCompany(VO); if (bResult) { // MessageBox.Show("등록성공"); this.DialogResult = DialogResult.OK; } else if (!bResult) { // MessageBox.Show("등록실패"); this.DialogResult = DialogResult.None; return; } } if (mode == EditMode.Update) { VO.company_order_code = txtOrder_code.Text; VO.company_id = Convert.ToInt32(lblID.Text); bResult = R_service.UpdateCompany(VO); if (bResult) { // MessageBox.Show("수정성공"); this.DialogResult = DialogResult.OK; } else if (!bResult) { // MessageBox.Show("수정실패"); this.DialogResult = DialogResult.None; return; } } } catch (NullReferenceException err) { MessageBox.Show("입력되지 않은값이 있습니다, 다시 확인해주세요", "입력확인", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.None; return; } catch (Exception err) { string str = err.Message; } }
public bool InsertCompany(CompanyVO vo) { return(dac.InsertCompany(vo)); }
public bool UpdateCompany(CompanyVO item) { CompanyDAC dac = new CompanyDAC(); return(dac.UpdateCompany(item)); }
public bool InsertCompany(CompanyVO item) { CompanyDAC dac = new CompanyDAC(); return(dac.InsertCompany(item)); }
public bool UpdateCompany(CompanyVO vo) { return(dac.UpdateCompany(vo)); }
///<returns></returns> /// <summary> /// 저장하기 /// </summary> public bool SaveCompany(CompanyVO company, List <ProductSimpleVO> prodListVO) { return(dac.SaveCompany(company, prodListVO)); }
// GET: Home public ActionResult Index() { HomeVO homevo = new HomeVO(); HomeDac hdac = new HomeDac(); List <UserVO> userlist = hdac.GetLastestUsers(); homevo.Userlist = userlist; HomeDac hdac1 = new HomeDac(); homevo.WorkRate = hdac1.GetWorkRate(); HomeDac hdac2 = new HomeDac(); homevo.CompanyCount = hdac2.GetCompanyCount(); List <CompanyVO> clist = hdac2.GetCompanyCount(); CompanyVO result = new CompanyVO(); result.sum = clist.Sum(item => item.sum); result.month = clist[1].sum; homevo.CompanyData = result; HomeDac hdac3 = new HomeDac(); homevo.SalseRate = hdac3.GetSalesRate(); homevo.SalesPrice = string.Format("{0:c}", Convert.ToInt32(homevo.SalseRate[1].price)); homevo.SalesRateToView = ((homevo.SalseRate[1].price / homevo.SalseRate[0].price) * 100).ToString("#.0") + "%"; if ((homevo.SalseRate[1].price / homevo.SalseRate[0].price) * 100 > 100) { homevo.SalesRateBool = true; } else { homevo.SalesRateBool = false; homevo.SalesRateToView = (100 - ((homevo.SalseRate[1].price / homevo.SalseRate[0].price) * 100)).ToString() + "%"; } HomeDac hdac4 = new HomeDac(); homevo.Orderlist = hdac4.GetLastestOrderList(); //OrderDac oDac = new OrderDAC(); //List<OrderStatsVO> list = oDac.GetOrderBestProduct(); //var listStat = from stat in list // orderby stat.MM // group stat by stat.ProductName; //List<string> keys = new List<string>(); //StringBuilder sb = new StringBuilder(); //string data1 = string.Empty, data2 = string.Empty, data3 = string.Empty; //int k = 0; //foreach (var group in listStat) //{ // keys.Add(group.Key); // List<int> qtys = new List<int>(); // foreach (var product in group) // { // if (k == 0) // { // sb.Append(product.MM + "월,"); // } // qtys.Add(product.Qty); // } // if (k == 0) // data1 = "[" + string.Join(",", qtys.ToArray()) + "]"; // else if (k == 1) // data2 = "[" + string.Join(",", qtys.ToArray()) + "]"; // else if (k == 2) // data3 = "[" + string.Join(",", qtys.ToArray()) + "]"; // k++; // qtys.Clear(); //} //string labels = sb.ToString().TrimEnd(','); //string label1 = keys[0]; //string label2 = keys[1]; //string label3 = keys[2]; //ViewBag.Label1 = label1; //ViewBag.Data1 = data1; //ViewBag.Label2 = label2; //ViewBag.Data2 = data2; //ViewBag.Label3 = label3; //ViewBag.Data3 = data3; return(View(homevo)); }
private CompanyVO FEMP(EMP_Empresa empin) { CompanyVO aux = new CompanyVO(); aux.id = empin.Id.ToString(); aux.name = empin.Nombre; aux.latitude = empin.Latitud; aux.longitude = empin.Longitud; aux.direction = empin.Ciudad + ", " + empin.Urbanizacion + " " + empin.Calle; aux.website = empin.PaginaWeb; aux.facebook = empin.Facebook; aux.twitter = empin.Twitter; //aux.objective = empin.o; aux.email = empin.Correo; aux.type = "empresa"; aux.beneficiarios = getEMPbeneficiario(empin.Id); aux.awards = getEMPaward(empin.Id); aux.areas = getEMParea(empin.Id); if (empin.Logo != null) aux.imgdata = empin.Logo.ToArray(); return aux; }
/// <summary> /// CompanyVO 타입으로 선언한 vo에 각 텍스트 내용을 담아서 DAC단의 파라미터로 전달 /// 수정의 경우 수정자는 현재 로그인계정, 수정일은 현재 날짜 ToShortDateString /// 작성자: 최현호 / 작성일: 210210 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEdit_Click(object sender, EventArgs e) { #region 등록 및 수정 try { if (label1.Text == "업체관리 등록") { CompanyVO vo = new CompanyVO { company_name = txtCName.Text, company_type = cbCType.Text, company_ceo = txtCCeo.Text, company_cnum = txtCNum.Text, company_btype = txtCBtype.Text, company_gtype = txtCGtype.Text, company_email = txtCEmail.Text, company_phone = txtCPNum.Text, company_fax = txtCFax.Text, company_ZipCode = txtZipCode.Text, company_Address = txtAddress.Text, company_DetAddress = txtDetAddress.Text, company_comment = txtComment.Text, }; bool result = service.Insert(vo); if (result) { MessageBox.Show(Properties.Resources.msgOK); this.Close(); } else { MessageBox.Show(Properties.Resources.msgError); } } else if (label1.Text == "업체관리 수정") { CompanyVO vo = new CompanyVO { company_id = int.Parse(lblCompanyID.Text), company_name = txtCName.Text, company_type = cbCType.Text, company_ceo = txtCCeo.Text, company_cnum = txtCNum.Text, company_btype = txtCBtype.Text, company_gtype = txtCGtype.Text, company_email = txtCEmail.Text, company_phone = txtCPNum.Text, company_fax = txtCFax.Text, company_ZipCode = txtZipCode.Text, company_Address = txtAddress.Text, company_DetAddress = txtDetAddress.Text, company_comment = txtComment.Text, company_uadmin = LoginVO.user.Name, company_udate = DateTime.Now.ToShortDateString() }; bool result = service.Update(vo); if (result) { MessageBox.Show(Properties.Resources.msgOK); this.Close(); } else { MessageBox.Show(Properties.Resources.msgError); } } } catch (Exception err) { MessageBox.Show(err.Message); } #endregion }
public bool Update(CompanyVO vo) { CompanyDAC dac = new CompanyDAC(); return(dac.Update(vo)); }
public bool Insert(CompanyVO vo) { CompanyDAC dac = new CompanyDAC(); return(dac.Insert(vo)); }
/// <returns></returns> ///<summary> /// 저장하기 /// </summary public bool SaveCompany(CompanyVO company, List <ProductSimpleVO> prodListVO) { try { using (SqlConnection conn = new SqlConnection(this.ConnectionString)) { conn.Open(); string sql = @"SP_SAVE_COMPANY"; using (SqlCommand cmd = new SqlCommand(sql, conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@P_company_id", company.company_id); cmd.Parameters.AddWithValue("@P_company_name", company.company_name); cmd.Parameters.AddWithValue("@P_company_type", company.company_type); cmd.Parameters.AddWithValue("@P_company_seq", company.company_seq); cmd.Parameters.AddWithValue("@P_first_regist_employee", company.first_regist_employee); cmd.Parameters.AddWithValue("@P_final_regist_employee", company.final_regist_employee); SqlParameter param1 = new SqlParameter("@O_company_id", SqlDbType.Int); param1.Direction = ParameterDirection.Output; cmd.Parameters.Add(param1); int result = cmd.ExecuteNonQuery(); if (result > 0) { if (company.company_id != 0) { string sqlDelete = @"Delete from TBL_COMPANY_PRODUCT where company_id = @company_id"; cmd.CommandText = sqlDelete; cmd.CommandType = CommandType.Text; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@company_id", company.company_id); cmd.ExecuteNonQuery(); foreach (var item in prodListVO) { string sqlInsert = @"Insert into TBL_COMPANY_PRODUCT(company_id, product_id) values(@company_id, @product_id)"; cmd.CommandText = sqlInsert; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@company_id", company.company_id); cmd.Parameters.AddWithValue("@product_id", item.Product_ID); cmd.ExecuteNonQuery(); } } else { foreach (var item in prodListVO) { string sqlInsert = @"Insert into TBL_COMPANY_PRODUCT(company_id, product_id) values(@company_id, @product_id)"; cmd.CommandText = sqlInsert; cmd.CommandType = CommandType.Text; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@company_id", param1.Value); cmd.Parameters.AddWithValue("@product_id", item.Product_ID); cmd.ExecuteNonQuery(); } } } } } return(true); } catch (Exception err) { throw err; //return false; } }