Exemplo n.º 1
0
        public static void Save()
        {
            ConnDB conn = new ConnDB();
            string sql;
            bool   isok = false;
            string yyyymm = "";
            int    id = 0, level_begin = 0, level_end = 0;

            InDirectLabourLevelPriceQuery.GetInfo(ref id, ref yyyymm, ref level_begin, ref level_end);
            if (yyyymm != "")
            {
                dlpuform.gridView1.FocusInvalidRow();
                for (int i = 0; i < dlpuform.gridView1.RowCount; i++)
                {
                    sql  = "update cost_indirect_labour_level_price set price = " + dlpuform.gridView1.GetDataRow(i).ItemArray[6].ToString() + " where cid = " + dlpuform.gridView1.GetDataRow(i).ItemArray[0].ToString();
                    isok = conn.EditDatabase(sql);
                }
            }
            if (isok)
            {
                MessageBox.Show("修改成功!");
                InDirectLabourLevelPriceQuery.RefreshEX();
                dlpuform.Close();
            }
            else
            {
                MessageBox.Show("失败!");
            }
            dlpuform.ischange = false;
            conn.Close();
            dlpuform.Close();
            InDirectLabourLevelPrice.savetype = "insert";
        }
Exemplo n.º 2
0
 public static void Save()
 {
     if (ilpiform == null || ilpiform.IsDisposed)
     {
     }
     else
     {
         ConnDB   conn = new ConnDB();
         string   strsql;
         bool     isok  = false;
         DateTime dt1   = Convert.ToDateTime(ilpiform.dateTimePicker1.Text);
         DateTime dt2   = System.DateTime.Now;
         int      month = (dt2.Year - dt1.Year) * 12 + (dt2.Month - dt1.Month);
         if (ilpiform.textEditLevelBegin.Text.ToString().Trim() == "" || ilpiform.textEditLevelEnd.Text.ToString().Trim() == "")
         {
             MessageBox.Show("员工等级不能为空!");
         }
         else if (!ilpiform.Exist())
         {
             if (month < -1)
             {
                 MessageBox.Show("月份错误!");
             }
             else
             {
                 ilpiform.gridView1.FocusInvalidRow();
                 for (int i = 0; i < ilpiform.gridView1.RowCount; i++)
                 {
                     strsql = "insert into COST_INDIRECT_LABOUR_LEVEL_PRICE(yyyymm,level_begin,level_end,work_type,price) values('" + ilpiform.dateTimePicker1.Text.ToString() + "'," + ilpiform.textEditLevelBegin.Text.ToString().Trim() + "," + ilpiform.textEditLevelEnd.Text.ToString().Trim() + "," + ilpiform.gridView1.GetDataRow(i).ItemArray[0].ToString() + "," + Common.IsNull(ilpiform.gridView1.GetDataRow(i).ItemArray[2].ToString()) + ")";
                     isok   = conn.EditDatabase(strsql);
                 }
                 if (isok)
                 {
                     MessageBox.Show("保存成功!");
                     InDirectLabourLevelPriceQuery.RefreshEX();
                     ilpiform.Close();
                 }
                 else
                 {
                     MessageBox.Show("失败!");
                 }
             }
         }
         else
         {
             MessageBox.Show("该数据已经存在!");
         }
         ilpiform.ischange = false;
         conn.Close();
     }
 }
Exemplo n.º 3
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;
                int      rows;
                bool     isok  = false;
                DateTime dt1   = Convert.ToDateTime(ilpiform.dateTimePicker1.Text);
                DateTime dt2   = System.DateTime.Now;
                int      month = (dt2.Year - dt1.Year) * 12 + (dt2.Month - dt1.Month);
                strsql = "select * from COST_INDIRECT_LABOUR_LEVEL_PRICE where YYYYMM = '" + dateTimePicker1.Text.ToString() + "'";
                rows   = conn.ReturnRecordCount(strsql);
                if (rows > 0)
                {
                    MessageBox.Show("该月度间接人工费率已经存在!");
                }
                else if (month < -1)
                {
                    MessageBox.Show("月份错误!");
                }
                else
                {
                    strsql = "insert into COST_INDIRECT_LABOUR_LEVEL_PRICE(yyyymm,level_begin,level_end,work_type,price) select '" + ilpiform.dateTimePicker1.Text + "',level_begin,level_end,work_type,price from COST_INDIRECT_LABOUR_LEVEL_PRICE where YYYYMM = (select Max(yyyymm) from COST_INDIRECT_LABOUR_LEVEL_PRICE) ";
                    isok   = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("复制成功!");
                        InDirectLabourLevelPriceQuery.RefreshEX();
                        this.Close();
                    }
                }
                conn.Close();
            }
            //Exist();
            //ShowDetail();
        }
Exemplo n.º 4
0
 private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e)
 {
     InDirectLabourLevelPriceQuery.RefreshEX();
 }