using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace LYFZ.Software.MainBusiness.Dresses.DressEntry
{
public partial class FrmEntry : LYFZ.Software.UI.Dresses.DressEntry.FrmEntry
{
Image imgdelete = null;
public string Type = "";
public string Dsfm_DressNumber = "";
bool bl = false;
public FrmEntry()
{
this.FormClosed += FrmEntry_FormClosed;
}
void FrmEntry_FormClosed(object sender, FormClosedEventArgs e)
{
if (bl)
{
this.DialogResult = DialogResult.OK;
}
}
public void ShowImage(string path)
{
if ((this.picDsfm_PicturePath.Image != null)) //先释放
{
picDsfm_PicturePath.Image.Dispose();
picDsfm_PicturePath.Image = null;
}
if (System.IO.File.Exists(path))
{
Image img = Image.FromFile(path); //加载图片
MemoryStream mstr = new MemoryStream(); //创建新的MemoryStream
img.Save(mstr, ImageFormat.Gif); // 保存这个对象
picDsfm_PicturePath.Image = Image.FromStream(mstr); //显示
img.Dispose();//释放占用
}
}
#region 加载
protected override void FrmEntry_Shown(object sender, EventArgs e)
{
try
{
//获取礼服编号
Random action = new Random();
txtDsfm_DressNumber.Text = "LF" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyyMM") + action.Next(100, 1000) + "1";//获取新编号
BindDsfm_DressType();
GetDsfm_PlacedRegion();
#region 修改
if (Type == "Update")
{
if (!string.IsNullOrEmpty(Dsfm_DressNumber))
{
txtDsfm_DressNumber.Enabled = false;
LYFZ.BLL.BLL_ErpDressFrom DressFromBll = new BLL.BLL_ErpDressFrom();
DataTable dt = DressFromBll.GetList("Dsfm_DressNumber='" + Dsfm_DressNumber + "' ").Tables[0];
if (dt.Rows.Count > 0)
{
txtDsfm_DressNumber.Text = Dsfm_DressNumber;
CtvDsfm_DressType.TagFindText(dt.Rows[0]["Dsfm_DressType"].ToString());
cmbDsfm_PlacedRegion.SelectedValue = dt.Rows[0]["Dsfm_PlacedRegion"].ToString();
txtDsfm_DressName.Text = dt.Rows[0]["Dsfm_DressName"].ToString();
txtDsfm_DressBrand.Text = dt.Rows[0]["Dsfm_DressBrand"].ToString();
txtDsfm_DressSize.Text = dt.Rows[0]["Dsfm_DressSize"].ToString();
txtDsfm_DressQuantity.Text = dt.Rows[0]["Dsfm_DressQuantity"].ToString();
txtDsfm_CostPrice.Text = dt.Rows[0]["Dsfm_CostPrice"].ToString();
txtDsfm_RentPrice.Text = dt.Rows[0]["Dsfm_RentPrice"].ToString();
txtDsfm_SalePrice.Text = dt.Rows[0]["Dsfm_SalePrice"].ToString();
if (dt.Rows[0]["Dsfm_IsEnabled"].ToString() == "1")
{
radDsfm_IsEnabled1.Checked = true;
}
else { radDsfm_IsEnabled2.Checked = true; }
txtDsfm_DressRemark.Text = dt.Rows[0]["Dsfm_DressRemark"].ToString();
ShowImage(BLL.BLL_ErpDressFrom.GetDressFromPath() + "\\" + dt.Rows[0]["Dsfm_PicturePath"]);
}
}
}
#endregion
}
catch (Exception ex)
{
MessageBoxCustom.Show(ex.Message);
}
}
#endregion
#region 设置
protected override void btnDsfm_PlacedRegion_Click(object sender, EventArgs e)
{
try
{
LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet set = new InitialSet.FrmSystemSet();
LYFZ.BLL.BLL_ErpSystemCategory bll = new BLL.BLL_ErpSystemCategory();
DataTable dt = bll.GetList("Sc_ClassCode='BEAJBGADBHCCHEFEI'").Tables[0];
if (dt.Rows.Count > 0)
{
set.TypeName = dt.Rows[0]["Sc_ClassCode"].ToString();
}
set.Version = "Version";
if (set.ShowDialog() == DialogResult.OK)
{
GetDsfm_PlacedRegion();
}
}
catch (Exception ex)
{
MessageBoxCustom.Show(ex.Message);
}
}
protected override void btnDsfm_DressType_Click(object sender, EventArgs e)
{
try
{
LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet set = new InitialSet.FrmSystemSet();
LYFZ.BLL.BLL_ErpSystemCategory bll = new BLL.BLL_ErpSystemCategory();
DataTable dt = bll.GetList("Sc_ClassCode='BEAJBGADDCBAHFFA'").Tables[0];
if (dt.Rows.Count > 0)
{
set.TypeName = dt.Rows[0]["Sc_ClassCode"].ToString();
}
set.Version = "Version";
if (set.ShowDialog() == DialogResult.OK)
{
BindDsfm_DressType();
}
}
catch (Exception ex)
{
MessageBoxCustom.Show(ex.Message);
}
}
#endregion
string PhotoFilePath = "";
#region 上传
protected override void btnUpload_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "图片文件(*.jpg)|*.jpg|图片文件(*.gif)|*.gif|图片文件(*.bmp)|*.bmp|图片文件(*.png)|*.png";
openFileDialog1.FileName = "";
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
PhotoFilePath = openFileDialog1.FileName;
//this.picDsfm_PicturePath.Image = Image.FromFile(PhotoFilePath);
imgdelete = Image.FromFile(PhotoFilePath);
picDsfm_PicturePath.Image = imgdelete;
}
if (Type == "Update")
{
lblUpload.Text = PhotoFilePath;
}
}
#endregion
#region 输入框限制
protected override void txtDsfm_SalePrice_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
{
e.Handled = true; //获取或设置一个值,指示是否处理过System.Windows.Forms.Control.KeyPress事件
}
else if (Char.IsPunctuation(e.KeyChar))
{
if (e.KeyChar == '.')
{
if (((System.Windows.Forms.TextBox)sender).Text.LastIndexOf('.') != -1)
{
e.Handled = true;
}
}
else
{
e.Handled = true;
}
}
}
protected override void txtDsfm_RentPrice_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
{
e.Handled = true; //获取或设置一个值,指示是否处理过System.Windows.Forms.Control.KeyPress事件
}
else if (Char.IsPunctuation(e.KeyChar))
{
if (e.KeyChar == '.')
{
if (((System.Windows.Forms.TextBox)sender).Text.LastIndexOf('.') != -1)
{
e.Handled = true;
}
}
else
{
e.Handled = true;
}
}
}
protected override void txtDsfm_CostPrice_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
{
e.Handled = true; //获取或设置一个值,指示是否处理过System.Windows.Forms.Control.KeyPress事件
}
else if (Char.IsPunctuation(e.KeyChar))
{
if (e.KeyChar == '.')
{
if (((System.Windows.Forms.TextBox)sender).Text.LastIndexOf('.') != -1)
{
e.Handled = true;
}
}
else
{
e.Handled = true;
}
}
}
protected override void txtDsfm_DressQuantity_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
{
e.Handled = true;
}
}
#endregion
#region 关闭
protected override void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
#endregion
#region 清空
protected override void btnClear_Click(object sender, EventArgs e)
{
CtvDsfm_DressType.Text = "";
cmbDsfm_PlacedRegion.Text = "";
Clear();
}
public void Clear()
{
//获取礼服编号
Random action = new Random();
txtDsfm_DressNumber.Text = "LF" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyyMM") + action.Next(100, 1000) + "1";//获取新编号
txtDsfm_DressName.Text = "";
txtDsfm_DressBrand.Text = "";
txtDsfm_DressSize.Text = "";
txtDsfm_DressQuantity.Text = "1";
txtDsfm_CostPrice.Text = "";
txtDsfm_RentPrice.Text = "";
txtDsfm_SalePrice.Text = "";
radDsfm_IsEnabled1.Checked = true;
txtDsfm_DressRemark.Text = "";
PhotoFilePath = "";
picDsfm_PicturePath.Image = null;
}
#endregion
#region 保存
protected override void btnSave_Click(object sender, EventArgs e)
{
try
{
DataTable dt = new DataTable();
LYFZ.BLL.BLL_ErpDressFrom DressBll = new BLL.BLL_ErpDressFrom();
LYFZ.Model.Model_ErpDressFrom model = new Model.Model_ErpDressFrom();
#region 输入框
if (string.IsNullOrEmpty(CtvDsfm_DressType.Text))
{
MessageBoxCustom.Show("礼服类别不能为空!");
return;
}
if (string.IsNullOrEmpty(cmbDsfm_PlacedRegion.Text))
{
MessageBoxCustom.Show("摆放区域不能为空!");
return;
}
if (string.IsNullOrEmpty(txtDsfm_DressName.Text))
{
MessageBoxCustom.Show("礼服名称不能为空!");
return;
}
if (string.IsNullOrEmpty(txtDsfm_DressQuantity.Text))
{
MessageBoxCustom.Show("礼服数量不能为空!");
return;
}
if (Convert.ToInt32(txtDsfm_DressQuantity.Text) > 1)
{
MessageBoxCustom.Show("礼服数量不能大于1!");
return;
}
if (string.IsNullOrEmpty(txtDsfm_CostPrice.Text))
{
MessageBoxCustom.Show("成本价格不能为空!");
return;
}
if (string.IsNullOrEmpty(txtDsfm_RentPrice.Text))
{
MessageBoxCustom.Show("出租价格不能为空!");
return;
}
if (string.IsNullOrEmpty(txtDsfm_SalePrice.Text))
{
MessageBoxCustom.Show("出售价格不能为空!");
return;
}
/* if (picDsfm_PicturePath.Image == null)
{
MessageBoxCustom.Show("礼服图片不能为空!");
return;
}*/
#endregion
#region 增加
if (Type == "Add")
{
#region 保存
#region 判断礼服编号是否存在
if (DressBll.Exists("Dsfm_DressNumber", this.txtDsfm_DressNumber.Text) == true)
{
MessageBoxCustom.Show("礼服编号已经存在!请刷新重新获取!");
return;
}
#endregion
model.Dsfm_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
model.Dsfm_DressNumber = txtDsfm_DressNumber.Text.Trim();
model.Dsfm_DressType = CtvDsfm_DressType.Tag.ToString();
model.Dsfm_DressName = txtDsfm_DressName.Text.Trim();
model.Dsfm_DressBrand = txtDsfm_DressBrand.Text.Trim();
model.Dsfm_DressSize = txtDsfm_DressSize.Text.Trim();
model.Dsfm_DressQuantity = Convert.ToInt32(txtDsfm_DressQuantity.Text.Trim());
model.Dsfm_CostPrice = Convert.ToDecimal(txtDsfm_CostPrice.Text.Trim());
model.Dsfm_RentPrice = Convert.ToDecimal(txtDsfm_RentPrice.Text.Trim());
model.Dsfm_SalePrice = Convert.ToDecimal(txtDsfm_SalePrice.Text.Trim());
if (radDsfm_IsEnabled1.Checked == true)
{
model.Dsfm_IsEnabled = "1";
}
else { model.Dsfm_IsEnabled = "0"; }
model.Dsfm_PlacedRegion = cmbDsfm_PlacedRegion.SelectedValue.ToString();
#region 增加礼服图片
dt = DressBll.GetList("Dsfm_DressNumber='" + model.Dsfm_DressNumber + "'").Tables[0];
if (dt.Rows.Count == 0)
{
if (!string.IsNullOrEmpty(PhotoFilePath))
{
#region 选择图片
//原图
string paths = Path.GetExtension(PhotoFilePath);
string path = txtDsfm_DressName.Text + "(" + model.Dsfm_DressNumber + ")" + paths;
File.Copy(PhotoFilePath, BLL.BLL_ErpDressFrom.GetDressFromPath() + "\\" + path);
model.Dsfm_PicturePath = path;
//缩略图
path = txtDsfm_DressName.Text + "(" + model.Dsfm_DressNumber + ")&Small" + paths;
ImageFunction.ThumbImgae.SaveIamge(LYFZ.ImageFunction.ThumbImgae.Thumbnail(new Bitmap(PhotoFilePath), new Size(100, 100), ImageFunction.ThumbImgae.ThumbMode.W), 98L, BLL.BLL_ErpDressFrom.GetDressFromPathSmall() + "\\" + path);
#endregion
}
else
{
#region 默认图片
//原图
string paths = ".png";//Path.GetExtension(imgPath);
string path = txtDsfm_DressName.Text + "(" + model.Dsfm_DressNumber + ")" + paths;
// File.Copy(imgPath, BLL.BLL_ErpDressFrom.GetDressFromPath() + "\\" + path);
model.Dsfm_PicturePath = path;
//缩略图
// path = txtDsfm_DressName.Text + "(" + model.Dsfm_DressNumber + ")&Small" + paths;
// ImageFunction.ThumbImgae.SaveIamge(LYFZ.ImageFunction.ThumbImgae.Thumbnail(new Bitmap(imgPath), new Size(100, 100), ImageFunction.ThumbImgae.ThumbMode.W), 98L, BLL.BLL_ErpDressFrom.GetDressFromPathSmall() + "\\" + path);
#endregion
}
}
#endregion
model.Dsfm_DressRemark = txtDsfm_DressRemark.Text.Trim();
model.Dsfm_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
model.Dsfm_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
if (DressBll.Add(model) == true)
{
if (picDsfm_PicturePath.Image != null)
picDsfm_PicturePath.Image.Dispose();
MessageBoxCustom.Show("保存成功!");
bl = true;
Clear();
}
else { MessageBoxCustom.Show("保存失败!"); }
return;
#region 数量大于1
//if (Convert.ToInt32(txtDsfm_DressQuantity.Text) > 1)
//{
// int sum = Convert.ToInt32(txtDsfm_DressQuantity.Text);
// for (int i = 0; i < sum; i++)
// {
// model.Dsfm_DressNumber = "LF" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyyMM") + action.Next(100, 1000) + i;//获取新编号
// model.Dsfm_DressType = CtvDsfm_DressType.Tag.ToString();
// model.Dsfm_DressName = txtDsfm_DressName.Text.Trim();
// model.Dsfm_DressBrand = txtDsfm_DressBrand.Text.Trim();
// model.Dsfm_DressSize = txtDsfm_DressSize.Text.Trim();
// model.Dsfm_DressQuantity =1;
// model.Dsfm_CostPrice = Convert.ToDecimal(txtDsfm_CostPrice.Text.Trim());
// model.Dsfm_RentPrice = Convert.ToDecimal(txtDsfm_RentPrice.Text.Trim());
// model.Dsfm_SalePrice = Convert.ToDecimal(txtDsfm_SalePrice.Text.Trim());
// if (radDsfm_IsEnabled1.Checked == true)
// {
// model.Dsfm_IsEnabled = "1";
// }
// else { model.Dsfm_IsEnabled = "0"; }
// model.Dsfm_PlacedRegion = cmbDsfm_PlacedRegion.SelectedValue.ToString();
// #region 增加礼服图片
// dt = DressBll.GetList("Dsfm_DressNumber='" + model.Dsfm_DressNumber + "'").Tables[0];
// if (dt.Rows.Count == 0)
// {
// if (!string.IsNullOrEmpty(PhotoFilePath))
// {
// #region 选择图片
// //原图
// string paths = Path.GetExtension(PhotoFilePath);
// string path = txtDsfm_DressName.Text + "(" + model.Dsfm_DressNumber + ")" + paths;
// File.Copy(PhotoFilePath, BLL.BLL_ErpDressFrom.GetDressFromPath() + "\\" + path);
// model.Dsfm_PicturePath = path;
// //缩略图
// path = txtDsfm_DressName.Text + "(" + model.Dsfm_DressNumber + ")&Small" + paths;
// ImageFunction.ThumbImgae.SaveIamge(LYFZ.ImageFunction.ThumbImgae.Thumbnail(new Bitmap(PhotoFilePath), new Size(100, 100), ImageFunction.ThumbImgae.ThumbMode.W), 98L, BLL.BLL_ErpDressFrom.GetDressFromPathSmall() + "\\" + path);
// #endregion
// }
// else
// {
// #region 默认图片
// //原图
// string paths = ".png"; //Path.GetExtension(imgPath);
// string path = txtDsfm_DressName.Text + "(" + model.Dsfm_DressNumber + ")" + paths;
// // File.Copy(imgPath, BLL.BLL_ErpDressFrom.GetDressFromPath() + "\\" + path);
// model.Dsfm_PicturePath = path;
// //缩略图
// path = txtDsfm_DressName.Text + "(" + model.Dsfm_DressNumber + ")&Small" + paths;
// // ImageFunction.ThumbImgae.SaveIamge(LYFZ.ImageFunction.ThumbImgae.Thumbnail(new Bitmap(imgPath), new Size(100, 100), ImageFunction.ThumbImgae.ThumbMode.W), 98L, BLL.BLL_ErpDressFrom.GetDressFromPathSmall() + "\\" + path);
// #endregion
// }
// }
// #endregion
// model.Dsfm_DressRemark = txtDsfm_DressRemark.Text.Trim();
// model.Dsfm_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
// model.Dsfm_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
// DressBll.Add(model);
// }
// if (picDsfm_PicturePath.Image != null)
// picDsfm_PicturePath.Image.Dispose();
// MessageBoxCustom.Show("保存成功!");
// bl = true;
// Clear();
//}
#endregion
#endregion
}
#endregion
#region 修改
if (Type == "Update")
{
dt = new DataTable();
dt = DressBll.GetList("Dsfm_DressNumber='" + Dsfm_DressNumber + "'").Tables[0];
int Id = Convert.ToInt32(dt.Rows[0]["ID"]);
model = DressBll.GetModel(Id);
model.Dsfm_DressType = CtvDsfm_DressType.Tag.ToString();
model.Dsfm_DressName = txtDsfm_DressName.Text.Trim();
model.Dsfm_DressBrand = txtDsfm_DressBrand.Text.Trim();
model.Dsfm_DressSize = txtDsfm_DressSize.Text.Trim();
model.Dsfm_DressQuantity = Convert.ToInt32(txtDsfm_DressQuantity.Text.Trim());
model.Dsfm_CostPrice = Convert.ToDecimal(txtDsfm_CostPrice.Text.Trim());
model.Dsfm_RentPrice = Convert.ToDecimal(txtDsfm_RentPrice.Text.Trim());
model.Dsfm_SalePrice = Convert.ToDecimal(txtDsfm_SalePrice.Text.Trim());
if (radDsfm_IsEnabled1.Checked == true)
{
model.Dsfm_IsEnabled = "1";
}
else { model.Dsfm_IsEnabled = "0"; }
model.Dsfm_PlacedRegion = cmbDsfm_PlacedRegion.SelectedValue.ToString();
model.Dsfm_DressRemark = txtDsfm_DressRemark.Text.Trim();
model.Dsfm_UpdateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
model.Dsfm_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
#region 修改图片
if (!string.IsNullOrEmpty(lblUpload.Text))
{
string Dsfm_PicturePath = dt.Rows[0]["Dsfm_PicturePath"].ToString();
//删除原图
File.Delete((BLL.BLL_ErpDressFrom.GetDressFromPath() + "\\" + dt.Rows[0]["Dsfm_PicturePath"]));
//删除缩略图
char[] pathst = Path.GetExtension(Dsfm_PicturePath).ToCharArray();
Dsfm_PicturePath = Dsfm_PicturePath.TrimEnd(pathst);
File.Delete(BLL.BLL_ErpDressFrom.GetDressFromPathSmall() + "\\" + Dsfm_PicturePath + "&Small" + Path.GetExtension(dt.Rows[0]["Dsfm_PicturePath"].ToString()));
//增加原图
string paths = Path.GetExtension(lblUpload.Text);
string path = txtDsfm_DressName.Text + "(" + Dsfm_DressNumber + ")" + paths;
File.Copy(lblUpload.Text, BLL.BLL_ErpDressFrom.GetDressFromPath() + "\\" + path);
model.Dsfm_PicturePath = path;
//增加缩略图
path = txtDsfm_DressName.Text + "(" + model.Dsfm_DressNumber + ")&Small" + paths;
ImageFunction.ThumbImgae.SaveIamge(LYFZ.ImageFunction.ThumbImgae.Thumbnail(new Bitmap(PhotoFilePath), new Size(100, 100), ImageFunction.ThumbImgae.ThumbMode.W), 98L, BLL.BLL_ErpDressFrom.GetDressFromPathSmall() + "\\" + path);
}
#endregion
if (DressBll.Update(model) == true)
{
MessageBoxCustom.Show("保存成功!");
bl = true;
this.Close();
}
else { MessageBoxCustom.Show("保存失败!"); }
}
#endregion
}
catch (Exception ex)
{
MessageBoxCustom.Show(ex.Message);
}
}
#endregion
#region 绑定礼服类别
///
/// 绑定礼服类别
///
public void BindDsfm_DressType()
{
CtvDsfm_DressType.TreeView.Nodes.Clear();
#region 绑定二级礼服类别
LYFZ.BLL.BLL_ErpSystemCategory BLLSystemCategory = new BLL.BLL_ErpSystemCategory();
DataTable tbl = BLLSystemCategory.GetList("Sc_ClassParentID='59'").Tables[0];
if (tbl.Rows.Count > 0)
{
TreeNode root = null;
for (int i = 0; i < tbl.Rows.Count; i++)
{
root = new TreeNode();
root.Text = tbl.Rows[i]["Sc_ClassName"].ToString();
root.Tag = tbl.Rows[i]["Sc_ClassCode"].ToString();
this.CreateTreeViewShop(root.Nodes, tbl.Rows[i]["ID"].ToString());
this.CtvDsfm_DressType.TreeView.Nodes.Add(root);
}
}
#endregion
}
private void CreateTreeViewShop(TreeNodeCollection nodes, string ClassCode)
{
if (ClassCode != "")
{
LYFZ.BLL.BLL_ErpSystemCategory BLLSystemCategory = new BLL.BLL_ErpSystemCategory();
DataTable tbl = BLLSystemCategory.GetList("Sc_ClassParentID=" + ClassCode + "").Tables[0];
if (tbl.Rows.Count > 0)
{
TreeNode node;
for (int i = 0; i < tbl.Rows.Count; i++)
{
node = new TreeNode();
node.Text = tbl.Rows[i]["Sc_ClassName"].ToString();
node.Tag = tbl.Rows[i]["Sc_ClassCode"].ToString();
nodes.Add(node);
}
}
}
}
#endregion
#region 绑定摆放区域
///
/// 绑定摆放区域
///
public void GetDsfm_PlacedRegion()
{
DataTable dt = new DataTable();
#region 绑定摆放区域
LYFZ.BLL.BLL_ErpSystemCategory SystemCategorybll = new BLL.BLL_ErpSystemCategory();
DataTable dt2 = new DataTable();
DataRow dr = dt.NewRow();
dt2 = SystemCategorybll.GetList("Sc_ClassCode='BEAJBGADBHCCHEFEI'").Tables[0];
dt = SystemCategorybll.GetList("Sc_ClassParentID=" + dt2.Rows[0]["ID"] + "").Tables[0];
cmbDsfm_PlacedRegion.DataSource = dt;
this.cmbDsfm_PlacedRegion.ValueMember = "Sc_ClassCode";
this.cmbDsfm_PlacedRegion.DisplayMember = "Sc_ClassName";
dr = dt.NewRow();
dr["Sc_ClassCode"] = "-1";
dr["Sc_ClassName"] = "";
dt.Rows.InsertAt(dr, 0);
this.cmbDsfm_PlacedRegion.SelectedIndex = 0;
#endregion
}
#endregion
#region 礼服名称输入限制
protected override void txtDsfm_DressName_TextChanged(object sender, EventArgs e)
{
try
{
string Prod_Name = txtDsfm_DressName.Text;
if (!string.IsNullOrEmpty(Prod_Name))
{
if (Prod_Name.ToUpper().Contains(":") || Prod_Name.ToUpper().Contains("?") || Prod_Name.ToUpper().Contains("\"") || Prod_Name.ToUpper().Contains("<") || Prod_Name.ToUpper().Contains(">") || Prod_Name.ToUpper().Contains("|") || Prod_Name.ToUpper().Contains("\\") || Prod_Name.ToUpper().Contains("/") || Prod_Name.ToUpper().Contains("(") || Prod_Name.ToUpper().Contains(")") || Prod_Name.ToUpper().Contains("&"))
{
MessageBoxCustom.Show("此名称有不合法字符!");
txtDsfm_DressName.Text = "";
return;
}
}
}
catch (Exception ex)
{
MessageBoxCustom.Show(ex.Message);
}
}
#endregion
#region 获取新的礼服编号
protected override void btnRefresh_Click(object sender, EventArgs e)
{
//获取礼服编号
Random action = new Random();
txtDsfm_DressNumber.Text = "LF" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyyMM") + action.Next(100, 1000) + "1";//获取新编号
}
#endregion
}
}