using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using LYFZ.Model.API;
namespace LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls
{
public class SetCustomControls_SightsColumnHeaderModel
{
private string _PgmID = "";
private string _SightsLevel;
private string _SightsType;
private string _SightsOrderID;
private string _SightsCostPrice;
private string _SightsRemark;
///
/// 套系赠送商品ID(用于检查是否修改过套系商品)
///
public string PgmID
{
get { return _PgmID; }
set { _PgmID = value; }
}
///
/// 景点级别
///
public string SightsLevel
{
get { return _SightsLevel; }
set { _SightsLevel = value; }
}
///
/// 景点类别
///
public string SightsType
{
get { return _SightsType; }
set { _SightsType = value; }
}
///
/// 订单景点ID
///
public string SightsOrderID
{
get { return _SightsOrderID; }
set { _SightsOrderID = value; }
}
///
/// 成本价
///
public string SightsCostPrice
{
get { return _SightsCostPrice; }
set { _SightsCostPrice = value; }
}
///
/// 景点备注
///
public string SightsRemark
{
get { return _SightsRemark; }
set { _SightsRemark = value; }
}
}
public partial class OrderSightsControlsEx : LYFZ.Software.UI.DoorCityProcess.SetCustomControls.OrderSightsControlsEx
{
LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
LYFZ.BLL.BLL_ErpOrderDigital orvbll = new BLL.BLL_ErpOrderDigital();
LYFZ.BLL.BLL_ErpSystemCategory scbll = new BLL.BLL_ErpSystemCategory();
LYFZ.BLL.BLL_ErpOrdersPhotography opbll = new BLL.BLL_ErpOrdersPhotography();
LYFZ.BLL.BLL_ErpOrderDigitalStatus orsbll = new BLL.BLL_ErpOrderDigitalStatus();
public int OrdType = -1;
public bool bUpgrade = false;
public OrderSightsControlsEx()
{
this.btnSightsAdd.Click += btnSightsAdd_Click;
this.btnSightsDelete.Click += btnSightsDelete_Click;
this.btnSightsSet.Click += btnSightsSet_Click;
this.btnReplace.Click += btnReplace_Click;
this.listViewData_Sights.Click += listViewData_Sights_Click;
this.listViewData_Sights.MouseDoubleClick += listViewData_Sights_MouseDoubleClick;
this.txtText.KeyPress += txtText_KeyPress;
this.txtText.Leave += txtText_Leave;
this.cmbtreevText.Leave += cmbtreevText_Leave;
this.dtpText.Leave += dtpText_Leave;
this.lblBrowseSelect.Click += lblBrowseSelect_Click;
this.IsClickToolbox = false;
this.listViewData_Sights.View = View.Details;
this.listViewData_Sights.GridLines = true;
ImageList imgList = new ImageList();
imgList.ImageSize = new Size(1, 25);
this.listViewData_Sights.SmallImageList = imgList;
string[] StrColumns = "景点名称,景点价格,来源,景点类别,拍摄级别,服装套数,预拍时间,备注".Split(',');
int SurplusCount = 230 + 80 * 3 + 80 + 70 + 5 + 90;
for (int i = 0; i < StrColumns.Length; i++)
{
ColumnHeader ch = new ColumnHeader();
ch.Text = StrColumns[i].Trim();
switch (StrColumns[i].Trim())
{
case "景点名称": ch.Width = 230; break;
case "服装套数": ch.Width = 80; break;
case "来源": ch.Width = 70; break;
case "预拍时间": ch.Width = 90; break;
case "备注": ch.Width = this.listViewData_Sights.Width - SurplusCount; break;
default: ch.Width = 80; break;
}
switch (StrColumns[i].Trim())
{
case "景点名称": ch.TextAlign = HorizontalAlignment.Left; break;
case "服装套数":
case "拍摄级别":
case "来源":
case "景点类别": ch.TextAlign = HorizontalAlignment.Center; break;
case "景点价格": ch.TextAlign = HorizontalAlignment.Right; break;
}
this.listViewData_Sights.Columns.Add(ch);
}
DataTable tbl = scbll.GetCategory("Sc_ClassCode,Sc_ClassName", "Sc_ClassParentID ='" + scbll.GetCategory("ID", "Sc_ClassCode = 'BEBBBCADFEBEJBGD'").Tables[0].Rows[0]["ID"].ToString().Trim() + "'").Tables[0];
for (int i = 0; i < tbl.Rows.Count; i++)
{
TreeNode root = new TreeNode();
root.Text = tbl.Rows[i]["Sc_ClassName"].ToString().Trim();
root.Tag = tbl.Rows[i]["Sc_ClassCode"].ToString().Trim();
this.cmbtreevText.Nodes.Add(root);
}
}
void dtpText_Leave(object sender, EventArgs e)
{
this.listViewData_Sights.SelectedItems[0].SubItems["预拍时间"].Text = this.dtpText.DateValue;
this.dtpText.Visible = false;
}
///
/// 登录者员工ID
///
string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
#region 点击列显示下拉框
///
/// 列表点击事件
///
///
///
void listViewData_Sights_Click(object sender, EventArgs e)
{
this.txtText.Visible = false;
this.cmbtreevText.Visible = false;
}
///
/// 列表双击事件
///
///
///
void listViewData_Sights_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.listViewData_Sights_Click(this, null);
ListViewHitTestInfo info = this.listViewData_Sights.HitTest(e.X, e.Y);
if (!string.IsNullOrEmpty(info.SubItem.Name.Trim()))
{
Rectangle rect = info.SubItem.Bounds;
switch (info.SubItem.Name.Trim())
{
case "备注":
case "服装套数":
if (info.SubItem.Name.Trim() == "备注")
{ this.txtText.MaxLength = 400; }
else
{
if (!string.IsNullOrEmpty(this.listViewData_Sights.SelectedItems[0].SubItems["来源"].Text.Trim()))
{ return; }
else
{ this.txtText.MaxLength = 3; }
}
this.txtText.Location = new Point(rect.Location.X + this.listViewData_Sights.Location.X + 3, rect.Location.Y + this.listViewData_Sights.Location.Y + 2);
this.txtText.Size = rect.Size;
this.txtText.Visible = true;
this.txtText.Tag = info.SubItem.Name.Trim();
this.txtText.Text = info.SubItem.Text.Trim();
this.txtText.Focus();
break;
case "拍摄级别":
this.cmbtreevText.Location = new Point(rect.Location.X + this.listViewData_Sights.Location.X + 3, rect.Location.Y + this.listViewData_Sights.Location.Y + 4);
this.cmbtreevText.Size = rect.Size;
this.cmbtreevText.Visible = true;
this.cmbtreevText.TextFindTag(info.SubItem.Text.Trim());
this.cmbtreevText.Focus();
break;
case "预拍时间":
this.dtpText.Location = new Point(rect.Location.X + this.listViewData_Sights.Location.X + 3, rect.Location.Y + this.listViewData_Sights.Location.Y + 4);
this.dtpText.Size = rect.Size;
this.dtpText.Visible = true;
this.dtpText.DateValue = (info.SubItem.Text.Trim());
this.dtpText.Focus();
break;
}
}
}
///
/// 服装套数输入限制
///
///
///
void txtText_KeyPress(object sender, KeyPressEventArgs e)
{
if (this.txtText.Tag != null)
{
if (this.txtText.Tag.ToString().Trim() == "服装套数")
{
//if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
//{ e.Handled = true; }
if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
{ e.Handled = true; }
if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
{ e.Handled = true; }
}
}
}
///
/// 服装套数离开事件
///
///
///
void txtText_Leave(object sender, EventArgs e)
{
if (this.txtText.Tag != null)
{
if (this.txtText.Tag.ToString().Trim() == "服装套数")
{
if (!string.IsNullOrEmpty(this.txtText.Text.Trim()))
{
try
{
if (!LYFZ.Command.Command_Validate.IsNumeric(this.txtText.Text.Trim()))
{ this.txtText.Text = ""; }
}
catch
{ this.txtText.Text = ""; }
}
try
{ this.listViewData_Sights.SelectedItems[0].SubItems[this.txtText.Tag.ToString().Trim()].Text = this.txtText.Text.Trim() == "" ? "1" : this.txtText.Text; }
catch
{ }
}
else
{ this.listViewData_Sights.SelectedItems[0].SubItems[this.txtText.Tag.ToString().Trim()].Text = this.txtText.Text.Trim(); }
}
this.listViewData_Sights_Click(this, null);
}
///
/// 拍摄级别离开事件
///
///
///
void cmbtreevText_Leave(object sender, EventArgs e)
{
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = (SetCustomControls_SightsColumnHeaderModel)this.listViewData_Sights.SelectedItems[0].Tag;
ColumnModel.SightsLevel = this.cmbtreevText.Tag.ToString().Trim();
this.listViewData_Sights.SelectedItems[0].SubItems["拍摄级别"].Text = this.cmbtreevText.Text.Trim();
this.listViewData_Sights_Click(this, null);
}
#endregion
///
/// 景点添加
///
///
///
void btnSightsAdd_Click(object sender, EventArgs e)
{
if (!this.IsClickToolbox)
{ MessageBoxCustom.Show("请先选择套系名称!"); return; }
LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.SightsAddSmallForm frm = new SetSmallForm.SightsAddSmallForm();
frm.LoadType = "景点设置";
frm.ShowDialog();
if (frm.IsSaveed)
{ this.SetOrderSightsValue(frm.mlist, frm.tbl); }
}
///
/// 景点删除
///
///
///
void btnSightsDelete_Click(object sender, EventArgs e)
{
if (this.listViewData_Sights.SelectedItems.Count > 0)
{
if (string.IsNullOrEmpty(this.listViewData_Sights.SelectedItems[0].SubItems["来源"].Text.Trim()))
{
bool isDelete = true;
if (!string.IsNullOrEmpty(this.StrOrdNumber))
{
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = (SetCustomControls_SightsColumnHeaderModel)this.listViewData_Sights.SelectedItems[0].Tag;
if (!string.IsNullOrEmpty(ColumnModel.SightsOrderID))
{
DataTable tbl = orbll.GetView_Custom("tb_ErpOrdersPhotography", StrWhere: "ID = '" + ColumnModel.SightsOrderID + "'", ShowColumnName: "Ordpg_ViceNumber,Ordpg_PhotographyStatus").Tables[0];
if (tbl.Rows.Count > 0)
{
if (tbl.Rows[0]["Ordpg_PhotographyStatus"].ToString().Trim() != "0")
{ MessageBoxCustom.Show("此景点拍照已OK,不能删除"); isDelete = false; }
else
{
LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", this.StrOrdNumber);
LYFZ.Model.Model_ErpOrderDigital vmodel = orvbll.GetModel("Ordv_ViceNumber", tbl.Rows[0]["Ordpg_ViceNumber"].ToString().Trim());
LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel);
List sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.Small, this.listViewData_Sights.SelectedItems[0].Text.Trim());
if (sPhotoList.Count == 0)
{
if (MessageBoxCustom.Show("您确定要删除此拍摄景点吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
{ return; }
this.listViewData_Sights.Items.Remove(this.listViewData_Sights.SelectedItems[0]);
isDelete = false;
}
else
{ MessageBoxCustom.Show("此景点已导片,不能删除"); isDelete = false; }
}
}
}
}
if (isDelete)
{ this.listViewData_Sights.Items.Remove(this.listViewData_Sights.SelectedItems[0]); }
}
}
if ((this.listViewData_Sights.Items.Count - 1)<0)
{
return;
}
this.listViewData_Sights.Items[this.listViewData_Sights.Items.Count - 1].Selected = true;
this.listViewData_Sights.Focus();
}
public void DeleteSightByNotAction()
{
foreach (ListViewItem sightItem in this.listViewData_Sights.Items)
{
if (string.IsNullOrEmpty(sightItem.SubItems["来源"].Text.Trim()))
{
bool isDelete = true;
if (!string.IsNullOrEmpty(this.StrOrdNumber))
{
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = (SetCustomControls_SightsColumnHeaderModel)sightItem.Tag;
if (!string.IsNullOrEmpty(ColumnModel.SightsOrderID))
{
DataTable tbl = orbll.GetView_Custom("tb_ErpOrdersPhotography", StrWhere: "ID = '" + ColumnModel.SightsOrderID + "'", ShowColumnName: "Ordpg_ViceNumber,Ordpg_PhotographyStatus").Tables[0];
if (tbl.Rows.Count > 0)
{
if (tbl.Rows[0]["Ordpg_PhotographyStatus"].ToString().Trim() != "0")
{ isDelete = false; }
else
{
LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", this.StrOrdNumber);
LYFZ.Model.Model_ErpOrderDigital vmodel = orvbll.GetModel("Ordv_ViceNumber", tbl.Rows[0]["Ordpg_ViceNumber"].ToString().Trim());
LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel);
List sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.Small, sightItem.Text.Trim());
if (sPhotoList.Count == 0)
{
this.listViewData_Sights.Items.Remove(sightItem);
isDelete = false;
}
else
{ isDelete = false; }
}
}
}
}
if (isDelete)
{ this.listViewData_Sights.Items.Remove(sightItem); }
}
}
if ((this.listViewData_Sights.Items.Count - 1) < 0)
{
return;
}
this.listViewData_Sights.Items[this.listViewData_Sights.Items.Count - 1].Selected = true;
this.listViewData_Sights.Focus();
this.bUpgrade = true;
}
///
/// 景点设置
///
///
///
void btnSightsSet_Click(object sender, EventArgs e)
{
LYFZ.Software.MainBusiness.InitialSet.FrmAttractionsSet frm = new InitialSet.FrmAttractionsSet("0");
frm.StrSightsType = "0";
frm.ShowDialog();
this.listViewData_Sights.Focus();
}
///
/// 更换
///
///
///
void btnReplace_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.StrOrdNumber))
{
if (this.listViewData_Sights.SelectedItems.Count <= 0)
{
MessageBoxCustom.Show("请选择你要更换的景点"); return;
}
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = (SetCustomControls_SightsColumnHeaderModel)this.listViewData_Sights.SelectedItems[0].Tag;
if (!string.IsNullOrEmpty(ColumnModel.SightsOrderID))
{
DataTable tbl = orbll.GetView_Custom("tb_ErpOrdersPhotography", StrWhere: "ID = '" + ColumnModel.SightsOrderID + "'", ShowColumnName: "Ordpg_ViceNumber,Ordpg_PhotographyStatus").Tables[0];
if (tbl.Rows.Count > 0)
{
if (tbl.Rows[0]["Ordpg_PhotographyStatus"].ToString().Trim() == "1")
{
MessageBoxCustom.Show("此景点已拍照OK,不能更换");
this.listViewData_Sights.Focus();
return;
}
}
}
}
if (!this.IsClickToolbox)
{ MessageBoxCustom.Show("请先选择套系名称!"); return; }
if (this.listViewData_Sights.SelectedItems.Count != 1)
{ MessageBoxCustom.Show("请选择要更换的景点!"); return; }
List SightsList = new List();
foreach (ListViewItem item in this.listViewData_Sights.Items)
{ SightsList.Add(item.Text.Trim()); }
LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.SightsAddSmallForm frm = new SetSmallForm.SightsAddSmallForm();
frm.GetType = "更换";
frm.LoadType = "景点设置";
frm.RemovedSightsList = SightsList;
frm.ShowDialog();
if (frm.IsSaveed)
{
string StrOldSightsName = this.listViewData_Sights.SelectedItems[0].Text;
LYFZ.Model.Model_ErpTheScenery modelss = frm.mlist[0];
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = (SetCustomControls_SightsColumnHeaderModel)this.listViewData_Sights.SelectedItems[0].Tag;
ColumnModel.SightsLevel = modelss.Tsc_Rating.Trim();
ColumnModel.SightsType = modelss.Tcs_Category.ToString().Trim();
ColumnModel.SightsCostPrice = modelss.Tsc_CostPrice.ToString().Trim();
ColumnModel.SightsRemark = modelss.Tsc_Remark;
this.listViewData_Sights.SelectedItems[0].Text = modelss.Tsc_Name;
this.listViewData_Sights.SelectedItems[0].SubItems["景点价格"].Text = modelss.Tsc_SalesPrice.ToString().Trim();
this.listViewData_Sights.SelectedItems[0].SubItems["景点类别"].Text = modelss.Tcs_Category == 0 ? "内景" : "外景";
this.listViewData_Sights.SelectedItems[0].SubItems["服装套数"].Text = "1";
string StrClassName = "";
DataRow dtRow = frm.tbl.Rows.Find(modelss.Tsc_Rating.Trim());
if (dtRow == null)
{ StrClassName = ""; }
else
{ StrClassName = dtRow["Sc_ClassName"].ToString().Trim(); }
this.listViewData_Sights.SelectedItems[0].SubItems["拍摄级别"].Text = StrClassName;
this.listViewData_Sights.SelectedItems[0].SubItems["备注"].Text = "景点由'" + StrOldSightsName + "'更换为'" + this.listViewData_Sights.SelectedItems[0].Text + "'";
}
this.listViewData_Sights.Focus();
}
///
/// 浏览选择
///
///
///
void lblBrowseSelect_Click(object sender, EventArgs e)
{
LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.StyleViewSmallForm frm = new SetSmallForm.StyleViewSmallForm();
frm.frmStyleViewVersion = SetSmallForm.StyleViewSmallForm.StyleViewVersion.景点浏览;
List OldSelectStyleList = new List();
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{
OldSelectStyleList.Add(this.listViewData_Sights.Items[i].Text.Trim());
}
frm.OldSelectStyleList = OldSelectStyleList;
frm.WindowState = FormWindowState.Maximized;
frm.ShowDialog();
if (frm.IsSaveed)
{
List strList = frm.SelectStyleList;
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{
for (int j = 0; j < strList.Count; j++)
{
if (this.listViewData_Sights.Items[i].Text.Trim() == strList[j].Trim())
{
strList.RemoveAt(j);
break;
}
}
}
string StrWhere = "";
for (int i = 0; i < strList.Count; i++)
{
StrWhere += "'" + strList[i].Trim() + "',";
}
if (!string.IsNullOrEmpty(StrWhere))
{
LYFZ.BLL.BLL_ErpTheScenery tsybll = new BLL.BLL_ErpTheScenery();
List mlist = tsybll.GetModelList("Tsc_Name in (" + StrWhere.TrimEnd(',') + ") And Tsc_Type = '0'");
//DataTable tbl = orbll.GetView_Custom("tb_ErpTheScenery", StrWhere: "ID in (" + StrWhere.TrimEnd(',') + ")", ShowColumnName: "").Tables[0];
DataTable tbl = new LYFZ.BLL.BLL_ErpSystemCategory().GetAllList().Tables[0];
tbl.PrimaryKey = new DataColumn[] { tbl.Columns["Sc_ClassCode"] };
this.SetOrderSightsValue(mlist, tbl);
}
}
}
#region 属性
private bool _isClickToolbox;
///
/// 是否能点击工具箱
///
public bool IsClickToolbox
{
get { return _isClickToolbox; }
set { _isClickToolbox = value; }
}
private string _strOrdNumber;
///
/// 订单号
///
public string StrOrdNumber
{
get { return _strOrdNumber; }
set { _strOrdNumber = value; }
}
private bool _isShowSightsSet;
///
/// 是否显示景点设置
///
public bool IsShowSightsSet
{
get { return _isShowSightsSet; }
set
{
_isShowSightsSet = value;
this.btnSightsSet.Enabled = _isShowSightsSet;
}
}
///
/// 获取商品的总价
///
///
public decimal GetSightsAoumnt()
{
decimal dec_Aoumnt = 0;
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = (SetCustomControls_SightsColumnHeaderModel)this.listViewData_Sights.Items[i].Tag;
dec_Aoumnt += Convert.ToDecimal(ColumnModel.SightsCostPrice);
}
return dec_Aoumnt;
}
///
/// 获取列表详情数据
///
///
public string GetOrderSightsContentDetails()
{
string StrContentDetails = "";
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{ StrContentDetails += "名称:" + this.listViewData_Sights.Items[i].Text.Trim() + " 套数:" + this.listViewData_Sights.Items[i].SubItems["服装套数"].Text.Trim() + " ;"; }
return StrContentDetails;
}
///
/// 获取当前列表
///
///
public DataTable GetListViewData()
{
DataTable NewTable = new DataTable();
NewTable.Columns.Add("PgmID", typeof(string));
for (int i = 0; i < this.listViewData_Sights.Columns.Count; i++)
{
NewTable.Columns.Add(this.listViewData_Sights.Columns[i].Text.Trim(), typeof(string));
}
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{
if (string.IsNullOrEmpty(this.listViewData_Sights.Items[i].SubItems["来源"].Text.Trim()))
{
DataRow newRow = NewTable.NewRow();
for (int j = 0; j < this.listViewData_Sights.Columns.Count; j++)
{
if (j == 0)
{
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = (SetCustomControls_SightsColumnHeaderModel)this.listViewData_Sights.Items[i].Tag;
newRow["PgmID"] = ColumnModel.PgmID;
newRow[this.listViewData_Sights.Columns[j].Text.Trim()] = this.listViewData_Sights.Items[i].Text.Trim();
}
else
{ newRow[this.listViewData_Sights.Columns[j].Text.Trim()] = this.listViewData_Sights.Items[i].SubItems[this.listViewData_Sights.Columns[j].Text.Trim()].Text.Trim(); }
}
NewTable.Rows.Add(newRow);
}
}
return NewTable;
}
#endregion
///
/// 绑定景点的数据信息
///
///
public void GetOrderSightsValueData(Api_ErpOrderModel erpModel)
{
erpModel.OrderSightData = new List();
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{
SetCustomControls_SightsColumnHeaderModel ColumnModel = (SetCustomControls_SightsColumnHeaderModel)this.listViewData_Sights.Items[i].Tag;
string strReservationPhotographyTime = this.listViewData_Sights.Items[i].SubItems["预拍时间"].Text.Trim();
if (this.listViewData_Sights.Items[i].SubItems["预拍时间"].Tag != null)
{
string[] dateTimeList = this.listViewData_Sights.Items[i].SubItems["预拍时间"].Tag.ToString().Split(' ');
if (dateTimeList.Length > 1)
{
strReservationPhotographyTime = strReservationPhotographyTime + " " + dateTimeList[1].Trim();
}
}
Api_StagesModel model = new Api_StagesModel()
{
SightsOrderName = this.listViewData_Sights.Items[i].Text,
PgmID = ColumnModel.PgmID,
SightsLevel = ColumnModel.SightsLevel,
SightsOrderID = ColumnModel.SightsOrderID,
SightsCostPrice = ColumnModel.SightsCostPrice,
SightsType = ColumnModel.SightsType,
SightsRemark = this.listViewData_Sights.Items[i].SubItems["备注"].Text.Trim(),
SightsPrice = this.listViewData_Sights.Items[i].SubItems["景点价格"].Text.Trim(),
Source = this.listViewData_Sights.Items[i].SubItems["来源"].Text.Trim(),
WearCount = Convert.ToInt32(this.listViewData_Sights.Items[i].SubItems["服装套数"].Text.Trim()),
StagesReservationPhotographyTime = strReservationPhotographyTime.Trim()
};
erpModel.OrderSightData.Add(model);
}
}
///
/// 获取订单景点数据
///
/// 是否检测无数据提示:true为提示(如用于保存订单);false为不提示(如用于保存意向订单)
///
public List GetOrderSightsValue(Hashtable htData_RegisterAndBottom, string StrNumber, DateTime strTime, ref bool IsContinue, bool IsMagess = true)
{
List clist = new List();
LYFZ.Model.Model_ErpOrderDigital ViceModel = orvbll.GetModel("Ordv_ViceNumber", StrNumber + "_001");
if (this.listViewData_Sights.Items.Count > 0)
{
int WeddingCount = 0;
int PhotoCount = 0;
LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
LYFZ.Model.Model_ErpSystemConfigure systemModel = sgbll.GetModel("Sconfig_Code", "DayRemind");
if (systemModel.ID > 0 && !string.IsNullOrEmpty(systemModel.Sconfig_Value))
{
string[] StrArray = systemModel.Sconfig_Value.Trim().Split('|');
string[] StrArray2 = StrArray[0].Trim().Split(',');
if (StrArray2.Length >= 1 && StrArray2[0].Trim().Length > 0)
{ WeddingCount = Convert.ToInt32(StrArray2[0].Trim()); }
if (StrArray2.Length >= 3 && StrArray2[2].Trim().Length > 0)
{ PhotoCount = Convert.ToInt32(StrArray2[2].Trim()); }
}
if (ViceModel.ID <= 0)
{
ViceModel = new Model.Model_ErpOrderDigital();
ViceModel.Ordv_Number = StrNumber;
ViceModel.Ordv_ViceNumber = StrNumber + "_001";
ViceModel.Ordv_DigitalNumber = 1;
ViceModel.Ordv_IntoBottomAddPickQuantity = 0;
ViceModel.Ordv_IntoRegisterAddPickQuantity = 0;
ViceModel.Ordv_ClothingDispatcher = "";
ViceModel.Ordv_ClothingName = "";
ViceModel.Ordv_ClothingRemark = "";
ViceModel.Ordv_ClothingStatus = "0";
ViceModel.Ordv_CreateDatetime = strTime;
ViceModel.Ordv_CreateName = strUserID;
ViceModel.Ordv_DesignerDispatcher = "";
ViceModel.Ordv_DesignerName = "";
ViceModel.Ordv_DesignerStatus = "0";
ViceModel.Ordv_DesignValidation = "";
ViceModel.Ordv_EarlyRepairDispatcher = "";
ViceModel.Ordv_EarlyRepairName = "";
ViceModel.Ordv_EarlyRepairStatus = "0";
ViceModel.Ordv_FilmSelectionDispatcher = "";
ViceModel.Ordv_FilmSelectionName = "";
ViceModel.Ordv_FilmSelectionStatus = "0";
ViceModel.Ordv_LookDesignClaim = "";
ViceModel.Ordv_LookDesignDispatcher = "";
ViceModel.Ordv_LookDesignName = "";
ViceModel.Ordv_LookDesignStatus = "0";
ViceModel.Ordv_RefinementDispatcher = "";
ViceModel.Ordv_RefinementName = "";
ViceModel.Ordv_RefinementStatus = "0";
ViceModel.Ordv_ReservationClothingName = "";
ViceModel.Ordv_ReservationDesignerName = "";
ViceModel.Ordv_ReservationEarlyRepairName = "";
ViceModel.Ordv_ReservationFilmSelectionName = "";
ViceModel.Ordv_ReservationLookDesignName = "";
ViceModel.Ordv_ReservationRefinementName = "";
ViceModel.Ordv_ReservationSendPhotoName = "";
ViceModel.Ordv_ReservationSendPhotoStatus = "0";
ViceModel.Ordv_SelectionDesign = "";
ViceModel.Ordv_SelectionFilm = "";
ViceModel.Ordv_UpdateName = "";
ViceModel.Ordv_IntoRegisterQuantity = Convert.ToInt32(htData_RegisterAndBottom["IntoRegisterQuantity"].ToString().Trim());
ViceModel.Ordv_IntoBottomQuantity = Convert.ToInt32(htData_RegisterAndBottom["IntoBottomQuantity"].ToString().Trim());
ViceModel.Ordv_IntoRegisterQuantityPackage = Convert.ToInt32(htData_RegisterAndBottom["IntoRegisterQuantityPackage"].ToString().Trim());
ViceModel.Ordv_IntoBottomQuantityPackage = Convert.ToInt32(htData_RegisterAndBottom["IntoBottomQuantityPackage"].ToString().Trim());
ViceModel.Ordv_IntoRegisterQuantity += ViceModel.Ordv_IntoRegisterQuantityPackage;
if (ViceModel.Ordv_IntoBottomQuantity != -1 && ViceModel.Ordv_IntoBottomQuantityPackage != -1)
{ ViceModel.Ordv_IntoBottomQuantity += ViceModel.Ordv_IntoBottomQuantityPackage; }
clist.Add(orvbll.GetAddCommandInfo(ViceModel));
LYFZ.Model.Model_ErpOrderDigitalStatus modelStatus = new Model.Model_ErpOrderDigitalStatus();
modelStatus.Ords_Number = "ORDS_" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
modelStatus.Ords_OrdNumber = ViceModel.Ordv_Number;
modelStatus.Ords_ViceNumber = ViceModel.Ordv_ViceNumber;
modelStatus.Ords_DigitalNumber = ViceModel.Ordv_DigitalNumber;
modelStatus.Ords_OutSendEarlyRepairName = "";
modelStatus.Ords_OutSendEarlyRepairQuantity = 0;
modelStatus.Ords_OutSendEarlyRepairStatus = "未发";
modelStatus.Ords_OutSendEarlyRepairVendor = "";
modelStatus.Ords_OutSendEarlyRepairVendorQQ = "";
modelStatus.Ords_PhotographStatus = "未拍";
modelStatus.Ords_PhotographIntStatus = 0;
modelStatus.Ords_SightsName = "";
modelStatus.Ords_Photographer = "";
modelStatus.Ords_PhotographyAssistant = "";
modelStatus.Ords_MakeupArtist = "";
modelStatus.Ords_MakeupAssistant = "";
modelStatus.Ords_BootDivision = "";
modelStatus.Ords_BootDivisionAssistant = "";
modelStatus.Ords_ProductSendStatus = "未发";
modelStatus.Ords_ProductCompletedStatus = "未完";
modelStatus.Ords_ProductPickupStatus = "未取";
modelStatus.Ords_ProductPickupIntStatus = 0;
modelStatus.Ords_ProductIsExpedited = "否";
modelStatus.Ords_ServiceStatus = "未进行";
modelStatus.Ords_ServiceIntStatus = 0;
clist.Add(orsbll.GetAddCommandInfo(modelStatus));
}
else
{
ViceModel.Ordv_IntoRegisterQuantity = Convert.ToInt32(htData_RegisterAndBottom["IntoRegisterQuantity"].ToString().Trim());
ViceModel.Ordv_IntoBottomQuantity = Convert.ToInt32(htData_RegisterAndBottom["IntoBottomQuantity"].ToString().Trim());
ViceModel.Ordv_IntoRegisterQuantityPackage = Convert.ToInt32(htData_RegisterAndBottom["IntoRegisterQuantityPackage"].ToString().Trim());
ViceModel.Ordv_IntoBottomQuantityPackage = Convert.ToInt32(htData_RegisterAndBottom["IntoBottomQuantityPackage"].ToString().Trim());
ViceModel.Ordv_IntoRegisterQuantity += ViceModel.Ordv_IntoRegisterQuantityPackage;
if (ViceModel.Ordv_IntoBottomQuantity != -1 && ViceModel.Ordv_IntoBottomQuantityPackage != -1)
{ ViceModel.Ordv_IntoBottomQuantity += ViceModel.Ordv_IntoBottomQuantityPackage; }
clist.Add(orvbll.GetUpdateCommandInfo(ViceModel));
}
LYFZ.Model.Model_ErpOrdersPhotography model = null;
DataTable dt = orbll.GetView_Custom("tb_ErpOrdersPhotography", StrWhere: "Ordpg_Number = '" + StrNumber + "'", ShowColumnName: "*").Tables[0];
dt.PrimaryKey = new DataColumn[] { dt.Columns["Ordpg_Sights"] };
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = (SetCustomControls_SightsColumnHeaderModel)this.listViewData_Sights.Items[i].Tag;
if (ColumnModel.SightsOrderID.Trim().Length > 0)
{
DataRow[] dtRows = dt.Select("ID = '" + ColumnModel.SightsOrderID.Trim() + "'");
if (dtRows.Length <= 0)
{
model = new Model.Model_ErpOrdersPhotography();
model.Ordpg_IDNumber = "JD_" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
model.Ordpg_Number = StrNumber;
model.Ordpg_ViceNumber = StrNumber + "_001";
model.Ordpg_BootDivision = "";
model.Ordpg_BootDivisionAssistant = "";
model.Ordpg_Dispatcher = "";
model.Ordpg_ImportPhotoer = "";
model.Ordpg_MakeupArtist = "";
model.Ordpg_MakeupAssistant = "";
model.Ordpg_Photographer = "";
model.Ordpg_PhotographyAssistant = "";
model.Ordpg_PhotographyStatus = "0";
model.Ordpg_Remark = "";
model.Ordpg_ReservationBootDivision = "";
model.Ordpg_ReservationBootDivisionAssistant = "";
model.Ordpg_ReservationMakeupArtist = "";
model.Ordpg_ReservationMakeupAssistant = "";
model.Ordpg_ReservationPhotographyAssistant = "";
model.Ordpg_ReservationPhotographyName = "";
model.Ordpg_CreateName = this.strUserID;
model.Ordpg_CreateDateTime = strTime;
model.Ordpg_UpdateName = "";
model.Ordpg_OpenOrderSource = this.listViewData_Sights.Items[i].SubItems["来源"].Text.Trim();
}
else
{
model = opbll.DataRowToModel(dtRows[0]);
model.Ordpg_UpdateDateTime = strTime;
model.Ordpg_UpdateName = this.strUserID;
dt.Rows.Remove(dtRows[0]);
}
}
else
{
DataRow dtRow = dt.Rows.Find(this.listViewData_Sights.Items[i].Text.Trim());
if (dtRow != null)
{
model = opbll.DataRowToModel(dtRow);
model.Ordpg_UpdateDateTime = strTime;
model.Ordpg_UpdateName = this.strUserID;
dt.Rows.Remove(dtRow);
}
else
{
model = new Model.Model_ErpOrdersPhotography();
model.Ordpg_IDNumber = "JD_" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
model.Ordpg_Number = StrNumber;
model.Ordpg_ViceNumber = StrNumber + "_001";
model.Ordpg_BootDivision = "";
model.Ordpg_BootDivisionAssistant = "";
model.Ordpg_Dispatcher = "";
model.Ordpg_ImportPhotoer = "";
model.Ordpg_MakeupArtist = "";
model.Ordpg_MakeupAssistant = "";
model.Ordpg_Photographer = "";
model.Ordpg_PhotographyAssistant = "";
model.Ordpg_PhotographyStatus = "0";
model.Ordpg_Remark = "";
model.Ordpg_ReservationBootDivision = "";
model.Ordpg_ReservationBootDivisionAssistant = "";
model.Ordpg_ReservationMakeupArtist = "";
model.Ordpg_ReservationMakeupAssistant = "";
model.Ordpg_ReservationPhotographyAssistant = "";
model.Ordpg_ReservationPhotographyName = "";
model.Ordpg_CreateName = this.strUserID;
model.Ordpg_CreateDateTime = strTime;
model.Ordpg_UpdateName = "";
model.Ordpg_OpenOrderSource = this.listViewData_Sights.Items[i].SubItems["来源"].Text.Trim();
}
}
if (this.listViewData_Sights.Items[i].SubItems["预拍时间"].Text.Trim() != "")
{
string StrPreShotDateTime = this.listViewData_Sights.Items[i].SubItems["预拍时间"].Text.Trim();
#region 判断预约日期是否满档或需要授权
if (!string.IsNullOrEmpty(StrPreShotDateTime))
{
bool IsShowPrompt = true;
if (!string.IsNullOrEmpty(LYFZ.Command.Command_Validate.DateTimeToString(model.Ordpg_ReservationPhotographyTime)))
{
if (Convert.ToDateTime(StrPreShotDateTime).ToString("yyyy-MM-dd") == LYFZ.Command.Command_Validate.DateTimeToString(model.Ordpg_ReservationPhotographyTime))
{ IsShowPrompt = false; }
}
if (IsShowPrompt && OrdType>-1)
{
string StrWhere = " Ord_Type in ('" + OrdType + "') And Ordpg_ViceNumber != '" + model.Ordpg_ViceNumber + "'" + LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Ordpg_ReservationPhotographyTime", StrPreShotDateTime, StrPreShotDateTime);
string StrTableName = "tb_ErpOrdersPhotography Left Join tb_ErpOrderDigital on Ordv_ViceNumber = Ordpg_ViceNumber Left Join tb_ErpOrder on Ord_Number = Ordpg_Number";
string StrColumnName = " distinct Ordv_ViceNumber";
DataTable photographyDt = orbll.GetView_Custom(StrTableName, StrWhere: StrWhere, ShowColumnName: StrColumnName, GroupBy: StrColumnName).Tables[0];
if (dt.Rows.Count >= (OrdType==0?WeddingCount:PhotoCount))
{
if (MessageBoxCustom.Show("拍摄名称‘" + model.Ordpg_Sights + "’\r\n预拍日期‘" + StrPreShotDateTime + "’\r\n可安排的‘" + (OrdType == 0 ? "婚纱单" : "写真单") + ":" + (OrdType == 0 ? WeddingCount : PhotoCount) + "单’已满。\r\n是否要继续安排?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
{ IsContinue = true; return null; }
if (!LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetMagess(IsShowPrompt: false))
{ IsContinue = true; return null; }
}
}
}
#endregion
model.Ordpg_ReservationPhotographyTime = Convert.ToDateTime(StrPreShotDateTime);
model.Ordpg_ReservationPhotographyDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
}
else
{ model.Ordpg_ReservationPhotographyTime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime(); }
model.Ordpg_Sights = this.listViewData_Sights.Items[i].Text.Trim();
model.Ordpg_SightsRemark = ColumnModel.SightsRemark;
model.Ordpg_CostPrice = Convert.ToDecimal(ColumnModel.SightsCostPrice);
model.Ordpg_SalesPrice = Convert.ToDecimal(this.listViewData_Sights.Items[i].SubItems["景点价格"].Text.Trim());
model.Ordpg_ApparelQuantity = Convert.ToInt32(this.listViewData_Sights.Items[i].SubItems["服装套数"].Text.Trim());
model.Ordpg_OpenOrderRemark = this.listViewData_Sights.Items[i].SubItems["备注"].Text.Trim();
model.Ordpg_SightsLevel = ColumnModel.SightsLevel.Trim();
model.Ordpg_SightsType = ColumnModel.SightsType.Trim();
if (model.ID > 0)
{ clist.Add(opbll.GetUpdateCommandInfo(model)); }
else
{ clist.Add(opbll.GetAddCommandInfo(model)); }
}
//for (int i = 0; i < RemoveList.Count; i++)
//{ dt.Rows.Remove(RemoveList[i]); }
for (int i = 0; i < dt.Rows.Count; i++)
{ clist.Add(opbll.GetDeleteCommandInfo("ID", "=", dt.Rows[i]["ID"])); }
}
else
{
if (IsMagess)
{ MessageBoxCustom.Show("拍摄次数至少要有一项!"); IsContinue = true; return null; }
else
{
if (ViceModel.ID > 0)
{
DataTable dt = orbll.GetView_Custom("tb_ErpOrdersPhotography", StrWhere: "Ordpg_Number = '" + StrNumber + "'", ShowColumnName: "*").Tables[0];
for (int i = 0; i < dt.Rows.Count; i++)
{
clist.Add(opbll.GetDeleteCommandInfo("ID", "=", dt.Rows[i]["ID"]));
}
}
}
}
return clist;
}
///
/// 设置绑定订单景点数据
///
///
public void SetOrderSightsValue(List mlist, DataTable tbl)
{
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{
for (int j = 0; j < mlist.Count; j++)
{
if (this.listViewData_Sights.Items[i].Text.Trim() == mlist[j].Tsc_Name.Trim())
{
mlist.RemoveAt(j);
break;
}
}
}
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = null;
for (int i = 0; i < mlist.Count; i++)
{
ListViewItem lvItem = new ListViewItem();
ColumnModel = new SetCustomControls_SightsColumnHeaderModel();
ColumnModel.SightsLevel = mlist[i].Tsc_Rating.Trim();
ColumnModel.SightsType = mlist[i].Tcs_Category.ToString().Trim();
ColumnModel.SightsOrderID = "";
ColumnModel.SightsCostPrice = mlist[i].Tsc_CostPrice.ToString().Trim();
ColumnModel.SightsRemark = mlist[i].Tsc_Remark;
lvItem.Tag = ColumnModel;
lvItem.Text = mlist[i].Tsc_Name.Trim();
ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "景点价格";
ListSubItem.Text = mlist[i].Tsc_SalesPrice.ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "来源";
ListSubItem.Text = "";
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "景点类别";
ListSubItem.Text = mlist[i].Tcs_Category == 0 ? "内景" : "外景";
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "拍摄级别";
DataRow dtRow = tbl.Rows.Find(mlist[i].Tsc_Rating.Trim());
if (dtRow == null)
{ ListSubItem.Text = ""; }
else
{ ListSubItem.Text = dtRow["Sc_ClassName"].ToString().Trim(); }
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "服装套数";
ListSubItem.Text = "1";
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "预拍时间";
ListSubItem.Text = "";
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "备注";
ListSubItem.Text = "";
lvItem.SubItems.Add(ListSubItem);
if ((this.listViewData_Sights.Items.Count % 2) > 0)
{ lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
else
{ lvItem.BackColor = System.Drawing.Color.PowderBlue; }
this.listViewData_Sights.Items.Add(lvItem);
}
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{ this.listViewData_Sights.Items[i].Selected = false; }
this.listViewData_Sights.Items[this.listViewData_Sights.Items.Count - 1].Selected = true;
this.listViewData_Sights.Focus();
}
///
/// 加载时订单拍摄景点数据
///
///
public void SetOrderSightsValue(string StrNumber, string StrSeriesName)
{
this.btnReplace.Visible = true;
if(bUpgrade)
{
this.DeleteSightByNotAction();
}
else
{
this.listViewData_Sights.Items.Clear();
}
if (!string.IsNullOrEmpty(StrSeriesName))
{ this.IsClickToolbox = true; }
string StrTableName = "(SELECT Ordpg_Number,Ordpg_ViceNumber,tb_ErpOrdersPhotography.ID,Ordpg_Sights,Ordpg_ApparelQuantity,Ordpg_SightsLevel,Sc_ClassName,Ordpg_SightsType,Ordpg_OpenOrderRemark,Ordpg_OpenOrderSource," +
"case when Ordpg_SightsType = '0' then '内景' else '外景' end AS Ordpg_SightsTypeText,case when Ordpg_CostPrice is not null then Ordpg_CostPrice else Tsc_CostPrice end as Ordpg_CostPrice,Ordpg_SalesPrice," +
"case when Ordpg_SightsRemark is not null then Ordpg_SightsRemark else Tsc_Remark end AS Ordpg_SightsRemark,Ordpg_ReservationPhotographyTime FROM tb_ErpOrdersPhotography Left Join tb_ErpTheScenery on Tsc_Name = Ordpg_Sights And Tsc_Type = '0' " +
"Left Join tb_ErpSystemCategory on Sc_ClassCode = Ordpg_SightsLevel) AS tb";
DataTable tbl = orbll.GetView_Custom(StrTableName, StrWhere: "Ordpg_Number = '" + StrNumber + "'", ShowColumnName: "*").Tables[0];
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = null;
for (int i = 0; i < tbl.Rows.Count; i++)
{
ListViewItem lvItem = new ListViewItem();
ColumnModel = new SetCustomControls_SightsColumnHeaderModel();
ColumnModel.SightsLevel = tbl.Rows[i]["Ordpg_SightsLevel"].ToString().Trim();
ColumnModel.SightsType = tbl.Rows[i]["Ordpg_SightsType"].ToString().Trim();
ColumnModel.SightsOrderID = tbl.Rows[i]["ID"].ToString().Trim();
ColumnModel.SightsCostPrice = tbl.Rows[i]["Ordpg_CostPrice"].ToString().Trim();
ColumnModel.SightsRemark = tbl.Rows[i]["Ordpg_SightsRemark"].ToString().Trim();
lvItem.Tag = ColumnModel;
lvItem.Text = tbl.Rows[i]["Ordpg_Sights"].ToString().Trim();
ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "景点价格";
ListSubItem.Text = tbl.Rows[i]["Ordpg_SalesPrice"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "来源";
ListSubItem.Text = tbl.Rows[i]["Ordpg_OpenOrderSource"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "景点类别";
ListSubItem.Text = tbl.Rows[i]["Ordpg_SightsTypeText"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "拍摄级别";
ListSubItem.Text = tbl.Rows[i]["Sc_ClassName"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "服装套数";
ListSubItem.Text = tbl.Rows[i]["Ordpg_ApparelQuantity"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "预拍时间";
if (tbl.Rows[i]["Ordpg_ReservationPhotographyTime"] != null)
{
ListSubItem.Text = tbl.Rows[i]["Ordpg_ReservationPhotographyTime"].ToString().Trim().Split(' ')[0];
}
ListSubItem.Tag = tbl.Rows[i]["Ordpg_ReservationPhotographyTime"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "备注";
ListSubItem.Text = tbl.Rows[i]["Ordpg_OpenOrderRemark"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
if ((this.listViewData_Sights.Items.Count % 2) > 0)
{ lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
else
{ lvItem.BackColor = System.Drawing.Color.PowderBlue; }
this.listViewData_Sights.Items.Add(lvItem);
}
}
///
/// 加载时订单拍摄景点数据
///
///
///
public string SetOrderSightsValue(DataRow[] dtRows, bool IsActivity, LYFZ.EnumPublic.EnumPackagesType PackagesType)
{
string StrDeleteSights = "";
if (PackagesType == EnumPublic.EnumPackagesType.AAAAAAB)
{
if (!bUpgrade)
{
this.listViewData_Sights.Items.Clear();
}
else
{
DeleteSightByNotAction();
}
this.btnReplace.Visible = false;
}
else
{ this.RemovePackageItem(); }
this.IsClickToolbox = true;
LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_SightsColumnHeaderModel ColumnModel = null;
string StrRepeatSightsName = "";
for (int i = 0; i < dtRows.Length; i++)
{
bool IsFind = false;
if (PackagesType == EnumPublic.EnumPackagesType.AAAAACA)
{
for (int j = 0; j < this.listViewData_Sights.Items.Count; j++)
{
if (this.listViewData_Sights.Items[j].Text.Trim() == dtRows[i]["Pgm_ProductName"].ToString().Trim())
{
StrRepeatSightsName += "[" + dtRows[i]["Pgm_ProductName"].ToString().Trim() + "],";
IsFind = true;
break;
}
}
}
if (!IsFind)
{
if (!string.IsNullOrEmpty(dtRows[i]["ID"].ToString().Trim()))
{
if (BindSightExist(dtRows[i]["Pgm_ProductName"].ToString().Trim()))
{
continue;
}
ListViewItem lvItem = new ListViewItem();
ColumnModel = new SetCustomControls_SightsColumnHeaderModel();
ColumnModel.PgmID = dtRows[i]["PgmID"].ToString().Trim();
ColumnModel.SightsLevel = dtRows[i]["Tsc_Rating"].ToString().Trim();
ColumnModel.SightsType = dtRows[i]["Tcs_Category"].ToString().Trim();
ColumnModel.SightsOrderID = "";
ColumnModel.SightsCostPrice = dtRows[i]["Tsc_CostPrice"].ToString().Trim();
ColumnModel.SightsRemark = dtRows[i]["Tsc_Remark"].ToString().Trim();
lvItem.Tag = ColumnModel;
lvItem.Text = dtRows[i]["Pgm_ProductName"].ToString().Trim();
ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "景点价格";
ListSubItem.Text = dtRows[i]["Tsc_SalesPrice"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "来源";
ListSubItem.Text = dtRows[i]["TaoXiNameSource"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "景点类别";
ListSubItem.Text = dtRows[i]["Tcs_CategoryText"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "拍摄级别";
ListSubItem.Text = dtRows[i]["Sc_ClassName"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "服装套数";
ListSubItem.Text = dtRows[i]["Pgm_Quantity"].ToString().Trim();
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "预拍时间";
ListSubItem.Text = "";
lvItem.SubItems.Add(ListSubItem);
ListSubItem = new ListViewItem.ListViewSubItem();
ListSubItem.Name = "备注";
ListSubItem.Text = "";
lvItem.SubItems.Add(ListSubItem);
if ((this.listViewData_Sights.Items.Count % 2) > 0)
{ lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
else
{ lvItem.BackColor = System.Drawing.Color.PowderBlue; }
this.listViewData_Sights.Items.Add(lvItem);
}
else
{ StrDeleteSights += dtRows[i]["Pgm_ProductName"].ToString().Trim() + ","; }
}
}
if (StrDeleteSights.Trim() != "")
{ StrDeleteSights = "有景点已删除,已删除景点为:" + StrDeleteSights.TrimEnd(',') + ";"; }
if (PackagesType == EnumPublic.EnumPackagesType.AAAAAAB)
{ this.GetIsActivity(IsActivity); }
if (!string.IsNullOrEmpty(StrRepeatSightsName))
{ MessageBoxCustom.Show("订单套系景点有包含礼包景点:\r\n" + StrRepeatSightsName.TrimEnd(',')); }
return StrDeleteSights;
}
bool BindSightExist(string sightText)
{
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{
if (this.listViewData_Sights.Items[i].Text.ToLower().Equals(sightText.ToLower()))
{
return true;
}
}
return false;
}
///
/// 移除礼包的项目
///
public void RemovePackageItem()
{
if (this.listViewData_Sights.Items.Count > 0)
{
List listItem = new List();
for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
{
if (!string.IsNullOrEmpty(this.listViewData_Sights.Items[i].SubItems["来源"].Text.Trim()))
{ listItem.Add(this.listViewData_Sights.Items[i]); }
}
for (int i = 0; i < listItem.Count; i++)
{ this.listViewData_Sights.Items.Remove(listItem[i]); }
}
}
///
/// 是否能操作
///
///
void GetIsActivity(bool IsActivity)
{
this.btnSightsAdd.Enabled = !IsActivity;
this.btnSightsDelete.Enabled = !IsActivity;
this.btnSightsSet.Enabled = !IsActivity;
if (IsActivity && LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ChangeActiveContent)
{
this.btnSightsAdd.Enabled = IsActivity;
this.btnSightsDelete.Enabled = IsActivity;
this.btnSightsSet.Enabled = IsActivity;
}
}
}
}