Beispiel #1
0
        private void btnInput_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageDialog.ShowEnquiryMessage("请确认所导入的EXCEL文件第一列为所需要导入的编号信息且列名为【旧箱箱号】,第二列为所需要导入的编号信息且列名为【新箱箱号】") == DialogResult.No)
                {
                    return;
                }

                DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

                if (dtTemp == null)
                {
                    return;
                }
                else
                {
                    foreach (DataRow dr in dtTemp.Rows)
                    {
                        if (dr[0].ToString().Trim().Length != 0 && dr[1].ToString().Trim().Length != 0)
                        {
                            txtOldCVTNumber.Text = dr[0].ToString();
                            txtNewCVTNumber.Text = dr[1].ToString();
                            btnAdd_Click(sender, e);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return;
            }
        }
        private void 导入EXCELToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

            if (dtTemp == null)
            {
                //MessageDialog.ShowPromptMessage(m_err);
                return;
            }

            if (dtTemp.Rows.Count == 0 ||
                dtTemp.Columns[0].ColumnName != "物品ID" ||
                dtTemp.Columns[1].ColumnName != "图号型号" ||
                dtTemp.Columns[2].ColumnName != "物品名称" ||
                dtTemp.Columns[3].ColumnName != "规格" ||
                dtTemp.Columns[4].ColumnName != "物品实际平均价")
            {
                MessageDialog.ShowPromptMessage(string.Format("{0} 中没有包含所需的信息,无法导入!",
                                                              openFileDialog1.FileName));
            }
            else
            {
                m_blFlag = true;
                dataGridView1.DataSource = dtTemp;
                MessageDialog.ShowPromptMessage("导入成功请点击【物品平均价校对】进行校对");
            }
        }
Beispiel #3
0
        private void btnInExcel_Click(object sender, EventArgs e)
        {
            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

            if (dtTemp == null)
            {
                //MessageDialog.ShowPromptMessage(m_strError);
                return;
            }

            if (CheckTable(dtTemp))
            {
                if (!m_serverCVTCustomer.BatchInsertCVTCustomerInformation(dtTemp, out m_strError))
                {
                    MessageDialog.ShowPromptMessage(m_strError);
                    return;
                }
                else
                {
                    string strMessage = "";

                    if (m_strError != null)
                    {
                        strMessage = "\n以下车架号的记录日期格式不正确"
                                     + m_strError + "\n系统已默认为【2099-12-31】,请自行修改";
                    }

                    MessageDialog.ShowPromptMessage("导入成功" + strMessage);
                }
            }

            ClearDate();
            RefreshDataGirdView(m_serverCVTCustomer.GetCVTCustomerInformation());
        }
        private void btnOutput_Click(object sender, EventArgs e)
        {
            string strSql = "select *,  b.员工姓名 AS 责任人, b.部门 AS 责任部门 from View_S_GaugeStandingBook as a " +
                            " left join dbo.View_HR_PersonnelArchive AS b ON a.DutyUser = b.员工编号";

            ExcelHelperP.DataTableToExcel(saveFileDialog1, GlobalObject.DatabaseServer.QueryInfo(strSql), null);
        }
        private void 月度预算申请表_Form_btnPrint(object sender, EventArgs e)
        {
            IBudgetMonth serviceBudgetMonth = Service_Economic_Financial.ServerModuleFactory.GetServerModule <IBudgetMonth>();

            if (tabControl1.SelectedTab.Text == "全部")
            {
                MessageDialog.ShowPromptMessage("请选择【已处理】或【待处理】中的记录");
                return;
            }

            string billNo = "";

            if (tabControl1.SelectedTab.Text == "已处理")
            {
                if (dataGridView2.Rows.Count > 0)
                {
                    billNo = dataGridView2.CurrentRow.Cells["业务编号"].Value.ToString();
                }
            }
            else if (tabControl1.SelectedTab.Text == "待处理")
            {
                if (dataGridView1.Rows.Count > 0)
                {
                    billNo = dataGridView1.CurrentRow.Cells["业务编号"].Value.ToString();
                }
            }

            Business_Finance_Budget_Month billInfo = serviceBudgetMonth.GetBillSingleInfo(billNo);
            DataTable tempTable = serviceBudgetMonth.GetDetailInfo(billInfo);

            ExcelHelperP.DataTableToExcel(saveFileDialog1, tempTable, null);
        }
        private void 导入toolStripButton_Click(object sender, EventArgs e)
        {
            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

            if (dtTemp == null)
            {
                //MessageDialog.ShowPromptMessage(error);
                return;
            }

            if (CheckTable(dtTemp))
            {
                if (!m_personnerServer.InsertPersonnelArchiveInfo(dtTemp, out error))
                {
                    MessageDialog.ShowPromptMessage(error);
                    return;
                }
                else
                {
                    MessageDialog.ShowPromptMessage("导入成功!");
                }
            }

            RefreshControl();
        }
Beispiel #7
0
        private void btnInExcel_Click(object sender, EventArgs e)
        {
            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

            if (dtTemp == null)
            {
                MessageDialog.ShowPromptMessage("文件无效,转换失败");
                return;
            }

            if (!dtTemp.Columns.Contains("图号型号"))
            {
                MessageDialog.ShowPromptMessage("无【图号型号】列");
                return;
            }

            if (!dtTemp.Columns.Contains("物品名称"))
            {
                MessageDialog.ShowPromptMessage("无【物品名称】列");
                return;
            }

            if (!dtTemp.Columns.Contains("规格"))
            {
                MessageDialog.ShowPromptMessage("无【规格】列");
                return;
            }

            if (!dtTemp.Columns.Contains("基数"))
            {
                MessageDialog.ShowPromptMessage("无【基数】列");
                return;
            }

            if (!dtTemp.Columns.Contains("总成型号"))
            {
                MessageDialog.ShowPromptMessage("无【总成型号】列");
                return;
            }

            if (!dtTemp.Columns.Contains("安全库存"))
            {
                MessageDialog.ShowPromptMessage("无【安全库存】列");
                return;
            }

            try
            {
                m_serverCBOM.BatchInsertCGBom(dtTemp);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return;
            }

            RefreshData();
            MessageDialog.ShowPromptMessage("导入完成");
        }
Beispiel #8
0
        private void btn_QuestionBank_Input_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

                if (dtTemp == null)
                {
                    return;
                }

                if (!dtTemp.Columns.Contains("考题ID"))
                {
                    MessageDialog.ShowPromptMessage("文件中无【考题ID】列");
                    return;
                }

                if (!dtTemp.Columns.Contains("考题类型"))
                {
                    MessageDialog.ShowPromptMessage("文件中无【考题类型】列");
                    return;
                }

                if (!dtTemp.Columns.Contains("考题内容"))
                {
                    MessageDialog.ShowPromptMessage("文件中无【考题内容】列");
                    return;
                }

                if (!dtTemp.Columns.Contains("选项"))
                {
                    MessageDialog.ShowPromptMessage("文件中无【选项】列");
                    return;
                }

                if (!dtTemp.Columns.Contains("选项内容"))
                {
                    MessageDialog.ShowPromptMessage("文件中无【选项内容】列");
                    return;
                }

                if (!dtTemp.Columns.Contains("答案"))
                {
                    MessageDialog.ShowPromptMessage("文件中无【答案】列");
                    return;
                }

                _ServiceBasicInfo.InputQuestionsBank(_CourseInfo.ID, dtTemp);
                MessageDialog.ShowPromptMessage("导入成功");
                dgv_QuestionBank.DataSource =
                    new BindingCollection <View_HR_Train_QuestionBank>(_ServiceBasicInfo.GetListQuestionBank(_CourseInfo.ID));
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
Beispiel #9
0
        private void toolStripButton导出_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = m_marketPartBillServer.GetExcelData(
                checkBillDateAndStatus1.dtpStartTime.Value, checkBillDateAndStatus1.dtpEndTime.Value,
                checkBillDateAndStatus1.cmbBillStatus.Text);

            ExcelHelperP.DatagridviewToExcel(saveFileDialog1, dataGridView1);
            RefreshDataGridView();
        }
        private void btnExcel_Click(object sender, EventArgs e)
        {
            if (txtClient.Text == "")
            {
                MessageDialog.ShowPromptMessage("请选择客户后再进行此操作!");
                return;
            }

            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

            if (dtTemp == null)
            {
                //MessageDialog.ShowPromptMessage(m_error);
                return;
            }

            if (CheckTable(dtTemp))
            {
                dtTemp.Columns.Add("物品ID");
                dtTemp.Columns.Add("客户零件代码");
                dtTemp.Columns.Add("客户零件名称");
                DataRow dr = dtTemp.NewRow();

                for (int i = 0; i < dtTemp.Rows.Count; i++)
                {
                    DataRow row = dtTemp.Rows[i];

                    row["物品ID"] = UniversalFunction.GetGoodsID(row["图号型号"].ToString(), row["物品名称"].ToString(), row["规格"].ToString());

                    if (Convert.ToInt32(row["物品ID"]) == 0)
                    {
                        MessageDialog.ShowPromptMessage("第" + i + "行零件有误,请确认!");
                        return;
                    }

                    DataTable dt = m_salesOrderServer.GetCommunicate(txtClient.Tag.ToString(),
                                                                     Convert.ToInt32(row["物品ID"]));

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        row["客户零件代码"] = m_salesOrderServer.GetCommunicate(txtClient.Tag.ToString(),
                                                                          Convert.ToInt32(row["物品ID"])).Rows[0]["CommunicateGoodsCode"];
                        row["客户零件名称"] = m_salesOrderServer.GetCommunicate(txtClient.Tag.ToString(),
                                                                          Convert.ToInt32(row["物品ID"])).Rows[0]["CommunicateGoodsName"];
                    }
                    else
                    {
                        row["客户零件代码"] = "";
                        row["客户零件名称"] = "";
                    }
                }

                dgvPartList.DataSource = dtTemp;
            }
        }
Beispiel #11
0
 private void btnOutExcel_Click(object sender, EventArgs e)
 {
     if (tabControl1.SelectedTab.Name == "tpMachineAccount")
     {
         ExcelHelperP.DatagridviewToExcel(saveFileDialog1, dataGridView_MachineAccount);
     }
     else if (tabControl1.SelectedTab.Name == "tpDayToDay")
     {
         ExcelHelperP.DatagridviewToExcel(saveFileDialog1, dataGridView_DayToDay);
     }
 }
Beispiel #12
0
        private void btnIn_Click(object sender, EventArgs e)
        {
            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

            if (dtTemp == null)
            {
                //MessageDialog.ShowPromptMessage(m_strErr);
                return;
            }

            if (dtTemp.Rows.Count == 0 ||
                dtTemp.Columns[0].ColumnName != "物品ID" ||
                dtTemp.Columns[1].ColumnName != "图号型号" ||
                dtTemp.Columns[2].ColumnName != "物品名称" ||
                dtTemp.Columns[3].ColumnName != "规格" ||
                dtTemp.Columns[4].ColumnName != "单位" ||
                dtTemp.Columns[5].ColumnName != "单价")
            {
                MessageDialog.ShowPromptMessage(string.Format("{0} 中没有包含所需的信息,无法导入!",
                                                              openFileDialog1.FileName));
            }
            else
            {
                for (int i = 0; i < dtTemp.Rows.Count; i++)
                {
                    View_F_GoodsPlanCost tempGoodsLnq = UniversalFunction.GetGoodsInfo(dtTemp.Rows[i]["图号型号"].ToString(),
                                                                                       dtTemp.Rows[i]["物品名称"].ToString(), dtTemp.Rows[i]["规格"].ToString());

                    if (tempGoodsLnq != null)
                    {
                        dtTemp.Rows[i]["物品ID"] = tempGoodsLnq.序号;
                        dtTemp.Rows[i]["单位"]   = tempGoodsLnq.单位;
                    }
                    else
                    {
                        dtTemp.Rows.RemoveAt(i);
                    }
                }

                if (!m_serverThreePacketsOfTheRepairBill.UpdateAllGoodsUnitPrice(
                        MessageBox.Show("是否删除原有记录", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes? true : false,
                        dtTemp, out m_strErr))
                {
                    MessageDialog.ShowPromptMessage(m_strErr);
                }

                dataGridView1.DataSource = m_serverThreePacketsOfTheRepairBill.GetGoodsUnitPriceInfo();

                userControlDataLocalizer1.Init(dataGridView1, this.Name,
                                               UniversalFunction.SelectHideFields(this.Name, dataGridView1.Name, BasicInfo.LoginID));

                MessageDialog.ShowPromptMessage("导入成功");
            }
        }
 private void btnOutput_Click(object sender, EventArgs e)
 {
     try
     {
         ExcelHelperP.DataTableToExcel(saveFileDialog1, _Service_UnitList.GetMaxVersionNoInfo(), null);
     }
     catch (Exception ex)
     {
         MessageDialog.ShowPromptMessage(ex.Message);
     }
 }
        private void 导出toolStripButton_Click(object sender, EventArgs e)
        {
            DataTable dt = GetFormatTable();

            dataGridView1.DataSource = dt;

            string[] hide = { "记录员", "记录时间", "备注", "部门编码", "全勤奖金" };

            ExcelHelperP.DataTableToExcel(saveFileDialog1, dt, hide);

            RefreshDataGridView();
        }
        private void btnInputExcel_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

                if (dtTemp == null)
                {
                    return;
                }

                if (!dtTemp.Columns.Contains("图号型号"))
                {
                    MessageDialog.ShowPromptMessage("文件无【图号型号】列名");
                    return;
                }

                if (!dtTemp.Columns.Contains("物品名称"))
                {
                    MessageDialog.ShowPromptMessage("文件无【物品名称】列名");
                    return;
                }

                if (!dtTemp.Columns.Contains("规格"))
                {
                    MessageDialog.ShowPromptMessage("文件无【规格】列名");
                    return;
                }

                if (!dtTemp.Columns.Contains("批次号"))
                {
                    MessageDialog.ShowPromptMessage("文件无【批次号】列名");
                    return;
                }

                if (!dtTemp.Columns.Contains("数量"))
                {
                    MessageDialog.ShowPromptMessage("文件无【数量】列名");
                    return;
                }

                m_goodsServer.InsertInfoExcel(m_billNo, dtTemp);
                MessageDialog.ShowPromptMessage("导入成功");
                m_queryGoodsInfo = m_goodsServer.GetGoods(m_billNo);
                RefreshDataGridView(m_queryGoodsInfo);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return;
            }
        }
        private void btnExcel_Click(object sender, EventArgs e)
        {
            DataGridView dgv = new DataGridView();

            foreach (Control cl in tabControl1.SelectedTab.Controls)
            {
                if (cl is DataGridView)
                {
                    dgv = (DataGridView)cl;
                }
            }

            ExcelHelperP.DatagridviewToExcel(saveFileDialog1, dgv);
        }
        private void btnImport_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1.OpenFile());

            if (dtTemp == null)
            {
                MessageDialog.ShowPromptMessage(m_err);
                return;
            }
            else
            {
                if (!dtTemp.Columns.Contains("零件编码") ||
                    !dtTemp.Columns.Contains("零件名称") ||
                    !dtTemp.Columns.Contains("规格") ||
                    !dtTemp.Columns.Contains("基数"))
                {
                    MessageDialog.ShowPromptMessage("表中的列未包含【零件编码】,【零件名称】,【规格】,【基数】,请重新核对");
                }

                DataTable sourceTable = ((DataTable)Dgv_Main.DataSource).Clone();

                foreach (DataRow dr in dtTemp.Rows)
                {
                    if (dr["零件编码"].ToString().Trim().Length > 0 ||
                        dr["零件名称"].ToString().Trim().Length > 0)
                    {
                        DataRow tempRow = sourceTable.NewRow();

                        tempRow["产品编码"] = tbsEditionName.Tag.ToString();
                        tempRow["父级编码"] = "";
                        tempRow["零件编码"] = dr["零件编码"];
                        tempRow["零件名称"] = dr["零件名称"];
                        tempRow["规格"]   = dr["规格"];
                        tempRow["基数"]   = dr["基数"];
                        tempRow["别名"]   = "";
                        tempRow["顺序位置"] = 0;

                        sourceTable.Rows.Add(tempRow);
                    }
                }

                Dgv_Main.DataSource = sourceTable;
            }
        }
        private void btnOutDownSafeCount_Click(object sender, EventArgs e)
        {
            DataTable dtDate = (DataTable)dataGridView1.DataSource;

            DataRow[] dr = dtDate.Select("安全库存数 > 实际库存数量");

            DataTable dtPrint = dtDate.Clone();

            for (int i = 0; i < dr.Length; i++)
            {
                dtPrint.ImportRow(dr[i]);
            }

            ExcelHelperP.DataTableToExcel(saveFileDialog1, dtPrint, null);
        }
Beispiel #19
0
        private void 导入toolStripButton_Click(object sender, EventArgs e)
        {
            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

            if (dtTemp == null)
            {
                //MessageDialog.ShowPromptMessage(m_error);
                return;
            }

            if (!m_providerServer.InsertProvidersInfo(dtTemp, out m_error))
            {
                MessageDialog.ShowPromptMessage(m_error);
            }
        }
        private void btnInExcel_Click(object sender, EventArgs e)
        {
            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

            if (dtTemp == null)
            {
                //MessageDialog.ShowPromptMessage(m_err);
                return;
            }

            if (dtTemp.Rows.Count == 0 ||
                !dtTemp.Columns.Contains("新箱号") ||
                !dtTemp.Columns.Contains("旧箱号") ||
                !dtTemp.Columns.Contains("新箱型号") ||
                !dtTemp.Columns.Contains("旧箱型号") ||
                !dtTemp.Columns.Contains("备注"))
            {
                MessageDialog.ShowPromptMessage(string.Format("{0} 中没有包含所需的信息,无法导入!",
                                                              openFileDialog1.FileName));
            }
            else
            {
                string strBatchNo = m_sell.GetMatchingBillID();

                for (int i = 0; i < dtTemp.Rows.Count; i++)
                {
                    m_lnqNewAndOld.BatchNo        = strBatchNo;
                    m_lnqNewAndOld.NewProductCode = dtTemp.Rows[i]["新箱号"].ToString();
                    m_lnqNewAndOld.OldProductCode = dtTemp.Rows[i]["旧箱号"].ToString();
                    m_lnqNewAndOld.NewEdition     = dtTemp.Rows[i]["新箱型号"].ToString();
                    m_lnqNewAndOld.OldEdition     = dtTemp.Rows[i]["旧箱型号"].ToString();
                    m_lnqNewAndOld.Remark         = dtTemp.Rows[i]["备注"].ToString();

                    if (m_sell.IsSameProductMatchingInfo(m_lnqNewAndOld))
                    {
                        if (!m_sell.AddMatchingInfo(m_lnqNewAndOld, out m_err))
                        {
                            MessageDialog.ShowPromptMessage(m_err);
                        }
                    }
                }

                MessageDialog.ShowPromptMessage("导入成功!");
            }

            dataGridView1.DataSource            = m_sell.GetProductCodeMatchingInfo();
            dataGridView1.Columns["序号"].Visible = false;
        }
        private void 餐补toolStripButton1_Click(object sender, EventArgs e)
        {
            DataTable dt = GetFormatTable();

            string[] hide = { "迟到情况描述",    "早退情况描述",     "加班总小时数",    "平时加班总小时数",
                              "周末加班总小时数",  "法定节假日加班小时数", "加班补助总小时数",  "加班调休小时数", "周末加班补助小时数",
                              "平时加班补助小时数", "周末加班调休小时数",  "平时加班调休小时数", "未打卡次数",   "旷工小时数",    "事假次数",
                              "事假小时数",     "病假次数",       "病假小时数",     "带薪病假次数",  "带薪病假小时数",  "出差次数",   "出差小时数", "调休涉及天数", "允许调休小时数",
                              "调休次数",      "调休小时数",      "年假次数",      "年假小时数",   "婚假次数",     "婚假小时数",  "产假次数",  "产假小时数",  "清除加班小时数","年假剩余小时数",
                              "丧假次数",      "丧假小时数",      "考试假次数",     "考试假小时数",  "其他假次数",    "其他假小时数", "记录员",   "记录时间",   "备注",     "部门编码",
                              "全勤奖金" };

            ExcelHelperP.DataTableToExcel(saveFileDialog1, dt, hide);

            RefreshDataGridView();
        }
        private void btn变更允许调休小时数_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog dialog = new OpenFileDialog();
                DataTable      dt     = ExcelHelperP.RenderFromExcel(dialog);

                if (dt != null)
                {
                    List <HR_AttendanceSummary> lstSummary = new List <HR_AttendanceSummary>();

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if ((dt.Rows[i]["工号"] == null || GlobalObject.GeneralFunction.IsNullOrEmpty(dt.Rows[i]["工号"].ToString())) ||
                            (dt.Rows[i]["年份"] == null || GlobalObject.GeneralFunction.IsNullOrEmpty(dt.Rows[i]["年份"].ToString())) ||
                            (dt.Rows[i]["月份"] == null || GlobalObject.GeneralFunction.IsNullOrEmpty(dt.Rows[i]["月份"].ToString())) ||
                            (dt.Rows[i]["允许调休小时数"] == null || GlobalObject.GeneralFunction.IsNullOrEmpty(dt.Rows[i]["允许调休小时数"].ToString())))
                        {
                            throw new Exception("第" + (i + 2).ToString() + "行记录存在【空数据】");
                        }

                        if (UniversalFunction.GetPersonnelInfo(dt.Rows[i]["工号"].ToString()) == null)
                        {
                            throw new Exception("【工号】:" + dt.Rows[i]["工号"].ToString() + ", 不存在");
                        }

                        HR_AttendanceSummary summary = new HR_AttendanceSummary();

                        summary.WorkID = dt.Rows[i]["工号"].ToString();
                        summary.Year   = Convert.ToInt32(dt.Rows[i]["年份"]);
                        summary.Month  = Convert.ToInt32(dt.Rows[i]["月份"]);
                        summary.AllowMobileVacationHours = Convert.ToDouble(dt.Rows[i]["允许调休小时数"]);

                        lstSummary.Add(summary);
                    }

                    m_attendanceServer.UpdateAllowMobileHours(lstSummary);

                    MessageDialog.ShowPromptMessage("修改【允许调休小时数】成功");
                }
            }
            catch (Exception exce)
            {
                MessageDialog.ShowErrorMessage(exce.Message);
            }
        }
        private void 导出考勤toolStripButton_Click(object sender, EventArgs e)
        {
            DataTable dt = GetFormatTable();

            string[] hide = { "迟到次数",     "迟到情况描述",   "早退次数",    "早退情况描述", "加班次数",   "加班总小时数",   "平时加班总小时数",
                              "周末加班总小时数", "加班补助总小时数", "加班调休小时数", "未打卡次数",  "旷工次数",   "旷工小时数",    "事假次数",
                              "事假涉及天数",   "病假次数",     "病假小时数",   "病假涉及天数", "带薪病假次数", "带薪病假涉及天数", "出差次数",
                              "出差小时数",    "出差假涉及天数",  "清除加班小时数", "调休次数",   "调休小时数",  "调休涉及天数",   "年假次数",
                              "年假小时数",    "年假涉及天数",   "婚假次数",    "婚假小时数",  "婚假涉及天数", "产假次数",     "产假小时数",
                              "产假涉及天数",   "丧假次数",     "丧假小时数",   "丧假涉及天数", "考试假次数",  "考试假小时数",   "考试假涉及天数",
                              "其他假次数",    "其他假小时数",   "其他假涉及天数", "扣餐补天数",  "应考勤天数",  "全勤奖金",     "加班餐补",    "出勤餐补",
                              "记录员",      "记录时间",     "部门编码",    "备注" };

            ExcelHelperP.DataTableToExcel(saveFileDialog1, dt, hide);

            RefreshDataGridView();
        }
 private void btnOutExcel_Click(object sender, EventArgs e)
 {
     foreach (Control cl in tabControl1.SelectedTab.Controls)
     {
         if (cl is TabControl)
         {
             foreach (Control clSon in ((TabControl)cl).SelectedTab.Controls)
             {
                 if (clSon is CustomDataGridView)
                 {
                     ExcelHelperP.DatagridviewToExcel(saveFileDialog1, (DataGridView)clSon);
                 }
             }
         }
         else if (cl is CustomDataGridView)
         {
             ExcelHelperP.DatagridviewToExcel(saveFileDialog1, (DataGridView)cl);
         }
     }
 }
Beispiel #25
0
        private void 导出报缺项ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count > 0)
            {
                DataTable dt = ((DataTable)dataGridView1.DataSource).Clone();
                DataRow[] dr = ((DataTable)dataGridView1.DataSource).Select("报缺数 < 0");

                if (dr.Length > 0)
                {
                    for (int a = 0; a <= dr.Length - 1; a++)
                    {
                        dt.ImportRow(dr[a]);
                    }
                }

                string[] hideColumns = { "物品ID" };

                ExcelHelperP.DataTableToExcel(saveFileDialog1, dt, hideColumns);
            }
        }
        private void btnImport_Click(object sender, EventArgs e)
        {
            if (txtFileName.Text.Trim().Length > 0)
            {
                if (System.IO.File.Exists(txtFileName.Text))
                {
                    openFileDialog1.FileName = txtFileName.Text;
                }
                else
                {
                    MessageDialog.ShowPromptMessage("不存在的数据文件:" + txtFileName.Text);
                    return;
                }
            }

            if (GlobalObject.GeneralFunction.IsNullOrEmpty(openFileDialog1.FileName))
            {
                MessageDialog.ShowPromptMessage("请选择要导入的文件后再进行此操作!");
                return;
            }

            try
            {
                Data = ExcelHelperP.RenderFromExcel(openFileDialog1.OpenFile());

                if (Data != null || Data.Rows.Count == 0 ||
                    Data.Columns[0].ColumnName != "液力变矩器型号" || Data.Columns[4].ColumnName != "变矩器出厂编号")
                {
                    MessageDialog.ShowPromptMessage(string.Format("{0} 中没有包含所需的信息,无法导入!", openFileDialog1.FileName));
                    return;
                }

                Complete = true;

                this.DialogResult = DialogResult.OK;
            }
            catch (Exception exce)
            {
                MessageDialog.ShowErrorMessage(exce.Message);
            }
        }
        private void btnIn_Click(object sender, EventArgs e)
        {
            主机厂报表操作指示窗体 form = new 主机厂报表操作指示窗体();

            form.ShowDialog();

            if (!form.BlFlag)
            {
                return;
            }

            DataTable dtTemp = ExcelHelperP.RenderFromExcel(openFileDialog1);

            if (dtTemp == null)
            {
                //MessageDialog.ShowPromptMessage(m_strErr);
                return;
            }

            if (dtTemp.Rows.Count == 0 ||
                dtTemp.Columns[0].ColumnName != "图号型号" ||
                dtTemp.Columns[1].ColumnName != "物品名称" ||
                dtTemp.Columns[2].ColumnName != "协议单价" ||
                dtTemp.Columns[3].ColumnName != "实挂数量")
            {
                MessageDialog.ShowPromptMessage(string.Format("{0} 中没有包含所需的信息,无法导入!",
                                                              openFileDialog1.FileName));
            }
            else
            {
                if (!m_serverComReportBill.UpdateSignTheBill(form.StrCommunicate, dtTemp, out m_strErr))
                {
                    MessageDialog.ShowPromptMessage(m_strErr);
                }
                else
                {
                    MessageDialog.ShowPromptMessage("导入成功");
                }
            }
        }
        private void 综合查询toolStripButton3_Click(object sender, EventArgs e)
        {
            IAuthorization       authorization = PlatformFactory.GetObject <IAuthorization>();
            string               businessID    = "查看储备人才库";
            IQueryResult         qr            = authorization.Query(businessID, null, null, 0);
            List <string>        lstFindField  = new List <string>();
            DataColumnCollection columns       = qr.DataCollection.Tables[0].Columns;

            if (qr.Succeeded && columns.Count > 0)
            {
                ExcelHelperP.DatagridviewToExcel(saveFileDialog1, dataGridView1);

                for (int i = 0; i < columns.Count; i++)
                {
                    lstFindField.Add(columns[i].ColumnName);
                }
            }

            FormConditionFind formFindCondition = new FormConditionFind(this, lstFindField.ToArray(), businessID, labelTitle.Text);

            formFindCondition.ShowDialog();
        }
        private void 导出各部门在职人数ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = new DataTable();

                if (!m_personnerServer.ExcelOnjob(out dt, out error))
                {
                    MessageDialog.ShowPromptMessage(error);
                    return;
                }
                else
                {
                    string[] columns = { };
                    ExcelHelperP.DataTableToExcel(saveFileDialog1, dt, columns);
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = new DataTable();

                if (!m_personnerServer.ExcelDimission(dtpStartDate.Value, dtpEndDate.Value, out dt, out m_error))
                {
                    MessageDialog.ShowPromptMessage(m_error);
                }
                else
                {
                    ExcelHelperP.DataTableToExcel(saveFileDialog1, dt, null);
                }

                this.Close();
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                this.Close();
            }
        }