Example #1
0
        private void SpecialDealUpdate_Load(object sender, EventArgs e)
        {
            BindOrg(comboBoxOrg);
            BindOrg(comboBoxToOrg);
            string   yyyymm = "", taskname = "";
            int      id = 0, organizationid = 0, toorganizationid = 0;
            DateTime dt         = DateTime.Now;
            DateTime startMonth = dt.AddDays(1 - dt.Day);  //本月月初

            this.dateTimePicker1.Value = startMonth;
            SpecialDealQuery.GetInfo(ref id, ref yyyymm, ref taskname, ref organizationid, ref toorganizationid);
            if (id != 0)
            {
                comboBoxOrg.SelectedIndex   = -1;
                comboBoxOrg.SelectedValue   = organizationid;
                comboBoxToOrg.SelectedIndex = -1;
                comboBoxToOrg.SelectedValue = toorganizationid;
                dateTimePicker1.Text        = yyyymm;
                textEditTask.Text           = taskname;
                textEditID.Text             = id.ToString();
            }

            dateTimePicker1.Focus();
            SendKeys.Send("{RIGHT} ");
        }
Example #2
0
 public static SpecialDealQuery GetInstance()
 {
     if (spqform == null || spqform.IsDisposed)
     {
         spqform = new SpecialDealQuery();
     }
     return(spqform);
 }
Example #3
0
        private void barButtonItem查询_ItemClick(object sender, ItemClickEventArgs e)
        {
            SpecialDealQuery Frm = SpecialDealQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
        }
Example #4
0
        private void SpecialDeal_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            SpecialDealQuery Frm = SpecialDealQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
            Frm.Height = this.Height - 20;
        }
Example #5
0
        private void barButtonItem修改_ItemClick(object sender, ItemClickEventArgs e)
        {
            string yyyymm = "", taskname = "";
            int    id = 0, organizationid = 0, toorganizationid = 0;

            SpecialDealQuery.GetInfo(ref id, ref yyyymm, ref taskname, ref organizationid, ref toorganizationid);
            if (id != 0)
            {
                SpecialDealUpdate Frm = new SpecialDealUpdate();
                Frm.TopLevel = false;
                Frm.Parent   = this;
                Frm.Show();
                Frm.BringToFront();
            }
        }
Example #6
0
        private void simpleButton复制_Click(object sender, EventArgs e)
        {
            MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
            DialogResult      dr         = MessageBox.Show("将按最近的月度数据自动新增当前选择月份的数据,确认复制吗?", "复制最近月份数据", messButton);

            if (dr == DialogResult.OK)
            {
                ConnDB   conn = new ConnDB();
                string   strsql, strsql2;
                int      rows;
                bool     isok  = false;
                DateTime dt1   = Convert.ToDateTime(dateTimePicker1.Text);
                DateTime dt2   = System.DateTime.Now;
                int      month = (dt2.Year - dt1.Year) * 12 + (dt2.Month - dt1.Month);
                strsql2 = "select yyyymm from cost_special_deal where yyyymm ='" + dateTimePicker1.Text.ToString() + "'";
                rows    = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该月已经有数据存在,不能复制!");
                }
                else if (month < -1)
                {
                    MessageBox.Show("月份错误!");
                }
                else
                {
                    strsql = "insert into cost_special_deal(yyyymm,task_name,organization_id,to_organization_id) select '" + dateTimePicker1.Text + "',task_name,organization_id,to_organization_id from cost_special_deal where YYYYMM = (select Max(yyyymm) from cost_special_deal) ";
                    isok   = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("复制成功!");
                        SpecialDealQuery.RefreshEX();
                        this.Close();
                    }
                }
                conn.Close();
            }
        }
Example #7
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_special_deal set task_name = '" + textEditTask.Text.ToString().Trim() + "',organization_id = " + comboBoxOrg.SelectedValue.ToString() + ",to_organization_id = " + comboBoxToOrg.SelectedValue.ToString();

            sql = sql + " where cid = " + textEditID.Text.ToString();
            string sql2 = "select * from cost_special_deal where task_name = '" + textEditTask.Text.ToString().Trim()
                          + "' and cid <> " + textEditID.Text.ToString() + " and yyyymm = '" + dateTimePicker1.Text.ToString() + "'";

            if (textEditTask.Text.ToString().Trim() != "" && comboBoxOrg.SelectedValue.ToString() != "0" && comboBoxToOrg.SelectedValue.ToString() != "0")
            {
                int rows = conn.ReturnRecordCount(sql2);
                if (rows > 0)
                {
                    MessageBox.Show("该记录已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        SpecialDealQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空值!");
            }
            conn.Close();
        }
Example #8
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_special_deal(yyyymm,task_name,organization_id,to_organization_id) values('" + dateTimePicker1.Text.ToString() + "','" + textEditTask.Text.ToString().Trim() + "'," + comboBoxOrg.SelectedValue + "," + comboBoxToOrg.SelectedValue + ")";
            strsql2 = "select yyyymm from cost_special_deal where yyyymm ='" + dateTimePicker1.Text.ToString() + "' and task_name = '" + textEditTask.Text.ToString().Trim() + "'";
            if (textEditTask.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该记录在本月已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        SpecialDealQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("工单不能为空!");
            }
            conn.Close();
        }
Example #9
0
 private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e)
 {
     SpecialDealQuery.RefreshEX();
 }