You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/ParameterSet/CwDesignSet.aspx.cs

426 lines
20 KiB
C#

2 years ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using DSWeb.DataAccess;
using System.Data.SqlClient;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Web.Script.Serialization;
using System.ComponentModel;
using System.Drawing;
using System.Web.SessionState;
using System.Web.Mail;
using System.IO;
using System.Data.OleDb;
using JsonHelper;
using DSWeb.Log;
using DSWeb.Attributes;
namespace DSWeb.ParameterSet
{
public partial class CwDesignSet : System.Web.UI.Page
{
public string strHandleType = String.Empty;
T_ALL_DA T_ALL_DA = new T_ALL_DA();
CwDesignEntity CwDesignEntity = new CwDesignEntity();
CwDesignDA CwDesignDA = new CwDesignDA();
public string strGID;
public string strUserID;//登录用户GID
public string strCompanyID;//公司GID
public string strShowName;//用户显示名
public string strDeptName;//部门名称
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
//strUserID = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
}
if (Session["SHOWNAME"] != null)
{
strShowName = Session["SHOWNAME"].ToString();
}
if (Session["COMPANYID"] != null)
{
strCompanyID = Session["COMPANYID"].ToString();
}
if (Session["DEPTNAME"] != null)
{
strDeptName = Session["DEPTNAME"].ToString();
}
//
strGID = T_ALL_DA.GetStrSQL("gid", "select top 1 gid from cw_design");
if(strGID==null || strGID.Trim()=="")
{
strHandleType="add";
}
else
{
strHandleType="edit";
}
//
if (!IsPostBack)
{
//
switch (strHandleType)
{
case "add"://新增
//rblFSOFTCODE.Text = "";
tbTVW.Text = "记";
tbBPVW.Text = "付";
tbBRTW.Text = "收";
tbCANAME.Text = "客户";
tbDANAME.Text = "供应商";
tbPANAEM.Text = "部门";
tbSANAME.Text = "职员";
tbAFFIXNO.Text = "1";
rblAMCODE.SelectedValue = "1";
cbISTCOIIED.Checked = false;
cbISUAPGE.Checked = false;
cbISVBM.Checked = true;
cbISATBGV.Checked = true;
cbISMGSC.Checked = true;
cbISATTNOTCVVGV.Checked = true;
cbISCLIENTNAME.Checked = false;
//cbISCOTCODE.Checked = false;
cbISCUSTNO.Checked = false;
cbISMBLNO.Checked = false;
cbISVESSEL.Checked = true;
cbISVOYNO.Checked = true;
cbISBILLNO.Checked = false;
cbISRPCLIENTNAME.Checked = false;
//cbISRPCOTCODE.Checked = false;
cbISRPCUSTNO.Checked = false;
cbISRPMBLNO.Checked = false;
cbISRPVESSEL.Checked = true;
cbISRPVOYNO.Checked = true;
cbISSETTLEMENTS.Checked = false;
cbISSETTLEMENTSOPEN.Checked = false;
cbISRPBILLNO.Checked = false;
cbISFILLSERIALNO.Checked = false;
tbAR.Text = "";
tbMBINCOME.Text = "";
tbAABWI.Text = "";
tbAP.Text = "";
tbMBSPENDING.Text = "";
tbAMBS.Text = "";
tbARFC.Text = "";
tbTMFCI.Text = "";
tbAMFCI.Text = "";
tbAPFC.Text = "";
tbTMSFC.Text = "";
tbAMSFC.Text = "";
tbOTHERR.Text = "";
tbOTHERP.Text = "";
tbEGOL.Text = "";
cbISAPMBSPENDING.Checked = false;
tbAPMBSPENDING.Text = "";
cbISAPTMSFC.Checked = false;
tbAPTMSFC.Text = "";
tbDR.Text = "";
tbDRFC.Text = "";
tbCR.Text = "";
tbCRFC.Text = "";
break;
case "edit"://录入
CwDesignEntity = CwDesignDA.GetModel(strGID.Trim());
if (CwDesignEntity.GID != null)
{
rblFSOFTCODE.SelectedValue = CwDesignEntity.FSOFTCODE.ToString().Trim();
tbTVW.Text = CwDesignEntity.TVW.ToString().Trim();
tbBPVW.Text = CwDesignEntity.BPVW.ToString().Trim();
tbBRTW.Text = CwDesignEntity.BRTW.ToString().Trim();
tbCANAME.Text = CwDesignEntity.CANAME.ToString().Trim();
tbDANAME.Text = CwDesignEntity.DANAME.ToString().Trim();
tbPANAEM.Text = CwDesignEntity.PANAEM.ToString().Trim();
tbSANAME.Text = CwDesignEntity.SANAME.ToString().Trim();
tbAFFIXNO.Text = CwDesignEntity.AFFIXNO.ToString().Trim();
rblAMCODE.SelectedValue = CwDesignEntity.AMCODE.ToString().Trim();
cbISTCOIIED.Checked = CwDesignEntity.ISTCOIIED;
cbISUAPGE.Checked = CwDesignEntity.ISUAPGE;
cbISVBM.Checked = CwDesignEntity.ISVBM;
cbISATBGV.Checked = CwDesignEntity.ISATBGV;
cbISMGSC.Checked = CwDesignEntity.ISMGSC;
cbISATTNOTCVVGV.Checked = CwDesignEntity.ISATTNOTCVVGV;
cbISCLIENTNAME.Checked = CwDesignEntity.ISCLIENTNAME;
//cbISCOTCODE.Checked = CwDesignEntity.ISCOTCODE;
cbISCUSTNO.Checked = CwDesignEntity.ISCUSTNO;
cbISMBLNO.Checked = CwDesignEntity.ISMBLNO;
cbISVESSEL.Checked = CwDesignEntity.ISVESSEL;
cbISVOYNO.Checked = CwDesignEntity.ISVOYNO;
cbISBILLNO.Checked = CwDesignEntity.ISBILLNO;
cbISRPCLIENTNAME.Checked = CwDesignEntity.ISRPCLIENTNAME;
//cbISRPCOTCODE.Checked = CwDesignEntity.ISRPCOTCODE;
cbISRPCUSTNO.Checked = CwDesignEntity.ISRPCUSTNO;
cbISRPMBLNO.Checked = CwDesignEntity.ISRPMBLNO;
cbISRPVESSEL.Checked = CwDesignEntity.ISRPVESSEL;
cbISRPVOYNO.Checked = CwDesignEntity.ISRPVOYNO;
cbISSETTLEMENTS.Checked = CwDesignEntity.ISSETTLEMENTS;
cbISSETTLEMENTSOPEN.Checked = CwDesignEntity.ISSETTLEMENTSOPEN;
cbISRPBILLNO.Checked = CwDesignEntity.ISRPBILLNO;
cbISFILLSERIALNO.Checked = CwDesignEntity.ISFILLSERIALNO;
tbAR.Text = CwDesignEntity.AR.ToString().Trim();
tbMBINCOME.Text = CwDesignEntity.MBINCOME.ToString().Trim();
tbAABWI.Text = CwDesignEntity.AABWI.ToString().Trim();
tbAP.Text = CwDesignEntity.AP.ToString().Trim();
tbMBSPENDING.Text = CwDesignEntity.MBSPENDING.ToString().Trim();
tbAMBS.Text = CwDesignEntity.AMBS.ToString().Trim();
tbARFC.Text = CwDesignEntity.ARFC.ToString().Trim();
tbTMFCI.Text = CwDesignEntity.TMFCI.ToString().Trim();
tbAMFCI.Text = CwDesignEntity.AMFCI.ToString().Trim();
tbAPFC.Text = CwDesignEntity.APFC.ToString().Trim();
tbTMSFC.Text = CwDesignEntity.TMSFC.ToString().Trim();
tbAMSFC.Text = CwDesignEntity.AMSFC.ToString().Trim();
tbOTHERR.Text = CwDesignEntity.OTHERR.ToString().Trim();
tbOTHERP.Text = CwDesignEntity.OTHERP.ToString().Trim();
tbEGOL.Text = CwDesignEntity.EGOL.ToString().Trim();
cbISAPMBSPENDING.Checked = CwDesignEntity.ISAPMBSPENDING;
tbAPMBSPENDING.Text = CwDesignEntity.APMBSPENDING.ToString().Trim();
cbISAPTMSFC.Checked = CwDesignEntity.ISAPTMSFC;
tbAPTMSFC.Text = CwDesignEntity.APTMSFC.ToString().Trim();
tbDR.Text = CwDesignEntity.DR.ToString().Trim();
tbDRFC.Text = CwDesignEntity.DRFC.ToString().Trim();
tbCR.Text = CwDesignEntity.CR.ToString().Trim();
tbCRFC.Text = CwDesignEntity.CRFC.ToString().Trim();
}
break;
}
//
}
}
protected String getBSNO()
{
string strBSNO = Guid.NewGuid().ToString();
strBSNO = strBSNO.Replace("-", "");
strBSNO = "cw" + strBSNO;
return strBSNO;
}
protected bool getAdd()
{
strGID = getBSNO();
CwDesignEntity.GID = strGID.Trim();
CwDesignEntity.FSOFTCODE = int.Parse(rblFSOFTCODE.SelectedValue.ToString().Trim());
CwDesignEntity.TVW = tbTVW.Text.ToString().Trim();
CwDesignEntity.CPVW = "";
CwDesignEntity.CRTW = "";
CwDesignEntity.BPVW = tbBPVW.Text.ToString().Trim();
CwDesignEntity.BRTW = tbBRTW.Text.ToString().Trim();
CwDesignEntity.ISTCOIIED = cbISTCOIIED.Checked;
CwDesignEntity.ISUAPGE = cbISUAPGE.Checked;
CwDesignEntity.AMCODE = int.Parse(rblAMCODE.SelectedValue.ToString().Trim());
CwDesignEntity.CANAME = tbCANAME.Text.ToString().Trim();
CwDesignEntity.SANAME = tbSANAME.Text.ToString().Trim();
CwDesignEntity.DANAME = tbDANAME.Text.ToString().Trim();
CwDesignEntity.PANAEM = tbPANAEM.Text.ToString().Trim();
CwDesignEntity.AFFIXNO = int.Parse(tbAFFIXNO.Text.ToString().Trim());
CwDesignEntity.ISATTNOTCVVGV = cbISATTNOTCVVGV.Checked;
CwDesignEntity.ISATBGV = cbISATBGV.Checked;
CwDesignEntity.ISMGSC = cbISMGSC.Checked;
CwDesignEntity.ISVBM = cbISVBM.Checked;
CwDesignEntity.ISCLIENTNAME = cbISCLIENTNAME.Checked;
CwDesignEntity.ISCOTCODE = false;// cbISCOTCODE.Checked;
CwDesignEntity.ISCUSTNO = cbISCUSTNO.Checked;
CwDesignEntity.ISMBLNO = cbISMBLNO.Checked;
CwDesignEntity.ISVESSEL = cbISVESSEL.Checked;
CwDesignEntity.ISVOYNO = cbISVOYNO.Checked;
CwDesignEntity.ISBILLNO = cbISBILLNO.Checked;
CwDesignEntity.ISETD = false;
CwDesignEntity.ISRPCLIENTNAME = cbISRPCLIENTNAME.Checked;
CwDesignEntity.ISRPCOTCODE = false;// cbISRPCOTCODE.Checked;
CwDesignEntity.ISRPMBLNO = cbISRPMBLNO.Checked;
CwDesignEntity.ISRPCUSTNO = cbISRPCUSTNO.Checked;
CwDesignEntity.ISRPVESSEL = cbISRPVESSEL.Checked;
CwDesignEntity.ISRPVOYNO = cbISRPVOYNO.Checked;
CwDesignEntity.ISRPETD = false;
CwDesignEntity.ISRPBILLNO = cbISRPBILLNO.Checked;
CwDesignEntity.ISSETTLEMENTS = cbISSETTLEMENTS.Checked;
CwDesignEntity.ISSETTLEMENTSOPEN = cbISSETTLEMENTSOPEN.Checked;
CwDesignEntity.ISFILLSERIALNO = cbISFILLSERIALNO.Checked;
CwDesignEntity.AR = tbAR.Text.ToString().Trim();
CwDesignEntity.ARFC = tbARFC.Text.ToString().Trim();
CwDesignEntity.AP = tbAP.Text.ToString().Trim();
CwDesignEntity.APFC = tbAPFC.Text.ToString().Trim();
CwDesignEntity.MBINCOME = tbMBINCOME.Text.ToString().Trim();
CwDesignEntity.MBSPENDING = tbMBSPENDING.Text.ToString().Trim();
CwDesignEntity.TMFCI = tbTMFCI.Text.ToString().Trim();
CwDesignEntity.TMSFC = tbTMSFC.Text.ToString().Trim();
CwDesignEntity.AABWI = tbAABWI.Text.ToString().Trim();
CwDesignEntity.AMBS = tbAMBS.Text.ToString().Trim();
CwDesignEntity.AMFCI = tbAMFCI.Text.ToString().Trim();
CwDesignEntity.AMSFC = tbAMSFC.Text.ToString().Trim();
CwDesignEntity.OTHERR = tbOTHERR.Text.ToString().Trim();
CwDesignEntity.OTHERP = tbOTHERP.Text.ToString().Trim();
CwDesignEntity.EGOL = tbEGOL.Text.ToString().Trim();
CwDesignEntity.MODIFIEDUSER = strUserID.Trim();
CwDesignEntity.ISAPMBSPENDING = cbISAPMBSPENDING.Checked;
CwDesignEntity.APMBSPENDING = tbAPMBSPENDING.Text.ToString().Trim();
CwDesignEntity.ISAPTMSFC = cbISAPTMSFC.Checked;
CwDesignEntity.APTMSFC = tbAPTMSFC.Text.ToString().Trim();
CwDesignEntity.DR = tbDR.Text.ToString().Trim();
CwDesignEntity.DRFC = tbDRFC.Text.ToString().Trim();
CwDesignEntity.CR = tbCR.Text.ToString().Trim();
CwDesignEntity.CRFC = tbCRFC.Text.ToString().Trim();
//
int iResult = CwDesignDA.Add(CwDesignEntity);
if (iResult > 0)
{
return true;
}
else
{
return false;
}
}
protected bool getEdit()
{
CwDesignEntity.GID = strGID.Trim();
CwDesignEntity.FSOFTCODE = int.Parse(rblFSOFTCODE.SelectedValue.ToString().Trim());
CwDesignEntity.TVW = tbTVW.Text.ToString().Trim();
CwDesignEntity.CPVW = "";
CwDesignEntity.CRTW = "";
CwDesignEntity.BPVW = tbBPVW.Text.ToString().Trim();
CwDesignEntity.BRTW = tbBRTW.Text.ToString().Trim();
CwDesignEntity.ISTCOIIED = cbISTCOIIED.Checked;
CwDesignEntity.ISUAPGE = cbISUAPGE.Checked;
CwDesignEntity.AMCODE = int.Parse(rblAMCODE.SelectedValue.ToString().Trim());
CwDesignEntity.CANAME = tbCANAME.Text.ToString().Trim();
CwDesignEntity.SANAME = tbSANAME.Text.ToString().Trim();
CwDesignEntity.DANAME = tbDANAME.Text.ToString().Trim();
CwDesignEntity.PANAEM = tbPANAEM.Text.ToString().Trim();
CwDesignEntity.AFFIXNO = int.Parse(tbAFFIXNO.Text.ToString().Trim());
CwDesignEntity.ISATTNOTCVVGV = cbISATTNOTCVVGV.Checked;
CwDesignEntity.ISATBGV = cbISATBGV.Checked;
CwDesignEntity.ISMGSC = cbISMGSC.Checked;
CwDesignEntity.ISVBM = cbISVBM.Checked;
CwDesignEntity.ISCLIENTNAME = cbISCLIENTNAME.Checked;
CwDesignEntity.ISCOTCODE = false;// cbISCOTCODE.Checked;
CwDesignEntity.ISCUSTNO = cbISCUSTNO.Checked;
CwDesignEntity.ISMBLNO = cbISMBLNO.Checked;
CwDesignEntity.ISVESSEL = cbISVESSEL.Checked;
CwDesignEntity.ISVOYNO = cbISVOYNO.Checked;
CwDesignEntity.ISBILLNO = cbISBILLNO.Checked;
CwDesignEntity.ISETD = false;
CwDesignEntity.ISRPCLIENTNAME = cbISRPCLIENTNAME.Checked;
CwDesignEntity.ISRPCOTCODE = false;// cbISRPCOTCODE.Checked;
CwDesignEntity.ISRPMBLNO = cbISRPMBLNO.Checked;
CwDesignEntity.ISRPCUSTNO = cbISRPCUSTNO.Checked;
CwDesignEntity.ISRPVESSEL = cbISRPVESSEL.Checked;
CwDesignEntity.ISRPVOYNO = cbISRPVOYNO.Checked;
CwDesignEntity.ISRPETD = false;
CwDesignEntity.ISRPBILLNO = cbISRPBILLNO.Checked;
CwDesignEntity.ISSETTLEMENTS = cbISSETTLEMENTS.Checked;
CwDesignEntity.ISSETTLEMENTSOPEN = cbISSETTLEMENTSOPEN.Checked;
CwDesignEntity.ISFILLSERIALNO = cbISFILLSERIALNO.Checked;
CwDesignEntity.AR = tbAR.Text.ToString().Trim();
CwDesignEntity.ARFC = tbARFC.Text.ToString().Trim();
CwDesignEntity.AP = tbAP.Text.ToString().Trim();
CwDesignEntity.APFC = tbAPFC.Text.ToString().Trim();
CwDesignEntity.MBINCOME = tbMBINCOME.Text.ToString().Trim();
CwDesignEntity.MBSPENDING = tbMBSPENDING.Text.ToString().Trim();
CwDesignEntity.TMFCI = tbTMFCI.Text.ToString().Trim();
CwDesignEntity.TMSFC = tbTMSFC.Text.ToString().Trim();
CwDesignEntity.AABWI = tbAABWI.Text.ToString().Trim();
CwDesignEntity.AMBS = tbAMBS.Text.ToString().Trim();
CwDesignEntity.AMFCI = tbAMFCI.Text.ToString().Trim();
CwDesignEntity.AMSFC = tbAMSFC.Text.ToString().Trim();
CwDesignEntity.OTHERR = tbOTHERR.Text.ToString().Trim();
CwDesignEntity.OTHERP = tbOTHERP.Text.ToString().Trim();
CwDesignEntity.EGOL = tbEGOL.Text.ToString().Trim();
CwDesignEntity.MODIFIEDUSER = strUserID.Trim();
CwDesignEntity.ISAPMBSPENDING = cbISAPMBSPENDING.Checked;
CwDesignEntity.APMBSPENDING = tbAPMBSPENDING.Text.ToString().Trim();
CwDesignEntity.ISAPTMSFC = cbISAPTMSFC.Checked;
CwDesignEntity.APTMSFC = tbAPTMSFC.Text.ToString().Trim();
CwDesignEntity.DR = tbDR.Text.ToString().Trim();
CwDesignEntity.DRFC = tbDRFC.Text.ToString().Trim();
CwDesignEntity.CR = tbCR.Text.ToString().Trim();
CwDesignEntity.CRFC = tbCRFC.Text.ToString().Trim();
//
int iResult = CwDesignDA.Update(CwDesignEntity);
if (iResult > 0)
{
return true;
}
else
{
return false;
}
}
protected void ibEnter_Click(object sender, EventArgs e)
{
if (cbISATTNOTCVVGV.Checked == true)
{
cbISCLIENTNAME.Checked = false;
//cbISCOTCODE.Checked = false;
cbISCUSTNO.Checked = false;
cbISMBLNO.Checked = false;
//cbISBILLNO.Checked = false;
cbISRPCLIENTNAME.Checked = false;
//cbISRPCOTCODE.Checked = false;
cbISRPCUSTNO.Checked = false;
cbISRPMBLNO.Checked = false;
//cbISRPBILLNO.Checked = false;
}
//
bool bl = false;
if (strHandleType.Equals("add"))//新增
{
bl = getAdd();
}
else if (strHandleType.Equals("edit"))//录入
{
bl = getEdit();
}
//
if (bl)
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key7", "<script>reloadParent('" + strGID.Trim() + "','" + strHandleType.Trim() + "');</script>");
Page.ClientScript.RegisterStartupScript(this.GetType(), "key8", "<script>alert('操作成功!');</script>");
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key8", "<script>alert('出错,请重新填写!');</script>");
}
}
public bool IsNumeric(string s)
{
int inum = 0;
bool bReturn = true;
try
{
inum = int.Parse(s);
}
catch
{
inum = 0;
bReturn = false;
}
return bReturn;
}
//
}
}