⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcustomer.java

📁 Java写的ERP系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
				}
			}
			//	===	Update Business Partner	===		(value/greeting/name/name2/email)
			else
			{
				log.debug("save - Update BPartner " + C_BPartner_ID);
				String gr = "NULL";
				if (C_GreetingBP_ID > 0)
					gr = String.valueOf(C_GreetingBP_ID);
				SQL = "UPDATE C_BPartner SET "
					+ "Value='" + Value + "',"
					+ "C_Greeting_ID=" + gr + ","
					+ "Name='" + Name + "',"
					+ "Name2='" + Name2 + "',"
					+ "EMail='" + EMail + "',"
					+ "Updated=SysDate, UpdatedBy=" + UpdatedBy
					+ " WHERE C_BPartner_ID=" + C_BPartner_ID;
				int i = stmt.executeUpdate(SQL);
				if (i != 1)
				{
					m_errorMessage = "BPartnerNotSaved";
					log.error ("Partner Update #=" + i + ", SQL=" + SQL);
					return false;
				}
			}

			//	===	Insert New BPartner_Location ===
			if (C_BPartner_Location_ID == 0 && C_Location_ID != 0)
			{
				C_BPartner_Location_ID = DB.getKeyNextNo(AD_Client_ID, "N", "C_BPartner_Location");
				log.debug("Insert BPartner Location " + C_BPartner_Location_ID + " (" + C_Location_ID + ")");
				SQL = "INSERT INTO C_BPartner_Location"
					+ "(C_BPartner_Location_ID, C_BPartner_ID,"
					+ "AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
					+ "Name, C_Location_ID, Phone, Phone2, Fax)"
					+ " VALUES "
					+ "(" + C_BPartner_Location_ID + "," + C_BPartner_ID + ","
					+ AD_Client_ID + "," + AD_Org_ID + ",'Y',SysDate," + UpdatedBy + ",SysDate," + UpdatedBy + ","
					+ "'.'," + C_Location_ID + ",'" + Phone + "','" + Phone
					+ "','" + Fax + "')";
				int i = stmt.executeUpdate(SQL);
				if (i != 1)
				{
					m_errorMessage = "BPartnerNotSaved";
					log.error ("Location Insert #=" + i + ", SQL=" + SQL);
					return false;
				}
			}
			//	=== Update BPartner_Location ===
			else if (C_BPartner_Location_ID != 0)
			{
				log.debug("Update BPartner Location " + C_BPartner_Location_ID);
				SQL = "UPDATE C_BPartner_Location SET "
					+ "C_Location_ID=" + C_Location_ID + ","
					+ "Phone='" + Phone + "',"		//	?? ok for one contact
					+ "Phone2='" + Phone2 + "',"	//	??
					+ "Fax='" + Fax + "',"			//	??
					+ "Updated=SysDate, UpdatedBy=" + UpdatedBy
					+ " WHERE C_BPartner_Location_ID=" + C_BPartner_Location_ID;
				int i = stmt.executeUpdate(SQL);
				if (i != 1)
				{
					m_errorMessage = "BPartnerNotSaved";
					log.error ("Location Update #=" + i + ", SQL=" + SQL);
					return false;
				}
			}

			//	=== Insert new BPartner_Contact === only if contact entered
			if (C_BPartner_Contact_ID == 0 && Contact.length() != 0)
			{
				C_BPartner_Contact_ID = DB.getKeyNextNo (AD_Client_ID, "N", "C_BPartner_Contact");
				log.debug("Insert BPartner Contact " + C_BPartner_Contact_ID);
				String gr = "NULL";
				if (C_Greeting_ID > 0)
					gr = String.valueOf(C_Greeting_ID);
				SQL = "INSERT INTO C_BPartner_Contact"
					+ "(C_BPartner_Contact_ID, C_BPartner_ID,"
					+ "AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
					+ "Name, C_Greeting_ID, Title, Phone, Phone2, Fax, EMail, Password)"
					+ " VALUES "
					+ "(" + C_BPartner_Contact_ID + "," + C_BPartner_ID + ","
					+ AD_Client_ID + "," + AD_Org_ID + ",'Y',SysDate," + UpdatedBy + ",SysDate," + UpdatedBy + ","
					+ "'" + Contact + "'," + gr + ",'" + Title + "','" + Phone + "','" + Phone2 + "','"
					+ Fax + "','" + EMail + "','" + Password +"')";
				int i = stmt.executeUpdate(SQL);
				if (i != 1)
				{
					m_errorMessage = "BPartnerNotSaved";
					log.error ("Contact Insert #=" + i + ", SQL=" + SQL);
					return false;
				}
			}
			//	===	Update BPartner_Contact ===
			else if (C_BPartner_Contact_ID != 0)
			{
				log.debug("Update BPartner Contact " + C_BPartner_Contact_ID);
				//	We need to have a Name
				if (Contact.length() == 0)
					Contact = Name;
				String gr = "NULL";
				if (C_Greeting_ID > 0)
					gr = String.valueOf(C_Greeting_ID);
				SQL = "UPDATE C_BPartner_Contact SET "
					+ "Name='" + Contact + "',"
					+ "C_Greeting_ID=" + gr + ","
					+ "Title='" + Title + "',"
					+ "Phone='" + Phone + "',"
					+ "Phone2='" + Phone2 + "',"
					+ "Fax='" + Fax + "',"
					+ "EMail='" + EMail + "',"
					+ "Password='" + Password + "',"
					//	location ??
					+ "Updated=SysDate, UpdatedBy=" + UpdatedBy
					+ " WHERE C_BPartner_Contact_ID=" + C_BPartner_Contact_ID;
				int i = stmt.executeUpdate(SQL);
				if (i != 1)
				{
					m_errorMessage = "BPartnerNotSaved";
					log.error ("Contact Update #=" + i + ", SQL=" + SQL);
					return false;
				}
			}
		}
		catch (SQLException e)
		{
			m_errorMessage = "BPartnerNotSaved";
			log.error("save " + SQL, e);
			C_BPartner_ID = 0;
		}
		return m_errorMessage == null;
	}	//	save

	public String getErrorMessage()
	{
		return m_errorMessage;
	}

	/*************************************************************************/

	public int getC_BPartner_Contact_ID()
	{
		return C_BPartner_Contact_ID;
	}
	public void setC_BPartner_Contact_ID(int C_BPartner_Contact_ID)
	{
		this.C_BPartner_Contact_ID = C_BPartner_Contact_ID;
	}
	public int getC_BPartner_ID()
	{
		return C_BPartner_ID;
	}
	public void setC_BPartner_ID(int C_BPartner_ID)
	{
		this.C_BPartner_ID = C_BPartner_ID;
	}
	public int getC_BPartner_Location_ID()
	{
		return C_BPartner_Location_ID;
	}
	public void setC_BPartner_Location_ID(int C_BPartner_Location_ID)
	{
		this.C_BPartner_Location_ID = C_BPartner_Location_ID;
	}
	public int getC_Greeting_ID()
	{
		return C_Greeting_ID;
	}
	public void setC_Greeting_ID(int C_Greeting_ID)
	{
		this.C_Greeting_ID = C_Greeting_ID;
	}
	public int getC_GreetingBP_ID()
	{
		return C_GreetingBP_ID;
	}
	public void setC_GreetingBP_ID(int C_GreetingBP_ID)
	{
		this.C_GreetingBP_ID = C_GreetingBP_ID;
	}
	public int getC_Location_ID()
	{
		return C_Location_ID;
	}
	public void setC_Location_ID(int C_Location_ID)
	{
		this.C_Location_ID = C_Location_ID;
	}
	//
	public String getContact()
	{
		return Contact;
	}
	public void setContact(String Contact)
	{
		if (Contact != null)
			this.Contact = Contact;
	}
	public String getEMail()
	{
		return EMail;
	}
	public void setEMail(String EMail)
	{
		if (EMail != null)
			this.EMail = EMail;
	}
	public String getPassword()
	{
		return Password;
	}
	public void setPassword(String Password)
	{
		if (Password != null)
			this.Password = Password;
	}
	public String getFax()
	{
		return Fax;
	}
	public void setFax(String Fax)
	{
		if (Fax != null)
			this.Fax = Fax;
	}
	public String getName()
	{
		return Name;
	}
	public void setName(String Name)
	{
		if (Name != null)
			this.Name = Name;
	}
	public String getName2()
	{
		return Name2;
	}
	public void setName2(String Name2)
	{
		if (Name2 != null)
			this.Name2 = Name2;
	}
	public String getPhone()
	{
		return Phone;
	}
	public void setPhone(String Phone)
	{
		if (Phone != null)
			this.Phone = Phone;
	}
	public String getPhone2()
	{
		return Phone2;
	}
	public void setPhone2(String Phone2)
	{
		if (Phone2 != null)
			this.Phone2 = Phone2;
	}
	public String getTitle()
	{
		return Title;
	}
	public void setTitle(String Title)
	{
		if (Title != null)
			this.Title = Title;
	}
	public String getValue()
	{
		return Value;
	}
	public void setValue(String Value)
	{
		if (Value != null)
			this.Value = Value;
	}

}	//	MCustomer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -