217 lines
8.7 KiB
C#
217 lines
8.7 KiB
C#
using System;
|
||
using System.Data;
|
||
using System.Configuration;
|
||
using System.Collections;
|
||
using System.Web;
|
||
using System.Web.Security;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.Web.UI.WebControls.WebParts;
|
||
using System.Web.UI.HtmlControls;
|
||
using GThinking.N_MISPRO;
|
||
using GThinking.N_MISPRO.Data;
|
||
using GThinking.N_MODEL.Page;
|
||
using GThinking.N_CONTROL;
|
||
using GThinking.N_PUBLIC;
|
||
using GThinking.N_MISPRO.Caching;
|
||
using GThinking.N_MISPRO.Utility;
|
||
using System.Collections.Generic;
|
||
using GThinking.N_MISPRO.TableCache;
|
||
|
||
namespace GThinking.N_XLXSBJ
|
||
{
|
||
[TableMap(DB = "DBERP", DbTableName = "XLXSBJDQYFB", Umid = 100860071, IsWorkFlow = false)]
|
||
public class BJYF_JEBLTJ : EntityManager
|
||
{
|
||
|
||
}
|
||
|
||
public partial class BJYF_JEBLTJInfo : SingleCardBase
|
||
{
|
||
BJYF_JEBLTJ entity = new BJYF_JEBLTJ();
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
this.UMID = 100860000;
|
||
this.UMName = "线缆销售报价单运费";
|
||
base.CurMaster = Master;
|
||
base.CurEntity = entity;
|
||
this.PageHeight = 180;
|
||
this.PageWidth = 420;
|
||
Master.EnableAttachBtn = false;
|
||
Master.EnableCancelBtn = false;
|
||
Master.EnableCopyBtn = false;
|
||
Master.EnableDeleteBtn = false;
|
||
Master.EnableEditBtn = false;
|
||
Master.EnableInsertBtn = false;
|
||
Master.EnablePrintBtn = false;
|
||
Master.EnableRefreshBtn = false;
|
||
Master.EnableSaveBtn = false;
|
||
|
||
base.InitPage();
|
||
|
||
if (!IsPostBack)
|
||
{
|
||
InitControl();
|
||
}
|
||
}
|
||
|
||
protected override void SetControlState()
|
||
{
|
||
base.SetControlState();
|
||
if (CheckRight())
|
||
{
|
||
txtTCPBL.Enabled = true;
|
||
txtLCPBL.Enabled = true;
|
||
}
|
||
else
|
||
{
|
||
txtTCPBL.Enabled = false;
|
||
txtLCPBL.Enabled = false;
|
||
}
|
||
chkWG.Enabled = false;
|
||
chkFWG.Enabled = false;
|
||
}
|
||
|
||
private void InitControl()
|
||
{
|
||
lblTCPBL.Text = "铜产品" + PageParam.GetRTrimString("YZMC") + ":";
|
||
lblLCPBL.Text = "铝产品" + PageParam.GetRTrimString("YZMC") + ":";
|
||
|
||
string sMRTJFW = "," + PageParam.GetRTrimString("MRTJFW") + ",";
|
||
if (sMRTJFW.Contains(",1,"))
|
||
chkYBJ.Checked = true;
|
||
if (sMRTJFW.Contains(",2,"))
|
||
chkWG.Checked = true;
|
||
if (sMRTJFW.Contains(",3,"))
|
||
chkFWG.Checked = true;
|
||
|
||
string sBJDID = PageParam.GetRTrimString("BJDID");
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
sql.Add("select XLXSBJDQYFZB_TCPBL,XLXSBJDQYFZB_LCPBL ");
|
||
sql.Add(" from XLXSBJDQYFZB,XLXSBJD ");
|
||
sql.Add("where XLXSBJDQYFZB_XZQHID=XLXSBJD_XZQHID ");
|
||
sql.Add(" and XLXSBJD_BJDID=:pBJDID");
|
||
sql.ParamByName("pBJDID").Value = sBJDID;
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
txtTCPBL.Value = CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSBJDQYFZB_TCPBL"].ToString());
|
||
txtLCPBL.Value = CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSBJDQYFZB_LCPBL"].ToString());
|
||
}
|
||
txtOldTCPBL.Value = txtTCPBL.Value.ToString().Trim();
|
||
txtOldLCPBL.Value = txtLCPBL.Value.ToString().Trim();
|
||
txtXZQHID.Value = PageParam.GetRTrimString("XZQHID");
|
||
|
||
string sJGBBJBM = string.IsNullOrEmpty(PageParam.GetRTrimString("JGBBJBM")) ? "表价" : PageParam.GetRTrimString("JGBBJBM");
|
||
chkYBJ.Text = "有" + sJGBBJBM;
|
||
}
|
||
|
||
private string GetXZQHMC(string sXZQHID)
|
||
{
|
||
string sName = "";
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
SQL.Clear();
|
||
SQL.Add("select XZQH_XZQHID,XZQH_FID,XZQH_PROVINCE,XZQH_CITY from XZQH where XZQH_XZQHID = :pXZQHID ");
|
||
SQL.ParamByName("pXZQHID").Value = sXZQHID;
|
||
DataSet ds = dberp.OpenDataSet(SQL);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
if (ds.Tables[0].Rows[0]["XZQH_FID"].ToString().Trim().Equals("86"))
|
||
sName = ds.Tables[0].Rows[0]["XZQH_PROVINCE"].ToString().Trim();
|
||
else
|
||
sName = ds.Tables[0].Rows[0]["XZQH_PROVINCE"].ToString().Trim() + ds.Tables[0].Rows[0]["XZQH_CITY"].ToString().Trim();
|
||
}
|
||
return sName;
|
||
}
|
||
|
||
//判断是否有报价单运费模块的编辑权限
|
||
private bool CheckRight()
|
||
{
|
||
UserRight UR = OpRightUtils.GetUserRight(tSession.UserId, 100860071);
|
||
if (DSActiveModule.IsActiveModule(100860071) && UR.Edit)
|
||
return true;
|
||
else
|
||
return false;
|
||
}
|
||
|
||
protected void btnOK_Click(object sender, EventArgs e)
|
||
{
|
||
if (CheckRight())
|
||
{
|
||
string Tag = "";
|
||
if (CMISproConvert.StrToFloat(txtOldTCPBL.Value.Trim()) != txtTCPBL.Value)
|
||
{
|
||
Tag += "T";
|
||
}
|
||
if (CMISproConvert.StrToFloat(txtOldLCPBL.Value.Trim()) != txtLCPBL.Value)
|
||
{
|
||
Tag += "L";
|
||
}
|
||
if (!Tag.Equals(""))
|
||
{
|
||
string sName = GetXZQHMC(txtXZQHID.Value.Trim());
|
||
string sTitle = "";
|
||
if (Tag.Equals("T"))
|
||
sTitle = "是否要更新【" + sName + "】【铜产品】的比例?";
|
||
else if (Tag.Equals("L"))
|
||
sTitle = "是否要更新【" + sName + "】【铝产品】的比例?";
|
||
else
|
||
sTitle = "是否要更新【" + sName + "】【铜、铝产品】的比例?";
|
||
Confirm.Register("IsQD", sTitle);
|
||
Confirm.ShowBtnText = TConfirm.cBtnText.Yes_No;
|
||
if (Confirm.GetValue("IsQD").Trim().Equals(""))
|
||
{
|
||
Confirm.Ask("IsQD");
|
||
return;
|
||
}
|
||
else if (Confirm.GetValue("IsQD").Trim().Equals("N"))
|
||
{
|
||
Confirm.Clear();
|
||
}
|
||
else if (Confirm.GetValue("IsQD").Trim().Equals("Y"))
|
||
{
|
||
Confirm.Clear();
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
SQL.Clear();
|
||
SQL.Add(" update XLXSBJDQYFZB set ");
|
||
if (Tag.Contains("T"))
|
||
{
|
||
SQL.Add(" XLXSBJDQYFZB_TCPBL=:XLXSBJDQYFZB_TCPBL,");
|
||
SQL.ParamByName("XLXSBJDQYFZB_TCPBL").Value = txtTCPBL.Value;
|
||
}
|
||
if (Tag.Contains("L"))
|
||
{
|
||
SQL.Add(" XLXSBJDQYFZB_LCPBL=:XLXSBJDQYFZB_LCPBL,");
|
||
SQL.ParamByName("XLXSBJDQYFZB_LCPBL").Value = txtLCPBL.Value;
|
||
}
|
||
SQL.Add(" XLXSBJDQYFZB_WHR=:XLXSBJDQYFZB_WHR,XLXSBJDQYFZB_WHRID=:XLXSBJDQYFZB_WHRID,XLXSBJDQYFZB_WHSJ=:XLXSBJDQYFZB_WHSJ ");
|
||
SQL.Add(" where XLXSBJDQYFZB_XZQHID=:XLXSBJDQYFZB_XZQHID ");
|
||
SQL.ParamByName("XLXSBJDQYFZB_WHR").Value = tSession.UserName;
|
||
SQL.ParamByName("XLXSBJDQYFZB_WHRID").Value = tSession.UserId;
|
||
SQL.ParamByName("XLXSBJDQYFZB_WHSJ").Value = DateTime.Now;
|
||
SQL.ParamByName("XLXSBJDQYFZB_XZQHID").Value = txtXZQHID.Value.Trim();
|
||
dberp.ExecSQL(SQL);
|
||
}
|
||
}
|
||
}
|
||
string sYZID = PageParam.GetRTrimString("YZID");
|
||
string sYZZList = sYZID + "|" + txtTCPBL.Value.ToString() + ";" + txtLCPBL.Value.ToString() + "|" + (chkYBJ.Checked ? "Y" : "N") + "," + (chkWG.Checked ? "Y" : "N") + "," + (chkFWG.Checked ? "Y" : "N");
|
||
//使用脚本给父页面的隐藏控件赋值,调用父页面的控件事件
|
||
DialogOperationScript dos = new DialogOperationScript(this);
|
||
dos.SetOwnerControlValue(PageParam.GetRTrimString("txtPLSZYZListCID"), sYZZList);
|
||
dos.ClickOwnerButton(PageParam.GetRTrimString("btnRefreshCID"));
|
||
dos.CloseSelf();
|
||
dos.Execute();
|
||
}
|
||
|
||
protected void btnQX_Click(object sender, EventArgs e)
|
||
{
|
||
CloseWindow();
|
||
}
|
||
}
|
||
}
|