using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.Model;
using CY.Infrastructure.Common;
using CY.BLL.Info;
using CY.BLL;
namespace CY.WebForm.Pages.member
{
//吴辉
//企业网站信息-基本信息
public partial class FirmBasic : BasePage
{
Info_FirmBLL _Info_FirmBLL = null;
public FirmBasic()
{
_Info_FirmBLL = new Info_FirmBLL();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InitialData();
}
}
protected void InitialData()
{
Info_Firm m_Info_Firm = _Info_FirmBLL.selectSingleModel(CurrentUser.MemberId);
if (m_Info_Firm != null)
{
this.txtfirmInfoBottom.Value = m_Info_Firm.firmInfoBottom;
this.imgLogo.Src = m_Info_Firm.firmLogo;
this.trLogo.Visible = string.IsNullOrEmpty(m_Info_Firm.firmLogo) ? false : true;
this.imgLogo1.Src = m_Info_Firm.firmLogo1;
this.trLogo1.Visible = string.IsNullOrEmpty(m_Info_Firm.firmLogo1) ? false : true;
}
}
protected void btn_Submit_Click(object sender, EventArgs e)
{
Info_Firm m_Info_Firm = _Info_FirmBLL.selectSingleModel(CurrentUser.MemberId);
if (m_Info_Firm == null)
{
m_Info_Firm = new Info_Firm();
m_Info_Firm.bussinessScope = "";
m_Info_Firm.FirmInroduce = "";
m_Info_Firm.FrimContactInfo = "";
m_Info_Firm.firmLogo = "";
m_Info_Firm.firmLogo1 = "";
}
m_Info_Firm.firmInfoBottom = this.txtfirmInfoBottom.Value;
//图片上传
CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult1 = CY.WebForm.cs.UploadCS.Upload("txtLogo", m_Info_Firm.firmLogo);
m_Info_Firm.firmLogo = m_Info_Firm.firmLogo ?? "";
if (_UpFileResult1.returnerror.Count == 0)
{
if (_UpFileResult1.returnfilename.Count > 0)
m_Info_Firm.firmLogo = _UpFileResult1.returnfilename[0].ToString2();
}
else
{
JavaScript.MessageBox(string.Join("
", (string[])_UpFileResult1.returnerror.ToArray(typeof(string))), this);
return;
}
//图片上传
CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult2 = CY.WebForm.cs.UploadCS.Upload("txtLogo1", m_Info_Firm.firmLogo1);
m_Info_Firm.firmLogo1 = m_Info_Firm.firmLogo1 ?? "";
if (_UpFileResult2.returnerror.Count == 0)
{
if (_UpFileResult2.returnfilename.Count > 0)
m_Info_Firm.firmLogo1 = _UpFileResult2.returnfilename[0].ToString2();
}
else
{
JavaScript.MessageBox(string.Join("
", (string[])_UpFileResult2.returnerror.ToArray(typeof(string))), this);
return;
}
if (m_Info_Firm != null)
{
if (_Info_FirmBLL.UpdateModel(m_Info_Firm))
JavaScript.MessageBox("保存成功", this);
else
JavaScript.MessageBox("保存失败", this);
}
else
{
if (_Info_FirmBLL.InsertModel(m_Info_Firm))
JavaScript.MessageBox("保存成功", this);
else
JavaScript.MessageBox("保存失败", this);
}
}
}
}