public UserProperties(int id) { InitializeComponent(); initial(); isCreating = false; userId = id; User user = GlobalDb.getUser(id); if (user.id == 0) { MessageBox.Show("未找到此用户"); this.Close(); } textBoxName.Text = user.name; textBoxCellPhone.Text = user.cellPhone; Store store = ShardDb.getStore(user.storeId); if (store.id == 0) { MessageBox.Show("未找到店铺"); this.Close(); } comboBoxStore.SelectedValue = user.storeId; comboBoxCity.SelectedValue = store.cityId; comboBoxRole.SelectedValue = user.roleId; textBoxMemo.Text = user.memo; textBoxMail.Text = user.mail; checkBoxActive.Checked = user.active; buttonDelete.Visible = !isCreating; }
private void loadPics(String wd_id) { listViewImages.Items.Clear(); Data imageData = ShardDb.getImagesByDressId(wd_id); if (!imageData.Success) { this.Close(); return; } ImageList imageList = new ImageList(); images = new Dictionary <int, byte[]>(); foreach (DataRow dataRow in imageData.DataTable.Rows) { images.Add(Convert.ToInt16(dataRow.ItemArray[1]), (byte[])dataRow.ItemArray[2]); if (dataRow.ItemArray[3] != null) { imageList.Images.Add(dataRow.ItemArray[1].ToString(), Image.FromStream(new MemoryStream((byte[])dataRow.ItemArray[3]))); } } imageList.ImageSize = new Size(100, 100); listViewImages.LargeImageList = imageList; for (int j = 0; j < imageList.Images.Count; j++) { ListViewItem item = new ListViewItem(); item.ImageKey = imageList.Images.Keys[j]; this.listViewImages.Items.Add(item); } }
private void dataGridViewOrder_DoubleClick(object sender, EventArgs e) { ThreadStart ts = new ThreadStart(showProcessing); Thread wait = new Thread(ts); wait.Start(); OrderStandard order = new OrderStandard(customer); wait.Abort(); order.ShowDialog(); fillOrderList(); customers = ShardDb.getCustomersById(customer.id); if (!customers.Success) { this.Close(); return; } customer = new Customer(); foreach (DataRow dr in customers.DataTable.Rows) { customer.brideName = dr[0] == null ? "" : dr[0].ToString(); customer.brideContact = dr[1] == null ? "" : dr[1].ToString(); customer.marryDay = dr[2] == null ? "" : dr[2].ToString(); customer.channelId = Convert.ToInt16(dr[3]); customer.reserveDate = dr[4] == null ? "" : dr[4].ToString(); customer.reserveTime = dr[5] == null ? "" : dr[5].ToString(); customer.tryDress = dr[6] == null ? "" : dr[6].ToString(); customer.memo = dr[7] == null ? "" : dr[7].ToString(); customer.scsj_jsg = dr[8] == null ? "" : dr[8].ToString(); customer.scsj_cxsg = dr[9] == null ? "" : dr[9].ToString(); customer.scsj_tz = dr[10] == null ? "" : dr[10].ToString(); customer.scsj_xw = dr[11] == null ? "" : dr[11].ToString(); customer.scsj_xxw = dr[12] == null ? "" : dr[12].ToString(); customer.scsj_yw = dr[13] == null ? "" : dr[13].ToString(); customer.scsj_dqw = dr[14] == null ? "" : dr[14].ToString(); customer.scsj_tw = dr[15] == null ? "" : dr[15].ToString(); customer.scsj_jk = dr[16] == null ? "" : dr[16].ToString(); customer.scsj_jw = dr[17] == null ? "" : dr[17].ToString(); customer.scsj_dbw = dr[18] == null ? "" : dr[18].ToString(); customer.scsj_yddc = dr[19] == null ? "" : dr[19].ToString(); customer.scsj_qyj = dr[20] == null ? "" : dr[20].ToString(); customer.scsj_bpjl = dr[21] == null ? "" : dr[21].ToString(); customer.status = Int16.Parse(dr[22].ToString()); customer.jdgw = dr[23] == null ? "" : dr[23].ToString(); customer.groomName = dr[24] == null ? "" : dr[24].ToString(); customer.groomContact = dr[25] == null ? "" : dr[25].ToString(); customer.wangwangID = dr[26] == null ? "" : dr[26].ToString(); customer.id = Convert.ToInt16(dr[27]); customer.reservetimes = dr[28] == null ? "" : dr[28].ToString(); customer.retailerMemo = dr[29] == null ? "" : dr[29].ToString(); customer.hisreason = dr[30] == null ? "" : dr[30].ToString(); customer.storeId = Convert.ToInt16(dr[31]); customer.accountPayable = dr[32].ToString(); customer.refund = dr[33].ToString(); customer.fine = dr[34].ToString(); customer.partnerName = dr[35] == null ? "" : dr[35].ToString(); } textBoxAccountPayable.Text = customer.accountPayable; }
private void toolStripMenuItemDeletion_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dataGridViewTryOn.SelectedRows) { ShardDb.deleteTryonById(row.Cells["id"].Value.ToString()); } fillTryDressList(); }
private void loadCollisionPeriod(String wd_id) { Data collisionPeriod = ShardDb.getCollisionPeriod(wd_id); if (!collisionPeriod.Success) { this.Close(); return; } dataGridViewOrders.DataSource = collisionPeriod.DataTable; }
private void loadOrders() { Data orders = ShardDb.getOrders(); if (!orders.Success) { this.Close(); return; } dataGridViewOrders.DataSource = orders.DataTable; changeDataGridView(); }
private void cbCity_SelectedIndexChanged(object sender, EventArgs e) { Data stores = ShardDb.getStores(Convert.ToInt16(comboBoxCity.SelectedValue)); if (!stores.Success) { this.Close(); return; } comboBoxStore.DisplayMember = "name"; comboBoxStore.ValueMember = "id"; comboBoxStore.DataSource = stores.DataTable; }
private void StoreSelection_Load(object sender, EventArgs e) { comboBoxCity.DisplayMember = "name"; comboBoxCity.ValueMember = "id"; Data cities = ShardDb.getCities(); if (!cities.Success) { this.Close(); return; } comboBoxCity.DataSource = cities.DataTable; }
private void refreshChannelList() { Data channels = ShardDb.getCustomerChannels(); if (!channels.Success) { this.Close(); return; } comboBoxChannel.DisplayMember = "name"; comboBoxChannel.ValueMember = "id"; comboBoxChannel.DataSource = channels.DataTable; }
private void dataGridViewTryOn_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Sharevariables.WeddingDressID = ""; Form dressProperties = new DressQuery(); if (dressProperties.ShowDialog() == DialogResult.OK) { ShardDb.InsertCustomerTryDressList(customer.id, Sharevariables.WeddingDressID, Sharevariables.WdSize, DateTime.Today.ToShortDateString()); fillTryDressList(); } } }
private void refreshStoreList() { Data store = ShardDb.getStores(Convert.ToInt16(comboBoxCity.SelectedValue)); if (!store.Success) { this.Close(); return; } comboBoxStore.DisplayMember = "name"; comboBoxStore.ValueMember = "id"; comboBoxStore.DataSource = store.DataTable; }
//删除客户 ,管理员操作 private void buttonDelete_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("警告:系统管理员将永久删除该客户信息并将不可恢复,是否确认删除?", "退出", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { if (ShardDb.deleteByCustomerIDInClusterTable(tbCustomerID.Text.Trim())) { MessageBox.Show("客户删除成功!"); Close(); } } }
private void getOrderStatistic() { Data orderStatistic = ShardDb.getOrderAmount(DateTime.Today); if (!orderStatistic.Success) { this.Close(); return; } DataTable dt = orderStatistic.DataTable; labelOrderStatistic.Text = "今日订单金额:" + (dt.Rows[0].ItemArray[0].ToString().Length == 0 ? "0" : dt.Rows[0].ItemArray[0].ToString()) + " 实收金额:" + (dt.Rows[0].ItemArray[1].ToString().Length == 0 ? "0" : dt.Rows[0].ItemArray[1].ToString()); }
private void CMAddCustomer_Load(object sender, EventArgs e) { comboBoxCity.DisplayMember = "name"; comboBoxCity.ValueMember = "id"; Data data = ShardDb.getCities(); if (!data.Success) { this.Close(); return; } comboBoxCity.DataSource = data.DataTable; refreshChannelList(); }
private void buttonOK_Click(object sender, EventArgs e) { String channelName = textBoxChannel.Text.Trim(); if (channelName.Length > 0) { ShardDb.insertChannel(channelName); this.Close(); } else { MessageBox.Show("请输入渠道名称"); textBoxChannel.Focus(); } }
private void search() { if (textBoxDressId.Text.Length > 0) { string wd_id = textBoxDressId.Text.Trim(); Data dressIds = ShardDb.getWeddingDressIds(wd_id); if (!dressIds.Success) { this.Close(); return; } listBoxIds.DisplayMember = "wd_id"; listBoxIds.ValueMember = "wd_id"; listBoxIds.DataSource = dressIds.DataTable; } }
private void buttonSave_Click(object sender, EventArgs e) { if (brideName.Text == "") { MessageBox.Show("请输入新娘姓名!"); return; } if (brideContact.Text == "") { MessageBox.Show("请输入联系方式!"); return; } if (wangwangID.Text.Length == 0) { MessageBox.Show("请输入WangWangId!"); return; } if (((DataRowView)comboBoxChannel.SelectedItem).Row["name"].ToString().Equals("异业合作")) { if (textBoxPartnerName.Text.Trim().Length == 0) { MessageBox.Show("请输入合作企业!"); return; } } Customer customer = new Customer(); customer.brideName = brideName.Text.Trim(); customer.brideContact = brideContact.Text.Trim(); customer.memo = memo.Text.Trim(); customer.wangwangID = wangwangID.Text.Trim(); customer.channelId = Convert.ToInt16(comboBoxChannel.SelectedValue); customer.storeId = Convert.ToInt16(comboBoxStore.SelectedValue); customer.status = 1; customer.partnerName = textBoxPartnerName.Text.Trim(); customer.operatorName = Sharevariables.UserName; bool result = ShardDb.insertCustomer(customer); if (result) { this.Close(); } }
private void buttonOK_Click(object sender, EventArgs e) { Store store = new Store(); store.name = textBoxStoreName.Text.Trim(); store.cityId = cityId; if (store.name.Length > 0) { ShardDb.insertStore(store); this.Close(); } else { MessageBox.Show("请输入店铺名称"); textBoxStoreName.Focus(); } }
private void fillTryDressList() { Data tryOnList = ShardDb.getTryOnListByCustomerId(tbCustomerID.Text); if (!tryOnList.Success) { this.Close(); return; } dataGridViewTryOn.DataSource = tryOnList.DataTable; changeTryOnDataGridViewHeader(); if (tryOnList.DataTable.Rows.Count > 0) { combBoxCity.Enabled = false; comboBoxStore.Enabled = false; } }
private void loadDress(String wd_id) { Data dressProperties = ShardDb.getDressById(wd_id); if (!dressProperties.Success) { this.Close(); return; } dataGridViewDress.DataSource = dressProperties.DataTable; dataGridViewDress.Columns["wd_size"].HeaderText = "尺寸"; dataGridViewDress.Columns["wd_price"].HeaderText = "吊牌价格"; dataGridViewDress.Columns["wd_listing_date"].HeaderText = "上市日期"; dataGridViewDress.Columns["wd_count"].HeaderText = "数量"; dataGridViewDress.Columns["storeId"].Visible = false; dataGridViewDress.Columns["id"].Visible = false; }
private void fillOrderList() { Data orderList = ShardDb.getOrderListByCustomerId(tbCustomerID.Text); if (!orderList.Success) { this.Close(); return; } dataGridViewOrder.DataSource = orderList.DataTable; dataGridViewOrder.Columns["id"].Visible = false; changeOrderDataGridViewHeader(); if (orderList.DataTable.Rows.Count > 0) { combBoxCity.Enabled = false; comboBoxStore.Enabled = false; } }
private void getOrderStatuses() { Data statuses = ShardDb.getOrderStatuses(); if (!statuses.Success) { this.Close(); return; } foreach (DataRow row in statuses.DataTable.Rows) { OrderStatus orderStatus = new OrderStatus(); orderStatus.id = int.Parse(row.ItemArray[0].ToString()); orderStatus.name = row.ItemArray[1].ToString(); orderStatus.userRole = int.Parse(row.ItemArray[2].ToString()); orderStatus.preStatusId = int.Parse(row.ItemArray[3].ToString()); Sharevariables.OrderStatuses.Add(orderStatus.id, orderStatus); } }
private void loadDressDefinition(String wd_id) { Data properties = ShardDb.getDressDefinitionById(wd_id); if (!properties.Success) { this.Close(); return; } DressDefinition wdp = new DressDefinition(); foreach (DataRow dr in properties.DataTable.Rows) { wdp.wd_id = wd_id; wdp.wd_date = dr[0] == null ? "" : dr[0].ToString(); wdp.wd_big_category = dr[1] == null ? "" : dr[1].ToString(); wdp.wd_litter_category = dr[2] == null ? "" : dr[2].ToString(); wdp.wd_factory = dr[3] == null ? "" : dr[3].ToString(); wdp.wd_color = dr[4] == null ? "" : dr[4].ToString(); wdp.attribute = Convert.ToInt32(dr[5]); wdp.memo = dr[6] == null ? "" : dr[6].ToString(); wdp.emergency_period = dr[7] == null ? "" : dr[7].ToString(); wdp.normal_period = dr[8] == null ? "" : dr[8].ToString(); wdp.is_renew = dr[9] == null ? "" : dr[9].ToString(); wdp.settlementPrice = dr[10] == null || dr[10].ToString() == "" ? 0 : decimal.Parse(dr[10].ToString()); } string tmpText = ""; tmpText += "商品编号: " + wdp.wd_id.Trim() + Environment.NewLine; tmpText += "入库日期: " + wdp.wd_date.Trim() + Environment.NewLine; tmpText += "商品大类: " + wdp.wd_big_category.Trim() + Environment.NewLine; tmpText += "商品小类: " + wdp.wd_litter_category.Trim() + Environment.NewLine; tmpText += "厂家: " + wdp.wd_factory.Trim() + Environment.NewLine; tmpText += "颜色: " + wdp.wd_color.Trim() + Environment.NewLine; tmpText += "紧急工期: " + wdp.emergency_period.Trim() + "天" + Environment.NewLine; tmpText += "正常工期: " + wdp.normal_period.Trim() + "天" + Environment.NewLine; tmpText += "是否返单: " + wdp.is_renew.Trim() + Environment.NewLine; tmpText += "备注: " + wdp.memo.Trim() + Environment.NewLine; textBox1.Text = tmpText; }
private void comboBoxStatus_SelectedIndexChanged(object sender, EventArgs e) { Data orders = ShardDb.getOrderByStatus(Convert.ToInt16(comboBoxStatus.SelectedValue)); if (!orders.Success) { this.Close(); return; } //foreach (DataRow row in orders.DataTable.Rows) //{ // if (row.ItemArray[8].ToString() == "1900/1/1") // { // row.ItemArray[8] = ""; // } //} dataGridViewOrders.DataSource = orders.DataTable; changeDataGridView(); }
private void buttonSave_Click(object sender, EventArgs e) { if (validate()) { if (isUpdate) { if (ShardDb.UpdateWeddingDress(dress)) { this.Close(); } } else { if (ShardDb.InsertWeddingDress(dress)) { this.Close(); } } } }
private void refreshDataGridViews() { Data rent = ShardDb.getDressStatistic(dateTimePickerStartDate.Value.ToShortDateString(), dateTimePickerEndDate.Value.ToShortDateString(), "租赁"); if (!rent.Success) { this.Close(); return; } dataGridViewRent.DataSource = rent.DataTable; Data sample = ShardDb.getDressStatistic(dateTimePickerStartDate.Value.ToShortDateString(), dateTimePickerEndDate.Value.ToShortDateString(), "卖样衣"); if (!sample.Success) { this.Close(); return; } dataGridViewSampleDress.DataSource = sample.DataTable; Data standard = ShardDb.getDressStatistic(dateTimePickerStartDate.Value.ToShortDateString(), dateTimePickerEndDate.Value.ToShortDateString(), "标准码"); if (!standard.Success) { this.Close(); return; } dataGridViewStandardDress.DataSource = standard.DataTable; Data specific = ShardDb.getDressStatistic(dateTimePickerStartDate.Value.ToShortDateString(), dateTimePickerEndDate.Value.ToShortDateString(), "量身定制"); if (!specific.Success) { this.Close(); return; } dataGridViewSpecificDress.DataSource = specific.DataTable; changeDataGridViewColumnTitle(dataGridViewRent); changeDataGridViewColumnTitle(dataGridViewSampleDress); changeDataGridViewColumnTitle(dataGridViewStandardDress); changeDataGridViewColumnTitle(dataGridViewSpecificDress); }
private void OrderQuery_Load(object sender, EventArgs e) { if (Sharevariables.EnableWorkFlow) { Data statuses = ShardDb.getOrderStatus(Sharevariables.UserLevel); if (!statuses.Success) { this.Close(); return; } comboBoxStatus.DisplayMember = "name"; comboBoxStatus.ValueMember = "id"; comboBoxStatus.DataSource = statuses.DataTable; comboBoxStatus.SelectedIndex = 0; } else { labelStatus.Visible = false; comboBoxStatus.Visible = false; loadOrders(); } }
private void Statistic_Load(object sender, EventArgs e) { dateTimePickerStartDate.Value = DateTime.Today; dateTimePickerEndDate.Value = DateTime.Today; Data channels = ShardDb.getCustomerChannels(); if (!channels.Success) { this.Close(); return; } DataTable dataTableCustomerChannels = channels.DataTable; comboBoxChannel.DisplayMember = "name"; comboBoxChannel.ValueMember = "id"; DataRow row = dataTableCustomerChannels.NewRow(); row[0] = 0; row[1] = "全部"; dataTableCustomerChannels.Rows.InsertAt(row, 0); comboBoxChannel.DataSource = dataTableCustomerChannels; }
private void refreshListViewDress() { listViewDress.Items.Clear(); string fullPath = treeViewCategory.SelectedNode.FullPath.ToString(); Data dressIds = ShardDb.getDressIdsByCondition(fullPath); if (!dressIds.Success) { this.Close(); return; } if (dressIds.DataTable != null && dressIds.DataTable.Rows.Count > 0) { Data thumbnailData = ShardDb.getThumbnailsByIds(dressIds.DataTable); if (!thumbnailData.Success) { this.Close(); return; } ImageList imageList = new ImageList(); foreach (DataRow row in thumbnailData.DataTable.Rows) { if (row.ItemArray[1] != DBNull.Value) { imageList.Images.Add(row.ItemArray[0].ToString(), Image.FromStream(new MemoryStream((byte[])row.ItemArray[1]))); } } imageList.ImageSize = new Size(100, 100); listViewDress.LargeImageList = imageList; for (int j = 0; j < imageList.Images.Count; j++) { ListViewItem item = new ListViewItem(); item.ImageKey = imageList.Images.Keys[j]; this.listViewDress.Items.Add(item); } } }
private void CMQueryCustormer_Load(object sender, EventArgs e) { Data status = ShardDb.getCustomerStatus(); if (!status.Success) { this.Close(); return; } DataTable customerStatus = status.DataTable; DataRow newRow = customerStatus.NewRow(); newRow["id"] = 0; newRow["name"] = "全部"; customerStatus.Rows.InsertAt(newRow, 0); comboBoxStatus.DataSource = customerStatus; comboBoxStatus.DisplayMember = "name"; comboBoxStatus.ValueMember = "id"; comboBoxStatus.SelectedIndex = 0; checkBoxDate.Enabled = true; checkBoxDate.Checked = false; buttonSearch_Click(sender, e); }