public int InsertSupplier(EntitySupplier entSupplier) { int cnt = 0; try { List <SqlParameter> lstParam = new List <SqlParameter>(); Commons.ADDParameter(ref lstParam, "@SupplierCode", DbType.String, entSupplier.SupplierCode); Commons.ADDParameter(ref lstParam, "@SupplierName", DbType.String, entSupplier.SupplierName); Commons.ADDParameter(ref lstParam, "@Address", DbType.String, entSupplier.Address); Commons.ADDParameter(ref lstParam, "@PhoneNo", DbType.String, entSupplier.PhoneNo); Commons.ADDParameter(ref lstParam, "@MobileNo", DbType.String, entSupplier.MobileNo); Commons.ADDParameter(ref lstParam, "@VATCSTNo", DbType.String, entSupplier.VATCSTNo); Commons.ADDParameter(ref lstParam, "@ExciseNo", DbType.String, entSupplier.ExciseNo); Commons.ADDParameter(ref lstParam, "@Email", DbType.String, entSupplier.Email); Commons.ADDParameter(ref lstParam, "@ServiceTaxNo", DbType.String, entSupplier.ServiceTaxNo); Commons.ADDParameter(ref lstParam, "@EntryBy", DbType.String, entSupplier.EntryBy); cnt = mobjDataAcces.ExecuteQuery("sp_InsertSupplier ", lstParam); } catch (Exception ex) { throw ex; } return(cnt); }
public int UpdateSupplier(EntitySupplier entity) { string SqlStr = ""; SqlStr = "update tc_supplier set "; SqlStr += "Supplier_code = '" + entity.Supplier_code.Trim() + "' "; SqlStr += ",Supplier_name = '" + entity.Supplier_name.Trim() + "' "; SqlStr += ",Supplier_yxm = '" + entity.Supplier_yxm.Trim() + "' "; SqlStr += ",Supplier_address = '" + entity.Supplier_address.Trim() + "' "; SqlStr += ",Supplier_artificial_person = '" + entity.Supplier_artificial_person.Trim() + "' "; SqlStr += ",Supplier_business_scpoe = '" + entity.Supplier_business_scpoe.Trim() + "' "; SqlStr += ",Supplier_licence = '" + entity.Supplier_licence.Trim() + "' "; SqlStr += ",Supplier_trustpersion = '" + entity.Supplier_trustpersion.Trim() + "' "; SqlStr += ",Supplier_tariff_num = '" + entity.Supplier_tariff_num.Trim() + "' "; SqlStr += ",Supplier_principal = '" + entity.Supplier_principal.Trim() + "' "; SqlStr += ",Supplier_bank = '" + entity.Supplier_bank.Trim() + "' "; SqlStr += ",Supplier_bank_num = '" + entity.Supplier_bank_num.Trim() + "' "; SqlStr += ",Supplier_tel = '" + entity.Supplier_tel.Trim() + "' "; SqlStr += ",Supplier_fax = '" + entity.Supplier_fax.Trim() + "' "; SqlStr += ",Supplier_business_licence = '" + entity.Supplier_business_licence.Trim() + "' "; SqlStr += ",Supplier_postal_code = '" + entity.Supplier_postal_code.Trim() + "' "; SqlStr += ",Supplier_make_quality_num = '" + entity.Supplier_make_quality_num.Trim() + "' "; SqlStr += ",Supplier_business_num = '" + entity.Supplier_business_num.Trim() + "' "; SqlStr += ",Supplier_type = '" + entity.Supplier_type.Trim() + "' "; SqlStr += " where supplier_code = '" + entity.Supplier_code.Trim() + "' "; SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = SqlStr; ExcuteSql(sqlCommand); return(Constants.SystemConfig.SERVER_SUCCESS); }
public int InsertSupplier(EntitySupplier entitySupplier) { string SqlStr = ""; SqlStr = "insert into TC_SUPPLIER"; SqlStr += " values('" + entitySupplier.Supplier_code.Trim() + "','" + entitySupplier.Supplier_name.Trim() + "','" + entitySupplier.Supplier_yxm.Trim() + "','" + entitySupplier.Supplier_address.Trim() + "','" + entitySupplier.Supplier_artificial_person.Trim() + "','" + entitySupplier.Supplier_business_scpoe.Trim() + "','" + entitySupplier.Supplier_licence.Trim() + "','" + entitySupplier.Supplier_trustpersion.Trim() + "','" + entitySupplier.Supplier_tariff_num.Trim() + "','" + entitySupplier.Supplier_principal.Trim() + "','" + entitySupplier.Supplier_bank.Trim() + "','" + entitySupplier.Supplier_bank_num.Trim() + "','" + entitySupplier.Supplier_tel.Trim() + "','" + entitySupplier.Supplier_fax.Trim() + "','" + entitySupplier.Supplier_business_licence.Trim() + "','" + entitySupplier.Supplier_postal_code.Trim() + "','" + entitySupplier.Supplier_make_quality_num.Trim() + "','" + entitySupplier.Supplier_business_num.Trim() + "','" + entitySupplier.Supplier_type.Trim() + "')"; SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = SqlStr; ExcuteSql(sqlCommand); return(Constants.SystemConfig.SERVER_SUCCESS); }
internal static Supplier Map(EntitySupplier entity) { return(new Supplier { SupplierId = entity.SupplierId, Name = entity.Name }); }
public EntitySupplier GetSupplier(EntitySupplier entSupplier) { EntitySupplier ent = (from tbl in objData.tblSupplierMasters where tbl.VATCSTNo.Equals(entSupplier.VATCSTNo) select new EntitySupplier { VATCSTNo = tbl.VATCSTNo }).FirstOrDefault(); return(ent); }
public static Invoice Create( DateTime issueDate, DateTime dueDate, List <InvoiceItem> items, List <InvoicePayment> payments, EntitySupplier supplier, EntityReceiver reciever ) { return(new Invoice(null, issueDate, dueDate, null, items, payments, supplier, reciever)); }
public int AddSupplier(Supplier supplier) { using (var context = DataObjectFactory.CreateContext()) { var entity = new EntitySupplier { Name = supplier.Name }; context.Suppliers.Add(entity); context.SaveChanges(); return(entity.SupplierId); } }
protected void BtnSave_Click(object sender, EventArgs e) { int lintcnt = 0; EntitySupplier entSupplier = new EntitySupplier(); if (string.IsNullOrEmpty(txtSupplierCode.Text.Trim())) { lblMsg.Text = "Please Enter Discount Code"; } else { if (string.IsNullOrEmpty(txtSupplierName.Text.Trim())) { lblMsg.Text = "Please Enter Supplier Name"; txtSupplierName.Focus(); return; } else { entSupplier.SupplierCode = txtSupplierCode.Text.Trim(); entSupplier.SupplierName = txtSupplierName.Text.Trim(); entSupplier.Address = txtAddress.Text.Trim(); entSupplier.PhoneNo = txtPhoneNo.Text.Trim(); entSupplier.MobileNo = txtMobileNo.Text.Trim(); entSupplier.VATCSTNo = txtVATCSTNo.Text.Trim(); entSupplier.ExciseNo = txtExciseNo.Text.Trim(); entSupplier.Email = txtEmail.Text.Trim(); entSupplier.ServiceTaxNo = txtServiceTaxNo.Text.Trim(); entSupplier.EntryBy = SessionWrapper.UserName; if (!Commons.IsRecordExists("tblSupplierMaster", "VATCSTNo", entSupplier.VATCSTNo)) { lintcnt = mobjSupplierBLL.InsertSupplier(entSupplier); if (lintcnt > 0) { GetSupplier(); lblMessage.Text = "Record Inserted Successfully"; } else { lblMessage.Text = "Record Not Inserted"; } } else { lblMessage.Text = "Record Already Exist..."; } } MultiView1.SetActiveView(View1); } }
public int DeleteSupplier(EntitySupplier entSupplier) { int cnt = 0; try { List <SqlParameter> lstParam = new List <SqlParameter>(); Commons.ADDParameter(ref lstParam, "@SupplierCode", DbType.String, entSupplier.SupplierCode); cnt = mobjDataAcces.ExecuteQuery("sp_DeleteSupplier", lstParam); } catch (Exception ex) { throw ex; } return(cnt); }
public void Refresh(Box2D box) { // sanity check if (null == Parent || null == _picGraphics) { return; } try { // clear factory _factory.Clear(); // create entities if (null == EntitySupplier) { if (Parent is IEntitySupplier) { EntitySupplier = Parent as IEntitySupplier; } else { _log.Debug(string.Format("Interface IEntitySupplier is not implemented by parent {0}", Parent.Name)); } } if (null != EntitySupplier) { EntitySupplier.CreateEntities(_factory); } // apply transformations if (_reflectionX) { _factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX)); } if (_reflectionY) { _factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY)); } } catch (Exception ex) { _log.Error(ex.ToString()); } if (null != box) { _picGraphics.DrawingBox = box; } base.Refresh(); }
// F2ボタン(クリア) クリック public override void btnF2_Click(object sender, RoutedEventArgs e) { // 初期化 _entity = null; SetBinding(); this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.InitKbn; ExVisualTreeHelper.SetEnabled(this.MainDetail, false); this.utlID.txtID_IsReadOnly = false; this.utlID.txtID.Text = ""; this.utlCustomer.txtID_IsReadOnly = false; ExBackgroundWorker.DoWork_Focus(this.utlCustomer.txtID, 10); // ロック解除 DataPgLock.gLockPg(PG_NM, "", (int)DataPgLock.geLockType.UnLock); }
public InvoiceDomain ToDomain( List <InvoiceItem> items, List <InvoicePayment> payments, EntitySupplier supplier, EntityReceiver receiver ) { return(new InvoiceDomain( new SimpleObjectIdentifier(Id ?? throw new DataException("InvoiceEntity Id is null")), IssueDate, DueDate, RedemptionDate, items, payments, supplier, receiver )); }
protected void BtnEdit_Click(object sender, EventArgs e) { int lintCnt = 0; try { EntitySupplier entSupplier = new EntitySupplier(); entSupplier.SupplierCode = txtSupplierCode.Text; entSupplier.SupplierName = txtSupplierName.Text; entSupplier.Address = txtAddress.Text; entSupplier.PhoneNo = txtPhoneNo.Text; entSupplier.MobileNo = txtMobileNo.Text; entSupplier.VATCSTNo = txtVATCSTNo.Text; entSupplier.ExciseNo = txtExciseNo.Text; entSupplier.Email = txtEmail.Text; entSupplier.ServiceTaxNo = txtServiceTaxNo.Text; entSupplier.ChangeBy = SessionWrapper.UserName; if (mobjSupplierBLL.GetSupplier(entSupplier) != null) { lintCnt = mobjSupplierBLL.UpdateSupplier(entSupplier); if (lintCnt > 0) { GetSupplier(); lblMessage.Text = "Record Updated Successfully"; } else { lblMessage.Text = "Record Not Updated"; } } else { lblMessage.Text = "Record Already Exist..."; } } catch (Exception ex) { lblMessage.Text = ex.Message; } MultiView1.SetActiveView(View1); }
public Invoice( IObjectIdentifier <ulong> id, DateTime issueDate, DateTime dueDate, DateTime?redemptionDate, List <InvoiceItem> items, List <InvoicePayment> payments, EntitySupplier supplier, EntityReceiver receiver ) { Id = id; IssueDate = issueDate; DueDate = dueDate; RedemptionDate = redemptionDate; Items = items; Payments = payments; Supplier = supplier; Receiver = receiver; }
//*********************************************************************** /// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// 完成信息:李梓楠 2010/07/13 完成 /// 更新信息: /// </history> //*********************************************************************** private void btnCommit_Click(object sender, EventArgs e) { if (txtSupplier_name.Text.Trim() == string.Empty) { MessageBox.Show("供货商名称不能为空!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); txtSupplier_name.Focus(); return; } if (txtSupplier_licence.Text.Trim() == string.Empty) { MessageBox.Show("许可证编号不能为空!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); txtSupplier_licence.Focus(); return; } if (cb_Supplier_type.SelectedIndex == 0) { MessageBox.Show("供货商分类不能为空!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); cb_Supplier_type.Focus(); return; } foreach (Control control in groupBox1.Controls) { if (control is TextBox) { if (Util.CheckRegex(control.Text.Trim()) && !((TextBox)control).ReadOnly) { MessageBox.Show("不可以输入非法字符,请重新输入!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); control.Focus(); return; } } } EntitySupplier entitySupplier = new EntitySupplier(); try { result = -1; //如果是添加 if (dataType == DataType.Insert) { entitySupplier.Supplier_code = txtSupplier_code.Text; entitySupplier.Supplier_name = txtSupplier_name.Text; entitySupplier.Supplier_yxm = txtSupplier_yxm.Text; entitySupplier.Supplier_address = txtSupplier_address.Text; entitySupplier.Supplier_artificial_person = txtSupplier_artificial_person.Text; entitySupplier.Supplier_business_scpoe = txtSupplier_business_scpoe.Text; entitySupplier.Supplier_licence = txtSupplier_licence.Text; entitySupplier.Supplier_trustpersion = txtSupplier_trustpersion.Text; entitySupplier.Supplier_tariff_num = txtSupplier_tariff_num.Text; entitySupplier.Supplier_principal = txtSupplier_principal.Text; entitySupplier.Supplier_bank = txtSupplier_bank.Text; entitySupplier.Supplier_bank_num = txtSupplier_bank_num.Text; entitySupplier.Supplier_tel = txtSupplier_tel.Text; entitySupplier.Supplier_fax = txtSupplier_fax.Text; entitySupplier.Supplier_business_licence = txtSupplier_business_licence.Text; entitySupplier.Supplier_postal_code = txtSupplier_postal_code.Text; entitySupplier.Supplier_make_quality_num = txtSupplier_make_quality_num.Text; entitySupplier.Supplier_business_num = txtSupplier_business_num.Text; entitySupplier.Supplier_type = cb_Supplier_type.Text; dataAccess = new DataAccess(); dataAccess.Open(); MakePrimaryKey primaryKey = new MakePrimaryKey(dataAccess.Connection, dataAccess.Transaction); entitySupplier.Supplier_code = primaryKey.MakeCode("供货商"); GetData getData = new GetData(dataAccess.Connection); if (getData.InsertIsOnly("tc_supplier", "supplier_name", txtSupplier_name.Text.Trim())) { MessageBox.Show("您输入的供货商名称已经存在,请更改供货商名称后再保存!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); txtSupplier_name.Focus(); return; } result = getData.InsertSupplier(entitySupplier); } //如果是更新 else if (dataType == DataType.Update) { //给选中行赋值 countNum = dgv.SelectedRows[0].Index; entitySupplier.Supplier_code = txtSupplier_code.Text; entitySupplier.Supplier_name = txtSupplier_name.Text; entitySupplier.Supplier_yxm = txtSupplier_yxm.Text; entitySupplier.Supplier_address = txtSupplier_address.Text; entitySupplier.Supplier_artificial_person = txtSupplier_artificial_person.Text; entitySupplier.Supplier_business_scpoe = txtSupplier_business_scpoe.Text; entitySupplier.Supplier_licence = txtSupplier_licence.Text; entitySupplier.Supplier_trustpersion = txtSupplier_trustpersion.Text; entitySupplier.Supplier_tariff_num = txtSupplier_tariff_num.Text; entitySupplier.Supplier_principal = txtSupplier_principal.Text; entitySupplier.Supplier_bank = txtSupplier_bank.Text; entitySupplier.Supplier_bank_num = txtSupplier_bank_num.Text; entitySupplier.Supplier_tel = txtSupplier_tel.Text; entitySupplier.Supplier_fax = txtSupplier_fax.Text; entitySupplier.Supplier_business_licence = txtSupplier_business_licence.Text; entitySupplier.Supplier_postal_code = txtSupplier_postal_code.Text; entitySupplier.Supplier_make_quality_num = txtSupplier_make_quality_num.Text; entitySupplier.Supplier_business_num = txtSupplier_business_num.Text; entitySupplier.Supplier_type = cb_Supplier_type.Text; dataAccess = new DataAccess(); dataAccess.Open(); dataAccess.BeginTransaction(); GetData getData = new GetData(dataAccess.Connection, dataAccess.Transaction); if (getData.UpdateIsOnly("tc_supplier", "supplier_code", entitySupplier.Supplier_code, "supplier_name", txtSupplier_name.Text.Trim())) { MessageBox.Show("您输入的供货商名称已经存在,请更改供货商名称后再保存!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); txtSupplier_name.Focus(); return; } //取得结果符 result = getData.UpdateSupplier(entitySupplier); //提交事务 dataAccess.Commit(); } } catch (Exception ex) { if (dataAccess.Transaction != null) { //回滚 dataAccess.Rollback(); MessageBox.Show("数据保存时发生错误,请检查数据库!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } finally { //关闭数据库连接 if (dataAccess != null) { dataAccess.Close(); } } if (result == 0) { MessageBox.Show("数据已经保存成功!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("数据保存时发生错误,请检查数据库!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } BandingDgv(); //设置按钮状态 dataType = DataType.None; setButtonState(); }
public override void DataSelect(int intKbn, object objList) { switch ((ExWebService.geWebServiceCallKbn)intKbn) { case _GetWebServiceCallKbn: // 更新 if (objList != null) { _entity = (EntitySupplier)objList; if (_entity.message != "" && _entity.message != null) { this.utlID.txtID.Text = ""; ExBackgroundWorker.DoWork_Focus(this.utlID, 10); return; } else { ExVisualTreeHelper.SetEnabled(this.MainDetail, true); // バインド反映 SetBinding(); if (_entity._lock_flg == 0) { this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd; } else { this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel; } } } // 新規 else { _entity = new EntitySupplier(); ExVisualTreeHelper.SetEnabled(this.MainDetail, true); SetBinding(); this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.New; } this.utlID.txtID_IsReadOnly = true; this.utlCustomer.txtID_IsReadOnly = true; ExBackgroundWorker.DoWork_Focus(this.txtName, 10); break; case ExWebService.geWebServiceCallKbn.GetCustomer: // 更新 if (objList != null) { EntityCustomer entityCustomer = (EntityCustomer)objList; if (string.IsNullOrEmpty(entityCustomer.message)) { string _Id = ExCast.zNumZeroNothingFormat(this.utlID.txtID.Text.Trim()); string _Nm = this.utlID.txtNm.Text.Trim(); string _customerId = ExCast.zNumZeroNothingFormat(this.utlCustomer.txtID.Text.Trim()); string _customerNm = this.utlCustomer.txtNm.Text.Trim(); _entity = new EntitySupplier(); _entity._id = _Id; _entity._customer_id = _customerId; _entity._customer_nm = _customerNm; _entity._name = entityCustomer._name; _entity._kana = entityCustomer._kana; _entity._about_name = entityCustomer._about_name; //_entity._zip_code = entityCustomer._zip_code; _entity._adress_city = entityCustomer._adress_city; _entity._adress_town = entityCustomer._adress_town; _entity._adress1 = entityCustomer._adress1; _entity._adress2 = entityCustomer._adress2; _entity._station_name = entityCustomer._station_name; _entity._post_name = entityCustomer._post_name; _entity._person_name = entityCustomer._person_name; _entity._title_id = entityCustomer._title_id; _entity._title_name = entityCustomer._title_name; _entity._tel = entityCustomer._tel; _entity._fax = entityCustomer._fax; _entity._mail_adress = entityCustomer._mail_adress; _entity._mobile_tel = entityCustomer._mobile_tel; _entity._mobile_adress = entityCustomer._mobile_adress; _entity._url = entityCustomer._url; SetBinding(); return; } } break; default: break; } }
private void SetBinding() { bool is_null = false; if (_entity == null) { _entity = new EntitySupplier(); is_null = true; } // マスタコントロールPropertyChanged _entity.PropertyChanged += this.utlCustomer.MstID_Changed; _entity.PropertyChanged += this.utlZip.MstID_Changed; NumberConverter nmConvDecm0 = new NumberConverter(); #region Bind string _customerId = ExCast.zNumZeroNothingFormat(this.utlCustomer.txtID.Text.Trim()); string _customerNm = this.utlCustomer.txtNm.Text.Trim(); // バインド Binding BindingCustomerId = new Binding("_customer_id"); BindingCustomerId.Mode = BindingMode.TwoWay; BindingCustomerId.Source = _entity; this.utlCustomer.txtID.SetBinding(TextBox.TextProperty, BindingCustomerId); this.utlID.txtID2.SetBinding(TextBox.TextProperty, BindingCustomerId); Binding BindingCustomerName = new Binding("_customer_nm"); BindingCustomerName.Mode = BindingMode.TwoWay; BindingCustomerName.Source = _entity; this.utlCustomer.txtNm.SetBinding(TextBox.TextProperty, BindingCustomerName); if (is_null == false) { this.utlCustomer.txtID.Text = _customerId; this.utlCustomer.txtNm.Text = _customerNm; } Binding BindingName = new Binding("_name"); BindingName.Mode = BindingMode.TwoWay; BindingName.Source = _entity; this.txtName.SetBinding(TextBox.TextProperty, BindingName); Binding BindingKana = new Binding("_kana"); BindingKana.Mode = BindingMode.TwoWay; BindingKana.Source = _entity; this.txtKana.SetBinding(TextBox.TextProperty, BindingKana); Binding BindingAboutName = new Binding("_about_name"); BindingAboutName.Mode = BindingMode.TwoWay; BindingAboutName.Source = _entity; this.txtAdoutName.SetBinding(TextBox.TextProperty, BindingAboutName); Binding BindingZipCodeFrom = new Binding("_zip_code_from"); BindingZipCodeFrom.Mode = BindingMode.TwoWay; BindingZipCodeFrom.Source = _entity; this.utlZip.txtZipNo1.SetBinding(TextBox.TextProperty, BindingZipCodeFrom); Binding BindingZipCodeTo = new Binding("_zip_code_to"); BindingZipCodeTo.Mode = BindingMode.TwoWay; BindingZipCodeTo.Source = _entity; this.utlZip.txtZipNo2.SetBinding(TextBox.TextProperty, BindingZipCodeTo); this.utlZip.is_zip_from_first_flg = true; this.utlZip.is_zip_to_first_flg = true; Binding BindingAdress1 = new Binding("_adress1"); BindingAdress1.Mode = BindingMode.TwoWay; BindingAdress1.Source = _entity; this.utlZip.SetBinding(Utl_Zip.UserControlAdress1Property, BindingAdress1); Binding BindingAdress2 = new Binding("_adress2"); BindingAdress2.Mode = BindingMode.TwoWay; BindingAdress2.Source = _entity; this.utlZip.SetBinding(Utl_Zip.UserControlAdress2Property, BindingAdress2); Binding BindingStationName = new Binding("_station_name"); BindingStationName.Mode = BindingMode.TwoWay; BindingStationName.Source = _entity; this.txtStationName.SetBinding(TextBox.TextProperty, BindingStationName); Binding BindingPostName = new Binding("_post_name"); BindingPostName.Mode = BindingMode.TwoWay; BindingPostName.Source = _entity; this.txtPostName.SetBinding(TextBox.TextProperty, BindingPostName); Binding BindingPersonName = new Binding("_person_name"); BindingPersonName.Mode = BindingMode.TwoWay; BindingPersonName.Source = _entity; this.txtPersonName.SetBinding(TextBox.TextProperty, BindingPersonName); Binding BindingTitleId = new Binding("_title_id"); BindingTitleId.Mode = BindingMode.TwoWay; BindingTitleId.Source = _entity; this.utlTitle.txtID.SetBinding(TextBox.TextProperty, BindingTitleId); Binding BindingTitleName = new Binding("_title_name"); BindingTitleName.Mode = BindingMode.TwoWay; BindingTitleName.Source = _entity; this.utlTitle.txtNm.SetBinding(TextBox.TextProperty, BindingTitleName); Binding BindingTel = new Binding("_tel"); BindingTel.Mode = BindingMode.TwoWay; BindingTel.Source = _entity; this.txtTel.SetBinding(TextBox.TextProperty, BindingTel); Binding BindingFax = new Binding("_fax"); BindingFax.Mode = BindingMode.TwoWay; BindingFax.Source = _entity; this.txtFax.SetBinding(TextBox.TextProperty, BindingFax); Binding BindingMailAdress = new Binding("_mail_adress"); BindingMailAdress.Mode = BindingMode.TwoWay; BindingMailAdress.Source = _entity; this.txtMail.SetBinding(TextBox.TextProperty, BindingMailAdress); Binding BindigDiaplayDivisionId = new Binding("_display_division_id"); BindigDiaplayDivisionId.Mode = BindingMode.TwoWay; BindigDiaplayDivisionId.Source = _entity; this.utlDisplay.txtID.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionId); Binding BindigDiaplayDivisionNm = new Binding("_display_division_nm"); BindigDiaplayDivisionNm.Mode = BindingMode.TwoWay; BindigDiaplayDivisionNm.Source = _entity; this.utlDisplay.txtNm.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionNm); Binding BindigMemo = new Binding("_memo"); BindigMemo.Mode = BindingMode.TwoWay; BindigMemo.Source = _entity; this.txtMemo.SetBinding(TextBox.TextProperty, BindigMemo); #endregion if (ExCast.IsNumeric(this.utlID.txtID.Text.Trim())) { this.utlID.txtID.SetZeroToNullString(); } this.utlID.txtID.FormatToID(); this.utlTitle.txtID.SetZeroToNullString(); this.utlCustomer.txtID.SetZeroToNullString(); this.utlCustomer.txtID.FormatToID(); if (ExCast.zCInt(_entity._id) == 0) { _entity._divide_permission_id = 2; _entity._display_division_id = 1; } }
public EntitySupplier GetSupplier(string random, string CustomerId, string Id) { EntitySupplier entity; #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { entity = new EntitySupplier(); entity.MESSAGE = _message; return(entity); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetSupplier(認証処理)", ex); entity = new EntitySupplier(); entity.MESSAGE = CLASS_NM + ".GetSupplier : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; return(entity); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); #region SQL sb.Append("SELECT MT.* " + Environment.NewLine); sb.Append(" ,CM.NAME AS CUSTOMER_NAME " + Environment.NewLine); sb.Append(" ,NM1.DESCRIPTION AS DIVIDE_PERMISSION_NAME " + Environment.NewLine); sb.Append(" ,NM.DESCRIPTION AS DISPLAY_DIVISION_NAME " + Environment.NewLine); sb.Append(" FROM M_SUPPLIER AS MT" + Environment.NewLine); #region Join // 得意先 sb.Append(" LEFT JOIN M_CUSTOMER AS CM" + Environment.NewLine); sb.Append(" ON CM.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND CM.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND CM.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine); sb.Append(" AND CM.ID = MT.CUSTOMER_ID" + Environment.NewLine); // 分納許可 sb.Append(" LEFT JOIN SYS_M_NAME AS NM1" + Environment.NewLine); sb.Append(" ON NM1.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM1.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM1.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DIVIDE_PERMISSION_ID + Environment.NewLine); sb.Append(" AND NM1.ID = MT.DIVIDE_PERMISSION_ID" + Environment.NewLine); // 表示区分 sb.Append(" LEFT JOIN SYS_M_NAME AS NM" + Environment.NewLine); sb.Append(" ON NM.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DISPLAY_DIVISION_ID + Environment.NewLine); sb.Append(" AND NM.ID = MT.DISPLAY_FLG" + Environment.NewLine); #endregion sb.Append(" WHERE MT.COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND MT.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND MT.CUSTOMER_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(CustomerId)) + Environment.NewLine); sb.Append(" AND MT.ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(Id)) + Environment.NewLine); sb.Append(" ORDER BY MT.COMPANY_ID " + Environment.NewLine); sb.Append(" ,MT.ID " + Environment.NewLine); #endregion dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { entity = new EntitySupplier(); // 排他制御 DataPgLock.geLovkFlg lockFlg; string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, ExCast.zNumZeroNothingFormat(CustomerId) + "-" + ExCast.zNumZeroNothingFormat(Id), ipAdress, db, out lockFlg); if (strErr != "") { entity.MESSAGE = CLASS_NM + ".GetSupplier : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; } #region Set Entity entity.id = ExCast.zCStr(dt.DefaultView[0]["ID"]); entity.name = ExCast.zCStr(dt.DefaultView[0]["NAME"]); entity.kana = ExCast.zCStr(dt.DefaultView[0]["KANA"]); entity.about_name = ExCast.zCStr(dt.DefaultView[0]["ABOUT_NAME"]); string _zip = ExCast.zCStr(dt.DefaultView[0]["ZIP_CODE"]); if (!string.IsNullOrEmpty(_zip) && ExCast.zCStr(_zip) != "0") { _zip = string.Format("{0:0000000}", ExCast.zCDbl(_zip)); entity.zip_code_from = _zip.Substring(0, 3); entity.zip_code_to = _zip.Substring(3, 4); } else { entity.zip_code_from = ""; entity.zip_code_to = ""; } entity.prefecture_id = ExCast.zCInt(dt.DefaultView[0]["PREFECTURE_ID"]); entity.city_id = ExCast.zCInt(dt.DefaultView[0]["CITY_ID"]); entity.town_id = ExCast.zCInt(dt.DefaultView[0]["TOWN_ID"]); entity.adress_city = ExCast.zCStr(dt.DefaultView[0]["ADRESS_CITY"]); entity.adress_town = ExCast.zCStr(dt.DefaultView[0]["ADRESS_TOWN"]); entity.adress1 = ExCast.zCStr(dt.DefaultView[0]["ADRESS1"]); entity.adress2 = ExCast.zCStr(dt.DefaultView[0]["ADRESS2"]); entity.station_name = ExCast.zCStr(dt.DefaultView[0]["STATION_NAME"]); entity.post_name = ExCast.zCStr(dt.DefaultView[0]["POST_NAME"]); entity.person_name = ExCast.zCStr(dt.DefaultView[0]["PERSON_NAME"]); entity.title_id = ExCast.zCInt(dt.DefaultView[0]["TITLE_ID"]); entity.title_name = ExCast.zCStr(dt.DefaultView[0]["TITLE_NAME"]); entity.tel = ExCast.zCStr(dt.DefaultView[0]["TEL"]); entity.fax = ExCast.zCStr(dt.DefaultView[0]["FAX"]); entity.mail_adress = ExCast.zCStr(dt.DefaultView[0]["MAIL_ADRESS"]); entity.mobile_tel = ExCast.zCStr(dt.DefaultView[0]["MOBILE_TEL"]); entity.mobile_adress = ExCast.zCStr(dt.DefaultView[0]["MOBILE_ADRESS"]); entity.url = ExCast.zCStr(dt.DefaultView[0]["URL"]); entity.customer_id = ExCast.zCStr(dt.DefaultView[0]["CUSTOMER_ID"]); entity.customer_nm = ExCast.zCStr(dt.DefaultView[0]["CUSTOMER_NAME"]); entity.divide_permission_id = ExCast.zCInt(dt.DefaultView[0]["DISPLAY_FLG"]); entity.divide_permission_nm = ExCast.zCStr(dt.DefaultView[0]["DISPLAY_DIVISION_NAME"]); entity.display_division_id = ExCast.zCInt(dt.DefaultView[0]["DISPLAY_FLG"]); entity.display_division_nm = ExCast.zCStr(dt.DefaultView[0]["DISPLAY_DIVISION_NAME"]); entity.lock_flg = (int)lockFlg; entity.memo = ExCast.zCStr(dt.DefaultView[0]["MEMO"]); #endregion } else { entity = null; } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetSupplier", ex); entity = new EntitySupplier(); entity.MESSAGE = CLASS_NM + ".GetSupplier : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, "ID:" + Id.ToString()); return(entity); }
public string UpdateSupplier(string random, int type, string CustomerId, string Id, EntitySupplier entity) { #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; string personId = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); personId = ExCast.zCStr(HttpContext.Current.Session[ExSession.PERSON_ID]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { return(_message); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(認証処理)", ex); return(CLASS_NM + ".UpdateSupplier : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString()); } #endregion #region Field StringBuilder sb = new StringBuilder(); DataTable dt; ExMySQLData db = null; string _Id = ""; #endregion #region Databese Open try { db = new ExMySQLData(ExCast.zCStr(HttpContext.Current.Session[ExSession.DB_CONNECTION_STR])); db.DbOpen(); } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(DbOpen)", ex); return(CLASS_NM + ".UpdateSupplier(DbOpen) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region BeginTransaction try { db.ExBeginTransaction(); } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(BeginTransaction)", ex); return(CLASS_NM + ".UpdateSupplier(BeginTransaction) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Get Max Master ID if (type == 1 && (Id == "" || Id == "0")) { try { DataMasterId.GetMaxMasterId(companyId, ExCast.zNumZeroNothingFormat(CustomerId), db, DataMasterId.geMasterMaxIdKbn.Supplier, out _Id); if (_Id == "") { return("ID取得に失敗しました。"); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(GetMaxMasterId)", ex); return(CLASS_NM + ".UpdateSupplier(GetMaxMasterId) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } } else { _Id = Id; } #endregion #region Insert if (type == 1) { try { #region Delete SQL sb.Length = 0; sb.Append("DELETE FROM M_SUPPLIER " + Environment.NewLine); sb.Append(" WHERE DELETE_FLG = 1 " + Environment.NewLine); sb.Append(" AND COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(_Id)) + Environment.NewLine); sb.Append(" AND CUSTOMER_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(CustomerId)) + Environment.NewLine); #endregion db.ExecuteSQL(sb.ToString(), false); #region Insert SQL sb.Length = 0; sb.Append("INSERT INTO M_SUPPLIER " + Environment.NewLine); sb.Append(" ( COMPANY_ID" + Environment.NewLine); sb.Append(" , CUSTOMER_ID" + Environment.NewLine); sb.Append(" , ID" + Environment.NewLine); sb.Append(" , ID2" + Environment.NewLine); sb.Append(" , NAME" + Environment.NewLine); sb.Append(" , KANA" + Environment.NewLine); sb.Append(" , ABOUT_NAME" + Environment.NewLine); sb.Append(" , ZIP_CODE" + Environment.NewLine); sb.Append(" , PREFECTURE_ID" + Environment.NewLine); sb.Append(" , CITY_ID" + Environment.NewLine); sb.Append(" , TOWN_ID" + Environment.NewLine); sb.Append(" , ADRESS_CITY" + Environment.NewLine); sb.Append(" , ADRESS_TOWN" + Environment.NewLine); sb.Append(" , ADRESS1" + Environment.NewLine); sb.Append(" , ADRESS2" + Environment.NewLine); sb.Append(" , STATION_NAME" + Environment.NewLine); sb.Append(" , POST_NAME" + Environment.NewLine); sb.Append(" , PERSON_NAME" + Environment.NewLine); sb.Append(" , TITLE_ID" + Environment.NewLine); sb.Append(" , TITLE_NAME" + Environment.NewLine); sb.Append(" , TEL" + Environment.NewLine); sb.Append(" , FAX" + Environment.NewLine); sb.Append(" , MAIL_ADRESS" + Environment.NewLine); sb.Append(" , MOBILE_TEL" + Environment.NewLine); sb.Append(" , MOBILE_ADRESS" + Environment.NewLine); sb.Append(" , URL" + Environment.NewLine); sb.Append(" , DIVIDE_PERMISSION_ID" + Environment.NewLine); sb.Append(" , MEMO" + Environment.NewLine); sb.Append(" , DISPLAY_FLG" + Environment.NewLine); sb.Append(" , UPDATE_FLG" + Environment.NewLine); sb.Append(" , DELETE_FLG" + Environment.NewLine); sb.Append(" , CREATE_PG_ID" + Environment.NewLine); sb.Append(" , CREATE_ADRESS" + Environment.NewLine); sb.Append(" , CREATE_USER_ID" + Environment.NewLine); sb.Append(" , CREATE_PERSON_ID" + Environment.NewLine); sb.Append(" , CREATE_DATE" + Environment.NewLine); sb.Append(" , CREATE_TIME" + Environment.NewLine); sb.Append(" , UPDATE_PG_ID" + Environment.NewLine); sb.Append(" , UPDATE_ADRESS" + Environment.NewLine); sb.Append(" , UPDATE_USER_ID" + Environment.NewLine); sb.Append(" , UPDATE_PERSON_ID" + Environment.NewLine); sb.Append(" , UPDATE_DATE" + Environment.NewLine); sb.Append(" , UPDATE_TIME" + Environment.NewLine); sb.Append(")" + Environment.NewLine); sb.Append("SELECT " + companyId + Environment.NewLine); // COMPANY_ID sb.Append(" ," + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(CustomerId)) + Environment.NewLine); // CUSTOMER_ID sb.Append(" ," + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(_Id)) + Environment.NewLine); // ID sb.Append(" ," + ExCast.zIdForNumIndex(_Id) + Environment.NewLine); // ID2 sb.Append(" ," + ExEscape.zRepStr(entity.name) + Environment.NewLine); // NAME sb.Append(" ," + ExEscape.zRepStr(entity.kana) + Environment.NewLine); // KANA sb.Append(" ," + ExEscape.zRepStr(entity.about_name) + Environment.NewLine); // ABOUT_NAME sb.Append(" ," + ExCast.zNullToZero(entity.zip_code_from + entity.zip_code_to) + Environment.NewLine); // ZIP_CODE sb.Append(" ," + entity.prefecture_id + Environment.NewLine); // PREFECTURE_ID sb.Append(" ," + entity.city_id + Environment.NewLine); // CITY_ID sb.Append(" ," + entity.town_id + Environment.NewLine); // TOWN_ID sb.Append(" ," + ExEscape.zRepStr(entity.adress_city) + Environment.NewLine); // ADRESS_CITY sb.Append(" ," + ExEscape.zRepStr(entity.adress_town) + Environment.NewLine); // ADRESS_TOWN sb.Append(" ," + ExEscape.zRepStr(entity.adress1) + Environment.NewLine); // ADRESS1 sb.Append(" ," + ExEscape.zRepStr(entity.adress2) + Environment.NewLine); // ADRESS2 sb.Append(" ," + ExEscape.zRepStr(entity.station_name) + Environment.NewLine); // STATION_NAME sb.Append(" ," + ExEscape.zRepStr(entity.post_name) + Environment.NewLine); // POST_NAME sb.Append(" ," + ExEscape.zRepStr(entity.person_name) + Environment.NewLine); // PERSON_NAME sb.Append(" ," + entity.title_id + Environment.NewLine); // TITLE_ID sb.Append(" ," + ExEscape.zRepStr(entity.title_name) + Environment.NewLine); // TITLE_NAME sb.Append(" ," + ExEscape.zRepStr(entity.tel) + Environment.NewLine); // TEL sb.Append(" ," + ExEscape.zRepStr(entity.fax) + Environment.NewLine); // FAX sb.Append(" ," + ExEscape.zRepStr(entity.mail_adress) + Environment.NewLine); // MAIL_ADRESS sb.Append(" ," + ExEscape.zRepStr(entity.mobile_tel) + Environment.NewLine); // MOBILE_TEL sb.Append(" ," + ExEscape.zRepStr(entity.mobile_adress) + Environment.NewLine); // MOBILE_ADRESS sb.Append(" ," + ExEscape.zRepStr(entity.url) + Environment.NewLine); // URL sb.Append(" ," + entity.divide_permission_id + Environment.NewLine); // DIVIDE_PERMISSION_ID sb.Append(" ," + ExEscape.zRepStr(entity.memo) + Environment.NewLine); // MEMO sb.Append(" ," + entity.display_division_id + Environment.NewLine); // DISPLAY_FLG sb.Append(CommonUtl.GetInsSQLCommonColums(CommonUtl.UpdKbn.Ins, PG_NM, "M_SUPPLIER", ExCast.zCInt(personId), _Id, ipAdress, userId)); #endregion db.ExecuteSQL(sb.ToString(), false); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(Insert)", ex); return(CLASS_NM + ".UpdateSupplier(Insert) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } } #endregion #region Update if (type == 0) { try { #region SQL sb.Length = 0; sb.Append("UPDATE M_SUPPLIER " + Environment.NewLine); sb.Append(CommonUtl.GetUpdSQLCommonColums(PG_NM, ExCast.zCInt(personId), ipAdress, userId, 0)); sb.Append(" ,NAME = " + ExEscape.zRepStr(entity.name) + Environment.NewLine); sb.Append(" ,KANA = " + ExEscape.zRepStr(entity.kana) + Environment.NewLine); sb.Append(" ,ABOUT_NAME = " + ExEscape.zRepStr(entity.about_name) + Environment.NewLine); sb.Append(" ,ZIP_CODE = " + ExCast.zNullToZero(entity.zip_code_from + entity.zip_code_to) + Environment.NewLine); sb.Append(" ,PREFECTURE_ID = " + entity.prefecture_id + Environment.NewLine); sb.Append(" ,CITY_ID = " + entity.city_id + Environment.NewLine); sb.Append(" ,TOWN_ID = " + entity.town_id + Environment.NewLine); sb.Append(" ,ADRESS_CITY = " + ExEscape.zRepStr(entity.adress_city) + Environment.NewLine); sb.Append(" ,ADRESS_TOWN = " + ExEscape.zRepStr(entity.adress_town) + Environment.NewLine); sb.Append(" ,ADRESS1 = " + ExEscape.zRepStr(entity.adress1) + Environment.NewLine); sb.Append(" ,ADRESS2 = " + ExEscape.zRepStr(entity.adress2) + Environment.NewLine); sb.Append(" ,STATION_NAME = " + ExEscape.zRepStr(entity.station_name) + Environment.NewLine); sb.Append(" ,POST_NAME = " + ExEscape.zRepStr(entity.post_name) + Environment.NewLine); sb.Append(" ,PERSON_NAME = " + ExEscape.zRepStr(entity.person_name) + Environment.NewLine); sb.Append(" ,TITLE_ID = " + entity.title_id + Environment.NewLine); sb.Append(" ,TITLE_NAME = " + ExEscape.zRepStr(entity.title_name) + Environment.NewLine); sb.Append(" ,TEL = " + ExEscape.zRepStr(entity.tel) + Environment.NewLine); sb.Append(" ,FAX = " + ExEscape.zRepStr(entity.fax) + Environment.NewLine); sb.Append(" ,MAIL_ADRESS = " + ExEscape.zRepStr(entity.mail_adress) + Environment.NewLine); sb.Append(" ,MOBILE_TEL = " + ExEscape.zRepStr(entity.mobile_tel) + Environment.NewLine); sb.Append(" ,MOBILE_ADRESS = " + ExEscape.zRepStr(entity.mobile_adress) + Environment.NewLine); sb.Append(" ,URL = " + ExEscape.zRepStr(entity.url) + Environment.NewLine); sb.Append(" ,DIVIDE_PERMISSION_ID = " + entity.divide_permission_id + Environment.NewLine); sb.Append(" ,MEMO = " + ExEscape.zRepStr(entity.memo) + Environment.NewLine); sb.Append(" ,DISPLAY_FLG = " + entity.display_division_id + Environment.NewLine); sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine); // COMPANY_ID sb.Append(" AND ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(Id)) + Environment.NewLine); // ID sb.Append(" AND CUSTOMER_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(CustomerId)) + Environment.NewLine); #endregion db.ExecuteSQL(sb.ToString(), false); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(Update)", ex); return(CLASS_NM + ".UpdateSupplier(Insert) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } } #endregion #region Delete if (type == 2) { #region Exist Data try { bool _ret = false; _ret = DataExists.IsExistDataDouble(db, companyId, "", "T_ESTIMATE_H", "SUPPLIER_ID", ExCast.zNumZeroNothingFormat(Id), "CUSTOMER_ID", ExCast.zNumZeroNothingFormat(CustomerId), CommonUtl.geStrOrNumKbn.String); if (_ret == true) { return("ID : " + Id + " は見積データの納入先に使用されている為、削除できません。"); } _ret = DataExists.IsExistDataDouble(db, companyId, "", "T_ORDER_H", "SUPPLIER_ID", ExCast.zNumZeroNothingFormat(Id), "CUSTOMER_ID", ExCast.zNumZeroNothingFormat(CustomerId), CommonUtl.geStrOrNumKbn.String); if (_ret == true) { return("ID : " + Id + " は受注データの納入先に使用されている為、削除できません。"); } _ret = DataExists.IsExistDataDouble(db, companyId, "", "T_SALES_H", "SUPPLIER_ID", ExCast.zNumZeroNothingFormat(Id), "CUSTOMER_ID", ExCast.zNumZeroNothingFormat(CustomerId), CommonUtl.geStrOrNumKbn.String); if (_ret == true) { return("ID : " + Id + " は売上データの納入先に使用されている為、削除できません。"); } } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(Exist Data)", ex); return(CLASS_NM + ".UpdateSupplier(Exist Data) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Update try { sb.Length = 0; sb.Append("UPDATE M_SUPPLIER " + Environment.NewLine); sb.Append(CommonUtl.GetUpdSQLCommonColums(PG_NM, ExCast.zCInt(personId), ipAdress, userId, 1)); sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine); // COMPANY_ID sb.Append(" AND ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(Id)) + Environment.NewLine); // ID sb.Append(" AND CUSTOMER_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(CustomerId)) + Environment.NewLine); db.ExecuteSQL(sb.ToString(), false); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(Delete)", ex); return(CLASS_NM + ".UpdateSupplier(Delete) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion } #endregion #region PG排他制御 if (type == 0 || type == 2) { try { DataPgLock.DelLockPg(companyId, userId, PG_NM, "", ipAdress, false, db); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(DelLockPg)", ex); return(CLASS_NM + ".UpdateSupplier(DelLockPg) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } } #endregion #region CommitTransaction try { db.ExCommitTransaction(); } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(CommitTransaction)", ex); return(CLASS_NM + ".UpdateSupplier(CommitTransaction) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Database Close try { db.DbClose(); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(DbClose)", ex); return(CLASS_NM + ".UpdateSupplier(DbClose) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } finally { db = null; } #endregion #region Add Evidence try { switch (type) { case 0: svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Update, "ID:" + Id.ToString()); break; case 1: svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Insert, "ID:" + _Id.ToString()); break; case 2: svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Delete, "ID:" + Id.ToString()); break; default: break; } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSupplier(Add Evidence)", ex); return(CLASS_NM + ".UpdateSupplier(Add Evidence) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Return if (type == 1 && (Id == "0" || Id == "")) { return("Auto Insert success : " + "ID : " + _Id.ToString() + "で登録しました。"); } else { return(""); } #endregion }
private void GetSupplier(string CustomerId, string id) { try { objSupplier = null; // 初期化 svcSupplierClient svc = new svcSupplierClient(); svc.GetSupplierCompleted += new EventHandler<GetSupplierCompletedEventArgs>(this.GetSupplierCompleted); svc.GetSupplierAsync(Common.gstrSessionString, CustomerId, id); } catch (Exception ex) { this.ProcessingDlgClose(); ExMessageBox.Show(CLASS_NM + ".GetSupplier" + Environment.NewLine + ex.ToString(), "エラー確認"); } }
private void UpdateSupplier(int type, string CustomerId, string Id, EntitySupplier entity) { try { svcSupplierClient svc = new svcSupplierClient(); svc.UpdateSupplierCompleted += new EventHandler<UpdateSupplierCompletedEventArgs>(this.UpdateSupplierCompleted); svc.UpdateSupplierAsync(Common.gstrSessionString, type, CustomerId, Id, entity); } catch (Exception ex) { this.ProcessingDlgClose(); ExMessageBox.Show(CLASS_NM + ".UpdateSupplier" + Environment.NewLine + ex.ToString(), "エラー確認"); } }
private void GetSupplierCompleted(Object sender, GetSupplierCompletedEventArgs e) { try { objSupplier = e.Result; if (DialogCloseFlg == geDialogCloseFlg.Yes & win != null) { win.Close(); win = null; } if (objSupplier != null) { if (objSupplier.message != "" && objSupplier.message != null) { // 失敗 ExMessageBox.Show(objSupplier.message); objPerent.DataSelect((int)geWebServiceCallKbn.GetSupplier, (object)objSupplier); } else { // 成功 objPerent.DataSelect((int)geWebServiceCallKbn.GetSupplier, (object)objSupplier); } } else { objPerent.DataSelect((int)geWebServiceCallKbn.GetSupplier, null); } } catch (Exception ex) { this.ProcessingDlgClose(); ExMessageBox.Show(CLASS_NM + ".GetSupplierCompleted" + Environment.NewLine + ex.ToString(), "エラー確認"); } finally { if (DialogCloseFlg == geDialogCloseFlg.Yes & win != null) { win.Close(); win = null; } } }