using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using System.Data;
|
using System.Data.SqlClient;
|
using CY.Model;
|
using CY.BLL;
|
using CY.Infrastructure.Common;
|
using CY.Infrastructure.Query;
|
|
namespace CY.WebForm.Pages.soft
|
{
|
//吴辉
|
//新增/修改软件版本
|
public partial class VersionAdd : BasePage
|
{
|
Soft_VersionBLL bll_Soft_VersionBLL = null;
|
Soft_ManageBLL bll_Soft_ManageBLL = null;
|
|
//初始化
|
public VersionAdd()
|
{
|
bll_Soft_VersionBLL = new Soft_VersionBLL();
|
bll_Soft_ManageBLL = new Soft_ManageBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
InitData();
|
}
|
}
|
|
//数据加载
|
public void InitData()
|
{
|
Pagination pa = new Pagination();
|
pa.PageSize = 500;
|
pa.PageIndex = 1;
|
this.txtSoftTypeId.DataSource = bll_Soft_ManageBLL.SelectModelPage(pa, null, null, null, null, null, null);
|
this.txtSoftTypeId.DataTextField = "SoftName";
|
this.txtSoftTypeId.DataValueField = "Keyid";
|
this.txtSoftTypeId.DataBind();
|
this.txtSoftTypeId.Items.Insert(0, new ListItem("请选择", ""));
|
|
this.txtSoftTypeId.SelectedValue = "";
|
this.txtSoftVersion.Value = "";
|
|
}
|
|
//表单提交
|
protected void btn_submit_form(object sender, EventArgs e)
|
{
|
try
|
{
|
DateTime nowTime = DateTime.Now;
|
Soft_Version m_Soft_Version = bll_Soft_VersionBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
Soft_Manage m_Soft_Manage = bll_Soft_ManageBLL.GetModelByKeyid(this.txtSoftTypeId.SelectedValue.ToInt32());
|
if (m_Soft_Version == null)
|
{
|
m_Soft_Version = new Soft_Version();
|
m_Soft_Version.SoftCreatTime = nowTime;
|
m_Soft_Version.SoftUpCount = 0;
|
}
|
|
m_Soft_Version.SoftTypeId = this.txtSoftTypeId.SelectedValue.ToInt32();
|
m_Soft_Version.SoftName = this.txtSoftTypeId.SelectedItem.Text.ToString2();
|
m_Soft_Version.SoftVersion = this.txtSoftVersion.Value.ToString2();
|
|
//图片上传
|
CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult2 = CY.WebForm.cs.UploadCS.UploadSoftVersion("txtSoftUrl", m_Soft_Version.SoftVersion, m_Soft_Manage.SoftContent);
|
m_Soft_Version.SoftUrl = m_Soft_Version.SoftUrl ?? "";
|
if (_UpFileResult2.returnerror.Count == 0)
|
{
|
if (_UpFileResult2.returnfilename.Count > 0)
|
m_Soft_Version.SoftUrl = _UpFileResult2.returnfilename[0].ToString2();
|
}
|
else
|
{
|
JavaScript.MessageBox(string.Join("<br/>", (string[])_UpFileResult2.returnerror.ToArray(typeof(string))), this);
|
return;
|
}
|
|
m_Soft_Version.SoftUrl = this.txtSoftUrl.Value.ToString2();
|
|
m_Soft_Version.SoftStoreAddress = "";
|
m_Soft_Version.SoftContent = "";
|
m_Soft_Version.LastUpdateTime = nowTime;
|
m_Soft_Version.Operator = CurrentUser.ShortName;
|
|
if (Request["keyid"].ToInt32() > 0)
|
{
|
if (bll_Soft_VersionBLL.UpdateModel(m_Soft_Version))
|
JavaScript.MessageBox("更新成功", this, true, true);
|
else
|
JavaScript.MessageBox("更新失败", this);
|
}
|
else
|
{
|
if (bll_Soft_VersionBLL.InsertModel(m_Soft_Version))
|
{
|
JavaScript.MessageBox("新增成功", this, false, true);
|
InitData();
|
}
|
else
|
JavaScript.MessageBox("新增失败", this);
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
|
protected void txtSoftTypeId_SelectedIndexChanged(object sender, EventArgs e)
|
{
|
Pagination pa = new Pagination();
|
pa.PageSize = 500;
|
pa.PageIndex = 1;
|
List<Soft_Version> m_Soft_VersionList = bll_Soft_VersionBLL.SelectModelPage(pa, this.txtSoftTypeId.SelectedValue.ToInt32(), "", "", "", "", "", null, null, null, null, null, null, "") as List<Soft_Version>;
|
if (m_Soft_VersionList == null || m_Soft_VersionList.Count == 0)
|
{
|
this.txtSoftVersion.Value = "1.0";
|
}
|
else
|
{
|
string VerString = (m_Soft_VersionList[0].SoftVersion.Replace(".", "").ToInt32() + 1).ToString2();
|
string newVerString = VerString.Insert((VerString.Length - 1),".");
|
this.txtSoftVersion.Value = newVerString;
|
}
|
}
|
}
|
}
|