Пример #1
0
        private void btncc_Click(object sender, EventArgs e)
        {
            DAL_Execute bllel = new DAL_Execute();

            if (this.lblId.Text.Length == 0)
            {
                MessageBox.Show(this, "没有选择需要重采的数据行!");
                return;
            }
            if (this.txtywdate.Text.Length == 0)
            {
                MessageBox.Show(this, "请选择‘重采业务时间’!");
                return;
            }
            if (this.txtczdate.Text.Length == 0)
            {
                MessageBox.Show(this, "请选择‘重采操作时间’!");
                return;
            }

            DateTime ywdate   = Convert.ToDateTime(txtywdate.Text.Trim());
            DateTime czdate   = Convert.ToDateTime(txtczdate.Text.Trim());
            int      configid = Convert.ToInt32(lblId.Text.Trim());
            bool     result   = bllel.ExecuteConfig(configid, ywdate, czdate);

            if (result)
            {
                MessageBox.Show(this, "重采成功");
            }
            else
            {
                MessageBox.Show(this, "重采失败");
            }
        }
Пример #2
0
 private void ExportDataSetToExcel(int configdi, Guid id)
 {
     if (bll.ExecuteConfig(configdi, id))
     {
         BindData();
         MsgBox("成功");
     }
     else
     {
         MsgBox("失败");
     }
 }
Пример #3
0
        public void Execute()
        {
            #region   循环
            if (ExecuteStatus == 0)
            {
                if (dgv.Rows.Count > 0)
                {
                    for (int i = 0; i < dgv.Rows.Count; i++)
                    {
                        model    = new Config();
                        model.Id = 0;
                        string date      = dgv.Rows[i].Cells["本次执行时间"].Value.ToString().Trim();
                        int    id        = int.Parse(dgv.Rows[i].Cells["编号"].Value.ToString().Trim());
                        string statusrow = dgv.Rows[i].Cells["线程状态"].Value.ToString().Trim();
                        if (date != "" && !dtslist.Contains(id))
                        {
                            DateTime dt = Convert.ToDateTime(date);
                            if (DateTime.Now >= dt.AddSeconds(-10))
                            {
                                #region 组织实体对象



                                model.Id                 = id;
                                model.FileFormatName     = dgv.Rows[i].Cells[12].Value.ToString().Trim();
                                model.DateSql            = dgv.Rows[i].Cells["数据集Sql"].Value.ToString().Trim();
                                model.BecomeValidateDate = DateTime.Parse(dgv.Rows[i].Cells["首次执行日期"].Value.ToString().Trim());
                                model.BusinessName       = dgv.Rows[i].Cells["业务名称"].Value.ToString().Trim();
                                model.ConfigType         = Convert.ToInt32(dgv.Rows[i].Cells["配置方式"].Value.ToString().Trim() == "内置配置" ? "0" : "1");
                                model.Cycle              = dgv.Rows[i].Cells["周期"].Value.ToString().Trim();
                                string type    = dgv.Rows[i].Cells["文件格式"].Value.ToString().Trim();
                                int    inttype = 2;
                                switch (type)
                                {
                                case "Excel97_2003": inttype = 1; break;

                                case "Excel2007": inttype = 2; break;

                                case "文本文件": inttype = 3; break;

                                case "csv": inttype = 4; break;
                                }
                                model.FileType            = inttype;
                                model.LoseEfficacyDate    = DateTime.Parse(dgv.Rows[i].Cells["失效日期"].Value.ToString().Trim());
                                model.NextVoluntarilyTime = DateTime.Parse(date);
                                model.PathName            = dgv.Rows[i].Cells["文件路径"].Value.ToString().Trim();

                                model.IsHead     = Convert.ToBoolean(dgv.Rows[i].Cells["是否显示头部"].Value.ToString().Trim());
                                model.ServerType = dgv.Rows[i].Cells["数据访问类型"].Value.ToString().Trim();

                                model.OrgCode = dgv.Rows[i].Cells["机构编码"].Value.ToString().Trim();

                                #endregion

                                listModel.Add(model);
                                dtslist.Add(model.Id);



                                break;
                            }
                        }
                    }

                    if (model.Id > 0)
                    {
                        ExecuteStatus = 1;
                        dal.ExecuteConfig(model, DateTime.Now);


                        InvokeReFreshDgv rf = new InvokeReFreshDgv(RemoveDgv);
                        this.BeginInvoke(rf, new object[] { model.Id.ToString().Trim() });



                        ExecuteStatus = 0;
                    }
                }
            }
            #endregion
        }
Пример #4
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            btnAdd.Visible = false;
            DateTime dt = Convert.ToDateTime(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " 00:00:00");

            if (hfid.Value == "")
            {
                MessageBox.ShowAndRedirect(this, "选择需要重采的数据行", "DdiConfigList.aspx");
                return;
            }
            if (this.txtywdate.Text.Length == 0)
            {
                MessageBox.Show(this, "请选择‘重采业务时间’!");
                return;
            }
            else
            {
                if (Convert.ToDateTime(txtywdate.Text.Trim()) >= dt)
                {
                    MessageBox.Show(this, "重采业务时间不能大于等于今天");
                    return;
                }
            }
            if (this.txtczdate.Text.Length == 0)
            {
                MessageBox.Show(this, "请选择‘重采操作时间’!");
                return;
            }
            else
            {
                if (Convert.ToDateTime(txtywdate.Text.Trim()) >= dt)
                {
                    MessageBox.Show(this, "重采操作时间不能大于等于今天");
                    return;
                }
            }


            DAL_Execute bllel = new DAL_Execute();

            DateTime ywdate       = Convert.ToDateTime(txtywdate.Text.Trim());
            DateTime czdate       = Convert.ToDateTime(txtczdate.Text.Trim());
            int      configid     = Convert.ToInt32(hfid.Value.Trim());
            bool     CbisDownload = this.CbisDownload.Checked;

            string pathname = "";

            bool result = bllel.ExecuteConfig(configid, ywdate, czdate, out pathname);

            if (result)
            {
                MessageBox.ShowAndRedirect(this, "重采成功", "DdiConfigList.aspx");
                if (this.CbisDownload.Checked == true && pathname != "")
                {
                    FileDownLoad(pathname);
                }
            }
            else
            {
                MessageBox.Show(this, "重采失败");
            }
        }