ShopMessageSetFormMain.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. using LYFZ.Software.MainBusiness.DoorCityProcess;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Drawing.Imaging;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Windows.Forms;
  12. namespace LYFZ.Software.MainBusiness.StudioDataSet
  13. {
  14. public partial class ShopMessageSetFormMain : LYFZ.Software.UI.StudioDataSet.ShopMessageSetFormMain
  15. {
  16. public ShopMessageSetFormMain()
  17. {
  18. this.btnDownloadDimCode.Click += btnDownloadDimCode_Click;
  19. this.btnDownloadChildLOG.Click += btnDownloadChildLOG_Click;
  20. this.btnDownloadPortraitLOG.Click += btnDownloadPortraitLOG_Click;
  21. this.btnDownloadWeddingLOG.Click += btnDownloadWeddingLOG_Click;
  22. this.txtPhone.KeyPress += txtPhone_KeyPress;
  23. }
  24. LYFZ.BLL.BLL_ErpCompanyInfo bll = new BLL.BLL_ErpCompanyInfo();
  25. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  26. /// <summary>
  27. /// 影楼ID
  28. /// </summary>
  29. private string StrID = "";
  30. /// <summary>
  31. /// 是否保存
  32. /// </summary>
  33. private bool IsSaveed = false;
  34. private bool IsFirstRun = true;
  35. public delegate void UpdateControl();
  36. string strGetFileName = "ID,Company_DividedShop,Company_Name,Company_Manager,Company_Telephone,Company_Fax,Company_URL,Company_DianQingDate,Company_Address,Company_SingleTitle,Company_SingleExplanation,Company_ReservationExplanation,Company_ChildReserveExplain,Company_PortraitReserveExplain,Company_ProductionNotes,Company_DressDescription,Company_About,Company_PhotoThumbnail,Company_PhotoAlbum,Company_Detail,Company_MicroShareAccount,Company_MicroSharePassword,Company_CreateDatetime,Company_CreateName,Company_UpdateDatetime,Company_UpdateName";
  37. /// <summary>
  38. /// 窗体加载事件
  39. /// </summary>
  40. /// <param name="sender"></param>
  41. /// <param name="e"></param>
  42. protected override void ShopMessageSetFormMain_Load(object sender, EventArgs e)
  43. {
  44. this.tabPage2.Parent = null;
  45. this.tbPage1.Parent = null;
  46. this.tbPage2.Parent = null;
  47. this.tbPage3.Parent = null;
  48. if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() == EnumPermissions.BusinessType.婚纱版)
  49. { this.tbPage1.Parent = this.tabControl2; }
  50. else if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() == EnumPermissions.BusinessType.儿童版)
  51. { this.tbPage2.Parent = this.tabControl2; }
  52. else if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() == EnumPermissions.BusinessType.旗舰版)
  53. {
  54. this.tbPage1.Parent = this.tabControl2;
  55. this.tbPage2.Parent = this.tabControl2;
  56. }
  57. if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition)
  58. { this.tbPage3.Parent = this.tabControl2; }
  59. string CompanyNameID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetCompanyInfoID();
  60. this.GetPhoto(CompanyNameID);
  61. DataTable tbl = orbll.GetView_Custom("tb_ErpCompanyInfo", ShowColumnName: strGetFileName).Tables[0];
  62. if (tbl.Rows.Count <= 1)
  63. { this.panelEx2.Visible = false; }
  64. for (int i = 0; i < tbl.Rows.Count; i++)
  65. {
  66. this.cmbStoreName.Items.Add(new ListItem(tbl.Rows[i]["Company_Name"].ToString().Trim(), tbl.Rows[i]["Company_DividedShop"].ToString().Trim()));
  67. if (tbl.Rows[i]["Company_DividedShop"].ToString().Trim() == CompanyNameID.Trim())
  68. { this.cmbStoreName.SelectedIndex = i; }
  69. }
  70. DataRow[] dtRow = tbl.Select("Company_DividedShop = '" + CompanyNameID + "'");
  71. if (dtRow.Length > 0)
  72. {
  73. this.txtStoreName.Text = dtRow[0]["Company_Name"].ToString().Trim();
  74. this.txtPhone.Text = dtRow[0]["Company_Telephone"].ToString().Trim();
  75. this.txtMicroShareAccount.Text = dtRow[0]["Company_MicroShareAccount"].ToString().Trim();
  76. this.txtMicroSharePassword.Text = dtRow[0]["Company_MicroSharePassword"].ToString().Trim();
  77. this.txtAddress.Text = dtRow[0]["Company_Address"].ToString().Trim();
  78. this.txtURL.Text = dtRow[0]["Company_URL"].ToString().Trim();
  79. this.txtStoreManager.Text = dtRow[0]["Company_Manager"].ToString().Trim();
  80. if (!string.IsNullOrEmpty(dtRow[0]["Company_DianQingDate"].ToString()))
  81. { this.dtpDianQingDate.DateValue = dtRow[0]["Company_DianQingDate"].ToString().Trim(); }
  82. this.StrID = dtRow[0]["ID"].ToString().Trim();
  83. if (dtRow[0]["Company_SingleTitle"].ToString().Trim() != "∝")
  84. {
  85. this.tabPage2.Parent = this.tabControl;
  86. this.txtIncomeMoneyTitle.Text = dtRow[0]["Company_SingleTitle"].ToString().Trim();
  87. this.txtIncomeMoneyExplain.Text = dtRow[0]["Company_SingleExplanation"].ToString().Trim();
  88. if (this.tabControl2.TabPages["tbPage1"] != null)
  89. { this.txtWeddingReserveExplain.Text = dtRow[0]["Company_ReservationExplanation"].ToString().Trim(); }
  90. if (this.tabControl2.TabPages["tbPage2"] != null)
  91. {
  92. if (dtRow[0]["Company_ChildReserveExplain"].ToString().Trim() != "")
  93. { this.txtChildReserveExplain.Text = dtRow[0]["Company_ChildReserveExplain"].ToString().Trim(); }
  94. else
  95. { this.txtChildReserveExplain.Text = dtRow[0]["Company_ReservationExplanation"].ToString().Trim(); }
  96. }
  97. if (this.tabControl2.TabPages["tbPage3"] != null)
  98. {
  99. if (dtRow[0]["Company_PortraitReserveExplain"].ToString().Trim() != "")
  100. { this.txtPortraitReserveExplain.Text = dtRow[0]["Company_PortraitReserveExplain"].ToString().Trim(); }
  101. else
  102. {
  103. if (dtRow[0]["Company_ReservationExplanation"].ToString().Trim() != "")
  104. { this.txtPortraitReserveExplain.Text = dtRow[0]["Company_ReservationExplanation"].ToString().Trim(); }
  105. else
  106. { this.txtPortraitReserveExplain.Text = dtRow[0]["Company_ChildReserveExplain"].ToString().Trim(); }
  107. }
  108. }
  109. this.txtMakingExplain.Text = dtRow[0]["Company_ProductionNotes"].ToString().Trim();
  110. this.txtDressExplain.Text = dtRow[0]["Company_DressDescription"].ToString().Trim();
  111. }
  112. }
  113. #region 权限
  114. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PhotoStudioInfo, LYFZ.CustomAttributes.OperatingAuthority.Setting))
  115. { this.btnSave.Enabled = false; }
  116. #endregion
  117. this.IsFirstRun = false;
  118. //this.tabPage2.Parent = null;
  119. }
  120. /// <summary>
  121. /// 获取影楼预约单Log图片
  122. /// </summary>
  123. /// <param name="ShopName"></param>
  124. private void GetPhoto(string ShopName)
  125. {
  126. this.cmbStoreName.Enabled = false;
  127. System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
  128. {
  129. DataTable tblPhoto = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: "Company_DividedShop = '" + ShopName + "'", ShowColumnName: "Company_DimensionalCode,Company_WeddingSingleLOG,Company_ChildSingleLOG,Company_PortraitLOG").Tables[0];
  130. try
  131. {
  132. this.Invoke(new UpdateControl(delegate()
  133. {
  134. if (tblPhoto.Rows.Count > 0)
  135. {
  136. if (!string.IsNullOrEmpty(tblPhoto.Rows[0]["Company_DimensionalCode"].ToString()))
  137. { this.pictDimCode.Image = PublicCodeClasses.GetImage(PublicCodeClasses.StringToByte(tblPhoto.Rows[0]["Company_DimensionalCode"].ToString())); }
  138. if (!string.IsNullOrEmpty(tblPhoto.Rows[0]["Company_WeddingSingleLOG"].ToString()))
  139. { this.pictWeddingLOG.Image = PublicCodeClasses.GetImage(PublicCodeClasses.StringToByte(tblPhoto.Rows[0]["Company_WeddingSingleLOG"].ToString())); }
  140. if (!string.IsNullOrEmpty(tblPhoto.Rows[0]["Company_ChildSingleLOG"].ToString()))
  141. { this.pictChildLOG.Image = PublicCodeClasses.GetImage(PublicCodeClasses.StringToByte(tblPhoto.Rows[0]["Company_ChildSingleLOG"].ToString())); }
  142. if (!string.IsNullOrEmpty(tblPhoto.Rows[0]["Company_PortraitLOG"].ToString()))
  143. { this.pictPortraitLOG.Image = PublicCodeClasses.GetImage(PublicCodeClasses.StringToByte(tblPhoto.Rows[0]["Company_PortraitLOG"].ToString())); }
  144. }
  145. }));
  146. }
  147. catch { }
  148. try
  149. {
  150. this.Invoke(new UpdateControl(delegate()
  151. { this.cmbStoreName.Enabled = true; }));
  152. }
  153. catch { }
  154. }));
  155. t.Start();
  156. }
  157. /// <summary>
  158. /// 二维码上传事件
  159. /// </summary>
  160. /// <param name="sender"></param>
  161. /// <param name="e"></param>
  162. protected override void btnDimCodeUpdate_Click(object sender, EventArgs e)
  163. {
  164. openFileDialog1.ShowDialog(this);
  165. if (openFileDialog1.FileName.Length > 0)
  166. {
  167. if (openFileDialog1.FileName != "openFileDialog1")
  168. {
  169. FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
  170. pictDimCode.Image = System.Drawing.Image.FromStream(fs);
  171. fs.Close();
  172. }
  173. }
  174. }
  175. /// <summary>
  176. /// 删除二维码图片
  177. /// </summary>
  178. /// <param name="sender"></param>
  179. /// <param name="e"></param>
  180. protected override void btnCodeDelete_Click(object sender, EventArgs e)
  181. { this.pictDimCode.Image = null; }
  182. /// <summary>
  183. /// 婚纱预约单LOG上传事件
  184. /// </summary>
  185. /// <param name="sender"></param>
  186. /// <param name="e"></param>
  187. protected override void btnWeddingSelectLOG_Click(object sender, EventArgs e)
  188. { this.SeleteLog(pictWeddingLOG); }
  189. /// <summary>
  190. /// 婚纱预约单LOG删除
  191. /// </summary>
  192. /// <param name="sender"></param>
  193. /// <param name="e"></param>
  194. protected override void btnWeddingDelete_Click(object sender, EventArgs e)
  195. { this.pictWeddingLOG.Image = null; }
  196. /// <summary>
  197. /// 儿童预约单LOG上传事件
  198. /// </summary>
  199. /// <param name="sender"></param>
  200. /// <param name="e"></param>
  201. protected override void btnChildSelectLOG_Click(object sender, EventArgs e)
  202. { this.SeleteLog(this.pictChildLOG); }
  203. private void SeleteLog(LYFZ.ComponentLibrary.PictureBoxEx pict)
  204. {
  205. openFileDialog1.ShowDialog(this);
  206. if (openFileDialog1.FileName.Length > 0)
  207. {
  208. if (openFileDialog1.FileName != "openFileDialog1")
  209. {
  210. Image img = Image.FromFile(openFileDialog1.FileName);
  211. FileInfo f = new FileInfo(openFileDialog1.FileName);
  212. if (f.Length > 2100000)
  213. { MessageBoxCustom.Show("图片过大,建议使用大小在800K以内的图片"); return; }
  214. if (img.Width > 2500)
  215. { MessageBoxCustom.Show("图片长度过长,建议使用大小在 2000*280(像素)以内的图片"); return; }
  216. if (img.Height > 300)
  217. { MessageBoxCustom.Show("图片过大,建议使用大小在 2000*280(像素)以内的图片"); return; }
  218. FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
  219. pict.Image = System.Drawing.Image.FromStream(fs);
  220. fs.Close();
  221. }
  222. }
  223. }
  224. /// <summary>
  225. /// 儿童预约单LOG删除
  226. /// </summary>
  227. /// <param name="sender"></param>
  228. /// <param name="e"></param>
  229. protected override void btnChildDelete_Click(object sender, EventArgs e)
  230. { this.pictChildLOG.Image = null; }
  231. /// <summary>
  232. /// 写真预约单LOG删除
  233. /// </summary>
  234. /// <param name="sender"></param>
  235. /// <param name="e"></param>
  236. protected override void btnPortraitSelectLOG_Click(object sender, EventArgs e)
  237. { this.SeleteLog(this.pictPortraitLOG); }
  238. /// <summary>
  239. /// 写真预约单LOG删除
  240. /// </summary>
  241. /// <param name="sender"></param>
  242. /// <param name="e"></param>
  243. protected override void btnPortraitDelete_Click(object sender, EventArgs e)
  244. { this.pictPortraitLOG.Image = null; }
  245. /// <summary>
  246. /// 保存
  247. /// </summary>
  248. /// <param name="sender"></param>
  249. /// <param name="e"></param>
  250. protected override void btnSave_Click(object sender, EventArgs e)
  251. {
  252. if (this.dtpDianQingDate.DateValue.Trim() == "")
  253. { MessageBoxCustom.Show("店庆日期不能为空!"); return; }
  254. if (this.txtAddress.Text.Trim().Length > 200)
  255. { MessageBoxCustom.Show("地址字数不得超过200字(含符号),当前字数" + this.txtAddress.Text.Trim().Length); return; }
  256. if (this.txtDressExplain.Text.Trim().Length > 2000)
  257. { MessageBoxCustom.Show("礼服单说明字数不得超过2000字(含符号),当前字数" + this.txtDressExplain.Text.Trim().Length); return; }
  258. if (this.txtIncomeMoneyExplain.Text.Trim().Length > 2000)
  259. { MessageBoxCustom.Show("收款单说明字数不得超过2000字(含符号),当前字数" + this.txtIncomeMoneyExplain.Text.Trim().Length); return; }
  260. if (this.txtIncomeMoneyTitle.Text.Trim().Length > 500)
  261. { MessageBoxCustom.Show("收款单标题字数不得超过500字(含符号),当前字数" + this.txtIncomeMoneyTitle.Text.Trim().Length); return; }
  262. if (this.txtMakingExplain.Text.Trim().Length > 2000)
  263. { MessageBoxCustom.Show("制作单说明字数不得超过2000字(含符号),当前字数" + this.txtMakingExplain.Text.Trim().Length); return; }
  264. if (this.txtWeddingReserveExplain.Text.Trim().Length > 2000)
  265. { MessageBoxCustom.Show("预约单说明字数不得超过2000字(含符号),当前字数" + this.txtWeddingReserveExplain.Text.Trim().Length); return; }
  266. if (this.txtStoreManager.Text.Trim().Length > 20)
  267. { MessageBoxCustom.Show("店长字数不得超过20字(含符号),当前字数" + this.txtStoreManager.Text.Trim().Length); return; }
  268. if (this.txtStoreName.Text.Trim().Length > 100)
  269. { MessageBoxCustom.Show("店名字数不得超过100字(含符号),当前字数" + this.txtStoreName.Text.Trim().Length); return; }
  270. if (this.txtURL.Text.Trim().Length > 200)
  271. { MessageBoxCustom.Show("网址字数不得超过200字(含符号),当前字数" + this.txtURL.Text.Trim().Length); return; }
  272. if (this.txtMicroShareAccount.Text.Trim().Length > 200)
  273. { MessageBoxCustom.Show("微分享帐号字数不得超过200字(含符号),当前字数" + this.txtURL.Text.Trim().Length); return; }
  274. if (this.txtMicroSharePassword.Text.Trim().Length > 200)
  275. { MessageBoxCustom.Show("微分享密码字数不得超过200字(含符号),当前字数" + this.txtURL.Text.Trim().Length); return; }
  276. DateTime StrTime = SDateTime.Now;
  277. if (this.StrID != "")
  278. {
  279. if (MessageBoxCustom.Show("保存后将覆盖原来的数据,你确定要保存吗?", "温馨提示", MessageBoxButtons.YesNo) != DialogResult.Yes)
  280. { return; }
  281. LYFZ.Model.Model_ErpCompanyInfo model = (LYFZ.Model.Model_ErpCompanyInfo)bll.GetModelObject("ID", StrID);
  282. model.Company_Name = this.txtStoreName.Text.Trim();
  283. model.Company_Telephone = this.txtPhone.Text.Trim();
  284. model.Company_Address = this.txtAddress.Text.Trim();
  285. model.Company_URL = this.txtURL.Text.Trim();
  286. model.Company_Manager = this.txtStoreManager.Text.Trim();
  287. model.Company_SingleTitle = this.txtIncomeMoneyTitle.Text.Trim();
  288. model.Company_SingleExplanation = this.txtIncomeMoneyExplain.Text.Trim();
  289. if (this.tabControl2.TabPages["tbPage1"] != null)
  290. { model.Company_ReservationExplanation = this.txtWeddingReserveExplain.Text.Trim(); }
  291. if (this.tabControl2.TabPages["tbPage2"] != null)
  292. { model.Company_ChildReserveExplain = this.txtChildReserveExplain.Text.Trim(); }
  293. if (this.tabControl2.TabPages["tbPage3"] != null)
  294. { model.Company_PortraitReserveExplain = this.txtPortraitReserveExplain.Text.Trim(); }
  295. model.Company_ProductionNotes = this.txtMakingExplain.Text.Trim();
  296. model.Company_DressDescription = this.txtDressExplain.Text.Trim();
  297. model.Company_MicroShareAccount = this.txtMicroShareAccount.Text.Trim();
  298. model.Company_MicroSharePassword = this.txtMicroSharePassword.Text.Trim();
  299. if (this.pictDimCode.Image != null)
  300. { model.Company_DimensionalCode = PublicCodeClasses.ToHexString(PublicCodeClasses.ImageDatabytes(this.pictDimCode)); }
  301. else
  302. { model.Company_DimensionalCode = ""; }
  303. if (this.pictWeddingLOG.Image != null)
  304. { model.Company_WeddingSingleLOG = PublicCodeClasses.ToHexString(PublicCodeClasses.ImageDatabytes(this.pictWeddingLOG)); }
  305. else
  306. { model.Company_WeddingSingleLOG = ""; }
  307. if (this.pictChildLOG.Image != null)
  308. { model.Company_ChildSingleLOG = PublicCodeClasses.ToHexString(PublicCodeClasses.ImageDatabytes(this.pictChildLOG)); }
  309. else
  310. { model.Company_ChildSingleLOG = ""; }
  311. if (this.pictPortraitLOG.Image != null)
  312. { model.Company_PortraitLOG = PublicCodeClasses.ToHexString(PublicCodeClasses.ImageDatabytes(this.pictPortraitLOG)); }
  313. else
  314. { model.Company_PortraitLOG = ""; }
  315. model.Company_DianQingDate = Convert.ToDateTime(this.dtpDianQingDate.DateValue);
  316. model.Company_UpdateDatetime = StrTime;
  317. if (!bll.Update(model))
  318. { MessageBoxCustom.Show("保存失败"); return; }
  319. }
  320. else
  321. {
  322. LYFZ.Model.Model_ErpCompanyInfo model = new Model.Model_ErpCompanyInfo();
  323. model.Company_DividedShop = ((ListItem)this.cmbStoreName.SelectedItem).StrValue.ToString();
  324. model.Company_Name = this.txtStoreName.Text.Trim();
  325. model.Company_Manager = this.txtStoreManager.Text.Trim();
  326. model.Company_Telephone = this.txtPhone.Text.Trim();
  327. model.Company_URL = this.txtURL.Text.Trim();
  328. model.Company_Address = this.txtAddress.Text.Trim();
  329. model.Company_SingleTitle = this.txtIncomeMoneyTitle.Text.Trim();
  330. model.Company_SingleExplanation = this.txtIncomeMoneyExplain.Text.Trim();
  331. if (this.tabControl2.TabPages["tbPage1"] != null)
  332. { model.Company_ReservationExplanation = this.txtWeddingReserveExplain.Text.Trim(); }
  333. else
  334. { model.Company_ReservationExplanation = ""; }
  335. if (this.tabControl2.TabPages["tbPage2"] != null)
  336. { model.Company_ChildReserveExplain = this.txtChildReserveExplain.Text.Trim(); }
  337. else
  338. { model.Company_ChildReserveExplain = ""; }
  339. if (this.tabControl2.TabPages["tbPage3"] != null)
  340. { model.Company_PortraitReserveExplain = this.txtPortraitReserveExplain.Text.Trim(); }
  341. else
  342. { model.Company_PortraitReserveExplain = ""; }
  343. model.Company_ProductionNotes = this.txtMakingExplain.Text.Trim();
  344. model.Company_DressDescription = this.txtDressExplain.Text.Trim();
  345. model.Company_MicroShareAccount = this.txtMicroShareAccount.Text.Trim();
  346. model.Company_MicroSharePassword = this.txtMicroSharePassword.Text.Trim();
  347. if (this.pictDimCode.Image != null)
  348. { model.Company_DimensionalCode = PublicCodeClasses.ToHexString(PublicCodeClasses.ImageDatabytes(this.pictDimCode)); }
  349. else
  350. { model.Company_DimensionalCode = ""; }
  351. if (this.pictWeddingLOG.Image != null)
  352. { model.Company_WeddingSingleLOG = PublicCodeClasses.ToHexString(PublicCodeClasses.ImageDatabytes(this.pictWeddingLOG)); }
  353. else
  354. { model.Company_WeddingSingleLOG = ""; }
  355. if (this.pictChildLOG.Image != null)
  356. { model.Company_ChildSingleLOG = PublicCodeClasses.ToHexString(PublicCodeClasses.ImageDatabytes(this.pictChildLOG)); }
  357. else
  358. { model.Company_ChildSingleLOG = ""; }
  359. if (this.pictPortraitLOG.Image != null)
  360. { model.Company_PortraitLOG = PublicCodeClasses.ToHexString(PublicCodeClasses.ImageDatabytes(this.pictPortraitLOG)); }
  361. else
  362. { model.Company_PortraitLOG = ""; }
  363. model.Company_DianQingDate = Convert.ToDateTime(this.dtpDianQingDate.DateValue);
  364. model.Company_CreateDatetime = StrTime;
  365. if (!bll.Add(model))
  366. { MessageBoxCustom.Show("保存失败"); return; }
  367. }
  368. this.IsSaveed = true;
  369. MessageBoxCustom.Show("保存成功");
  370. }
  371. /// <summary>
  372. /// 取消
  373. /// </summary>
  374. /// <param name="sender"></param>
  375. /// <param name="e"></param>
  376. protected override void btnCancel_Click(object sender, EventArgs e)
  377. { this.Close(); }
  378. /// <summary>
  379. /// 影楼店名
  380. /// </summary>
  381. /// <param name="sender"></param>
  382. /// <param name="e"></param>
  383. protected override void cmbStoreName_TextChanged(object sender, EventArgs e)
  384. {
  385. if (!IsFirstRun)
  386. {
  387. DataTable tbl = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: "Company_DividedShop = '" + ((ListItem)this.cmbStoreName.SelectedItem).StrValue + "'", ShowColumnName: strGetFileName).Tables[0];
  388. if (tbl.Rows.Count > 0)
  389. {
  390. this.txtStoreName.Text = tbl.Rows[0]["Company_Name"].ToString().Trim();
  391. this.txtPhone.Text = tbl.Rows[0]["Company_Telephone"].ToString().Trim();
  392. this.txtAddress.Text = tbl.Rows[0]["Company_Address"].ToString().Trim();
  393. this.txtURL.Text = tbl.Rows[0]["Company_URL"].ToString().Trim();
  394. this.txtStoreManager.Text = tbl.Rows[0]["Company_Manager"].ToString().Trim();
  395. this.txtIncomeMoneyTitle.Text = tbl.Rows[0]["Company_SingleTitle"].ToString().Trim();
  396. this.txtIncomeMoneyExplain.Text = tbl.Rows[0]["Company_SingleExplanation"].ToString().Trim();
  397. this.txtWeddingReserveExplain.Text = tbl.Rows[0]["Company_ReservationExplanation"].ToString().Trim();
  398. this.txtChildReserveExplain.Text = tbl.Rows[0]["Company_ChildReserveExplain"].ToString().Trim();
  399. this.txtPortraitReserveExplain.Text = tbl.Rows[0]["Company_PortraitReserveExplain"].ToString().Trim();
  400. this.txtMakingExplain.Text = tbl.Rows[0]["Company_ProductionNotes"].ToString().Trim();
  401. this.txtDressExplain.Text = tbl.Rows[0]["Company_DressDescription"].ToString().Trim();
  402. this.StrID = tbl.Rows[0]["ID"].ToString().Trim();
  403. }
  404. this.GetPhoto(((ListItem)this.cmbStoreName.SelectedItem).StrValue.ToString());
  405. }
  406. }
  407. /// <summary>
  408. /// 关闭窗体之后发生
  409. /// </summary>
  410. /// <param name="sender"></param>
  411. /// <param name="e"></param>
  412. protected override void ShopMessageSetFormMain_FormClosing(object sender, FormClosingEventArgs e)
  413. {
  414. if (!this.IsSaveed)
  415. {
  416. if (MessageBoxCustom.Show("你确定要关闭吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  417. { e.Cancel = true; }
  418. }
  419. }
  420. /// <summary>
  421. /// 窗体大小变化事件
  422. /// </summary>
  423. /// <param name="sender"></param>
  424. /// <param name="e"></param>
  425. protected override void ShopMessageSetFormMain_Resize(object sender, EventArgs e)
  426. {
  427. //if (this.WindowState == FormWindowState.Maximized)
  428. //{ this.tabControl.Size = new Size(this.Width - 15, this.Height - 75); }
  429. //else
  430. //{ this.tabControl.Size = new Size(this.Width - 27, 700); }
  431. }
  432. /// <summary>
  433. /// 二维码下载
  434. /// </summary>
  435. /// <param name="sender"></param>
  436. /// <param name="e"></param>
  437. void btnDownloadDimCode_Click(object sender, EventArgs e)
  438. { this.DownloadLog(this.pictDimCode, this.lblDimCode); }
  439. /// <summary>
  440. /// 儿童LOG下载
  441. /// </summary>
  442. /// <param name="sender"></param>
  443. /// <param name="e"></param>
  444. void btnDownloadChildLOG_Click(object sender, EventArgs e)
  445. { this.DownloadLog(this.pictChildLOG, this.lblChildLOG); }
  446. /// <summary>
  447. /// 写真LOG下载
  448. /// </summary>
  449. /// <param name="sender"></param>
  450. /// <param name="e"></param>
  451. void btnDownloadPortraitLOG_Click(object sender, EventArgs e)
  452. { this.DownloadLog(this.pictPortraitLOG, this.lblPortraitLOG); }
  453. /// <summary>
  454. /// 婚纱LOG下载
  455. /// </summary>
  456. /// <param name="sender"></param>
  457. /// <param name="e"></param>
  458. void btnDownloadWeddingLOG_Click(object sender, EventArgs e)
  459. { this.DownloadLog(this.pictWeddingLOG, this.lblWeddingLOG); }
  460. /// <summary>
  461. /// 下载图片
  462. /// </summary>
  463. /// <param name="pict"></param>
  464. private void DownloadLog(LYFZ.ComponentLibrary.PictureBoxEx pict, Label lblName)
  465. {
  466. if (pict.Image != null)
  467. {
  468. string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  469. Bitmap bmp = new Bitmap(pict.Image);
  470. bmp.Save(dir + "\\" + lblName.Text + ".jpg");
  471. MessageBoxCustom.Show("下载成功!\r\n下载储存于桌面");
  472. }
  473. else
  474. { MessageBoxCustom.Show("图片未上传!"); }
  475. }
  476. /// <summary>
  477. /// 电话号码限制输入
  478. /// </summary>
  479. /// <param name="sender"></param>
  480. /// <param name="e"></param>
  481. void txtPhone_KeyPress(object sender, KeyPressEventArgs e)
  482. {
  483. //if (this.txtPhone.Text.Trim().Length > 12)
  484. //{
  485. // if (Convert.ToInt32(e.KeyChar) == 8)
  486. // { }
  487. // else
  488. // { e.Handled = true; }
  489. //}
  490. if (Convert.ToString(e.KeyChar) == "-")
  491. {
  492. //if (this.txtPhone.Text.Trim().IndexOf('-') != -1)
  493. //{ e.Handled = true; }
  494. }
  495. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  496. { e.Handled = true; }
  497. }
  498. }
  499. }