Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            M_ImportPlan m_ImportPlan = new M_ImportPlan();
            int          count        = Convert.ToInt16(dataGridView1.Rows.Count.ToString());

            for (int i = 0; i < count; i++)
            {
                DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)dataGridView1.Rows[i].Cells[0];
                Boolean flag = Convert.ToBoolean(checkCell.Value);
                if (flag == true)     //查找被选择的数据行
                {
                    m_ImportPlan.id += dataGridView1.Rows[i].Cells["id"].Value.ToString() + ",";
                }
                else
                {
                    continue;
                }
            }
            if (string.IsNullOrEmpty(m_ImportPlan.id))
            {
                ToastNotification.CustomGlowColor = Color.FromArgb(48, 32, 22);
                ToastNotification.Show(this, "请勾选要删除的数据", BLL.B_GetMethod.ReadImageFile(@"../../Images/Error.png"), 2000, eToastGlowColor.Red, eToastPosition.MiddleCenter);
                return;
            }
            string img        = string.Empty;
            string returnInfo = b_GetMethod.HandleM_ImportPlan(m_ImportPlan, M_SQLType.Delete);

            GetTable();
            img = returnInfo.Equals("删除成功") ? @"../../Images/success.png" : @"../../Images/Error.png";
            ToastNotification.CustomGlowColor = Color.FromArgb(48, 32, 22);
            ToastNotification.Show(this, returnInfo, BLL.B_GetMethod.ReadImageFile(img), 2000, eToastGlowColor.Red, eToastPosition.MiddleCenter);
        }
Ejemplo n.º 2
0
        public static M_ImportPlan GetExcelToM_ImportPlan(string filePath)
        {
            ISheet       sheet;
            FileStream   fs;
            IWorkbook    workbook;
            M_ImportPlan m_ImportPlan;

            try
            {
                fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
                if (filePath.IndexOf(".xlsx") > 0)
                {// 2007版本
                    workbook = new XSSFWorkbook(fs);
                }
                else
                {// 2003版本
                    workbook = new HSSFWorkbook(fs);
                }
                m_ImportPlan             = new M_ImportPlan();
                sheet                    = workbook.GetSheetAt(0);
                m_ImportPlan.orderNumber = sheet.GetRow(0).GetCell(1).StringCellValue.ToString();
                int count = 2;
                m_ImportPlan.m_ListWorkOrderInfo = new List <M_ListPlanInfo>();
                int lastCell = sheet.GetRow(2).Cells.Count;
                while (true)
                {
                    IRow rows = sheet.GetRow(count);
                    if (rows != null && rows.Cells.Count == lastCell)
                    {
                        M_ListPlanInfo m_ListPlanInfo = new M_ListPlanInfo();
                        m_ListPlanInfo.productName   = rows.GetCell(0).StringCellValue.ToString();
                        m_ListPlanInfo.deliveryDate  = DateTime.Parse(rows.GetCell(1).DateCellValue.ToString());
                        m_ListPlanInfo.client        = rows.GetCell(2).StringCellValue.ToString();
                        m_ListPlanInfo.productNumber = int.Parse(rows.GetCell(3).NumericCellValue.ToString());
                        m_ImportPlan.m_ListWorkOrderInfo.Add(m_ListPlanInfo);
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }
                workbook.Close();
            }
            catch (Exception e)
            {
                throw e;
            }
            return(m_ImportPlan);
        }
Ejemplo n.º 3
0
 public string HandleM_ImportPlan(M_ImportPlan m_ImportPlan, M_SQLType m_SQLType)
 {
     return(d_GetMethod.HandleM_ImportPlan(m_ImportPlan, m_SQLType));
 }