Пример #1
0
        public static void Save()
        {
            ConnDB conn = new ConnDB();
            string sql;
            bool   isok   = false;
            string yyyymm = DirectLabourPriceQuery.GetMonth();

            if (yyyymm != "")
            {
                dlpuform.gridView1.FocusInvalidRow();
                for (int i = 0; i < dlpuform.gridView1.RowCount; i++)
                {
                    sql  = "update cost_direct_labour_price set price = " + dlpuform.gridView1.GetDataRow(i).ItemArray[3].ToString() + " where yyyymm = '" + yyyymm + "' and work_type = " + dlpuform.gridView1.GetDataRow(i).ItemArray[1].ToString();
                    isok = conn.EditDatabase(sql);
                }
            }
            if (isok)
            {
                MessageBox.Show("修改成功!");
                DirectLabourPriceQuery.RefreshEX();
                dlpuform.Close();
            }
            else
            {
                MessageBox.Show("失败!");
            }
            dlpuform.ischange = false;
            conn.Close();
            dlpuform.Close();
            DirectLabourPrice.savetype = "insert";
        }
Пример #2
0
 public static DirectLabourPriceQuery GetInstance()
 {
     if (dlpqform == null || dlpqform.IsDisposed)
     {
         dlpqform = new DirectLabourPriceQuery();
     }
     return(dlpqform);
 }
Пример #3
0
        private void barButtonItem查询_ItemClick(object sender, ItemClickEventArgs e)
        {
            DirectLabourPriceQuery Frm = DirectLabourPriceQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
        }
Пример #4
0
        private void DirectLabourPrice_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            DirectLabourPriceQuery Frm = DirectLabourPriceQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
            Frm.Height = this.Height - 20;
        }
Пример #5
0
        private void barButtonItem修改_ItemClick(object sender, ItemClickEventArgs e)
        {
            string month = DirectLabourPriceQuery.GetMonth();

            if (month != "")
            {
                DirectLabourPriceUpdate Frm = DirectLabourPriceUpdate.GetInstance();
                Frm.TopLevel = false;
                Frm.Parent   = this;
                Frm.Show();
                Frm.BringToFront();
            }
        }
Пример #6
0
        private void ShowDetail()
        {
            string yyyymm = DirectLabourPriceQuery.GetMonth();
            string strsql;

            if (yyyymm != "")
            {
                ConnDB conn = new ConnDB();
                strsql = "select i.yyyymm 年月,j.CID,j.CNAME 上班类型,i.price '费率(元/小时)' from (select * from cost_direct_labour_price where isnull(YYYYMM,'') ='" + yyyymm + "') i left join (select * from COST_WORK_TYPE where forbidden = 'false') j on i.WORK_TYPE = j.cid  ";
                DataSet ds = conn.ReturnDataSet(strsql);
                gridControl1.DataSource      = ds.Tables[0].DefaultView;
                gridView1.Columns[1].Visible = false;

                gridView1.Columns[0].OptionsColumn.ReadOnly = true;
                gridView1.Columns[1].OptionsColumn.ReadOnly = true;
                gridView1.Columns[2].OptionsColumn.ReadOnly = true;
                conn.Close();
            }
        }
 public static void Save()
 {
     if (dlpiform == null || dlpiform.IsDisposed)
     {
     }
     else
     {
         ConnDB   conn = new ConnDB();
         string   strsql;
         bool     isok  = false;
         DateTime dt1   = Convert.ToDateTime(dlpiform.dateTimePicker1.Text);
         DateTime dt2   = System.DateTime.Now;
         int      month = (dt2.Year - dt1.Year) * 12 + (dt2.Month - dt1.Month);
         if (!dlpiform.Exist())
         {
             if (month < -1)
             {
                 MessageBox.Show("月份错误!");
             }
             else
             {
                 dlpiform.gridView1.FocusInvalidRow();
                 for (int i = 0; i < dlpiform.gridView1.RowCount; i++)
                 {
                     strsql = "insert into cost_direct_labour_price(yyyymm,work_type,price) values('" + dlpiform.dateTimePicker1.Text.ToString() + "'," + dlpiform.gridView1.GetDataRow(i).ItemArray[0].ToString() + "," + Common.IsNull(dlpiform.gridView1.GetDataRow(i).ItemArray[2].ToString()) + ")";
                     isok   = conn.EditDatabase(strsql);
                 }
                 if (isok)
                 {
                     MessageBox.Show("保存成功!");
                     DirectLabourPriceQuery.RefreshEX();
                 }
                 else
                 {
                     MessageBox.Show("失败!");
                 }
             }
         }
         dlpiform.ischange = false;
         conn.Close();
     }
 }
        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;
                bool     isok  = false;
                DateTime dt1   = Convert.ToDateTime(dlpiform.dateTimePicker1.Text);
                DateTime dt2   = System.DateTime.Now;
                int      month = (dt2.Year - dt1.Year) * 12 + (dt2.Month - dt1.Month);
                if (!dlpiform.Exist())
                {
                    if (month < -1)
                    {
                        MessageBox.Show("月份错误!");
                    }
                    else
                    {
                        strsql = "insert into cost_direct_labour_price(yyyymm,work_type,price) select '" + dlpiform.dateTimePicker1.Text + "',work_type,price from cost_direct_labour_price where YYYYMM = (select Max(yyyymm) from cost_direct_labour_price) ";
                        isok   = conn.EditDatabase(strsql);
                        if (isok)
                        {
                            MessageBox.Show("复制成功!");
                            DirectLabourPriceQuery.RefreshEX();
                            this.Close();
                        }
                    }
                }
                conn.Close();
            }
            //Exist();
            //ShowDetail();
        }
Пример #9
0
 private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e)
 {
     DirectLabourPriceQuery.RefreshEX();
 }