コード例 #1
0
ファイル: CostService.cs プロジェクト: Heuvelmann/work-back
        /// <summary>
        /// 营业类型点数
        /// </summary>
        private void ImportPointSum(string month)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2, sqldel;
            int    rows;

            //string month = DateTime.Now.ToString("yyyy-MM");
            //string month = "2017-10";
            strsql = "insert into cost_pointcount_sum(cdate, saletype_id, pointcount) ";
            strsql = strsql + "select CONVERT(varchar(100), cdate, 23) as cdate, saletypeid, sum(cast(生产总点数 as decimal(18, 2)))  pointcount from ";
            strsql = strsql + "(select cdate,工单号,saletype, 装配件描述, 生产总点数 =case when saletype = 'shl' and 工单号 like '%-ws' then cast(生产总点数 as decimal(18,2))*3.56 else 生产总点数 end, saletypeid = case when(saletype = 'HCL' AND CODE2 IS null and 装配件描述 not like '【HBTG专用%') OR CODE2 = 'HCL' then 2 else 10 end from ";
            strsql = strsql + "(select cdate,工单号,saletype, 装配件描述, 生产总点数 from openquery (LINKERPNEW, 'select 日期 as cdate,工单号, organization_code as saletype,装配件描述,生产总点数  from CUX_SMT_PROD_RP where (装配件描述  not like ''%F1专用%'' and   装配件描述 not like ''%F1 TB%'') and to_char(日期,''yyyy-mm'')=''" + month + "'' ')) i ";
            strsql = strsql + "left join (select d.*, o.CODE, O2.CODE CODE2 from COST_SPECIAL_DEAL d left join cost_organization o on d.ORGANIZATION_ID = o.CID left join cost_organization o2 on d.TO_ORGANIZATION_ID = o2.CID where d.YYYYMM = '" + month + "') j ";
            strsql = strsql + "on i.装配件描述 like '%' + j.TASK_NAME + '%' and i.saletype = j.CODE) t ";
            strsql = strsql + "group by cdate, saletypeid order by cdate";

            strsql2 = "select * from cost_pointcount_sum where cdate like '%" + month + "%'";
            sqldel  = "delete from cost_pointcount_sum where cdate like '%" + month + "%'";
            rows    = conn.ReturnRecordCount(strsql2);
            if (rows > 0)
            {
                conn.EditDatabase(sqldel);
                conn.EditDatabase(strsql);
            }
            else
            {
                conn.EditDatabase(strsql);
            }
            conn.Close();
        }
コード例 #2
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql;

            strsql = "insert into COST_EXPENSE(CTYPE,TYPE_DES,CMONTH,EXPENSE,NOTE) values('" + comboBoxType.SelectedValue.ToString() + "','" + comboBoxType.Text.ToString() + "','" + dateTimePickerMonth.Text.ToString() + "','" + Common.IsNull(textEditExpense.Text.ToString().Trim()) + "','" + textEditNote.Text.ToString().Trim() + "')";
            if (textEditExpense.Text.ToString().Trim() != "")
            {
                bool isok = conn.EditDatabase(strsql);
                if (isok)
                {
                    MessageBox.Show("添加成功!");
                    TempEmpExpenseQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            else
            {
                MessageBox.Show("费用金额不能为空!");
            }
            conn.Close();
        }
コード例 #3
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";
        }
コード例 #4
0
ファイル: ShiftUpdate.cs プロジェクト: Heuvelmann/work-back
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_shift set cname = '" + textEditName.Text.ToString().Trim() + "',cbegin = '" + dateTimePickerBegin.Text + "',cend = '" + dateTimePickerEnd.Text + "',rest_hours = '" + textEditRest.Text.ToString().Trim() + "',overtime_rest_hours = '" + textEditOvertimeRest.Text.ToString().Trim() + "',overtime_begin = '" + dateTimePickerOvertimeBegin.Text.ToString() + "' where cname ='" + cname + "'";
            string sql2 = "select cname from cost_shift where cname = '" + textEditName.Text.ToString().Trim() + "'";

            if (textEditName.Text.ToString().Trim() != "")
            {
                int rows = conn.ReturnRecordCount(sql2);
                if (rows > 0 && textEditName.Text.ToString().Trim() != cname)
                {
                    MessageBox.Show("该考勤班次已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        ShiftQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
コード例 #5
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_festival set festival_date = '" + dateEditDate.Text + "',festival_type = '" + comboBoxType.SelectedValue.ToString() + "',festival_note = '" + textEditNote.Text.ToString().Trim() + "' where festival_date ='" + cdate + "'";
            string sql2 = "select * from cost_festival where festival_date = '" + dateEditDate.Text + "'";

            if (textEditNote.Text.ToString().Trim() != "")
            {
                int rows = conn.ReturnRecordCount(sql2);
                if (rows > 0 && dateEditDate.Text != cdate)
                {
                    MessageBox.Show("该日期已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        FestivalQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
コード例 #6
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_transfer(cdate,sale_type_id,transfer_type,hours) values('" + dateEditDate.Text.ToString() + "','" + Common.IsZero(comboBoxSaleType.SelectedValue.ToString()) + "','" + Common.IsZero(comboBoxTransferType.SelectedValue.ToString()) + "'," + textEditHours.Text.ToString().Trim() + ")";
            strsql2 = "select cdate from cost_transfer where cdate ='" + dateEditDate.Text.ToString() + "' and sale_type_id = " + comboBoxSaleType.SelectedValue.ToString() + " and transfer_type = " + comboBoxTransferType.SelectedValue.ToString();
            if (textEditHours.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("此转嫁工时已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        CostTransferQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("转嫁工时不能为空!");
            }
            conn.Close();
        }
コード例 #7
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_role(CNAME) values('" + textEditName.Text.ToString().Trim() + "')";
            strsql2 = "select cname from cost_role where cname = '" + textEditName.Text.ToString().Trim() + "'";
            if (textEditName.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该角色已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        RoleQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
コード例 #8
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_ems_hh_hours(cdate,hours) values('" + dateEditDate.Text.ToString() + "',ltrim(rtrim(" + textEditHours.Text.ToString() + ")))";
            strsql2 = "select cdate from cost_ems_hh_hours where cdate ='" + dateEditDate.Text.ToString() + "'";
            if (textEditHours.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("此日期产出工时已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        EmsHhHoursQuery.RefreshEX();
                    }
                }
            }
            else
            {
                MessageBox.Show("产出工时不能为空!");
            }
            conn.Close();
        }
コード例 #9
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_shift(cname,cbegin,cend,rest_hours,overtime_rest_hours,overtime_begin) values('" + textEditName.Text.ToString().Trim() + "','" + dateTimePickerBegin.Text.ToString() + "','" + dateTimePickerEnd.Text.ToString() + "','" + textEditRest.Text.ToString().Trim() + "','" + textEditOverTimeRest.Text.ToString().Trim() + "','" + dateTimePickerOvertimeBegin.Text.ToString() + "')";
            strsql2 = "select cname from cost_shift where cname = '" + textEditName.Text.ToString().Trim() + "'";
            if (textEditName.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该考勤班次已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        ShiftQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
コード例 #10
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update COST_TEMP_EMPLOYEE_price set begin_date = '" + dateTimePickerBegin.Text + "',end_date='" + dateTimePickerEnd.Text + "',price='" + Common.IsNull(textEditPrice.Text.ToString().Trim()) + "',insurance_price='" + Common.IsNull(textEditInsurance.Text.ToString().Trim()) + "'";

            sql = sql + " where cid =  '" + id + "'";
            string sql2 = "select * from cost_temp_employee_price where cid <> '" + id + "' and type = 2 and not (begin_date > '" + dateTimePickerEnd.Text.ToString() + "' or end_date <'" + dateTimePickerBegin.Text.ToString() + "')";
            int    rows = conn.ReturnRecordCount(sql2);

            if (rows > 0)
            {
                MessageBox.Show("此时间范围的记录已经存在!");
            }
            else
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    TempEmpStandardPriceQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            conn.Close();
        }
コード例 #11
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_steel_net_rate(yyyymm,steel_net_rate) values('" + dateTimePicker1.Text.ToString() + "',ltrim(rtrim(" + textEditSteelNetRate.Text.ToString() + ")))";
            strsql2 = "select yyyymm from cost_steel_net_rate where yyyymm ='" + dateTimePicker1.Text.ToString() + "'";
            if (textEditSteelNetRate.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该钢网占比已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        SteelNetRateQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("钢网占比不能为空!");
            }
            conn.Close();
        }
コード例 #12
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_saletype set cname = ltrim(rtrim('" + textEditNew.Text.ToString() + "')) where cname = ltrim(rtrim('" + textEditOld.Text.ToString() + "'))";
            string sql2 = "select cname from cost_saletype where cname = LTRIM(rtrim('" + textEditNew.Text.ToString() + "'))";

            if (textEditNew.Text.ToString().Trim() != "")
            {
                int rows = conn.ReturnRecordCount(sql2);
                if (rows > 0)
                {
                    MessageBox.Show("该营业类型已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        SaleTypeQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("新值不能为空!");
            }
            conn.Close();
        }
コード例 #13
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_product_quantity(cdate,type,product_quantity) values('" + dateEditDate.Text.ToString() + "',2," + textEditQuantity.Text.ToString().Trim() + ")";
            strsql2 = "select cdate from cost_product_quantity where cdate ='" + dateEditDate.Text.ToString() + "' and type = 2";
            if (textEditQuantity.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("此日期记录已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        ChannelQuantityQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("信道数量不能为空!");
            }
            conn.Close();
        }
コード例 #14
0
ファイル: PointCountRaw.cs プロジェクト: Heuvelmann/work-back
        private void Import()
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            //strsql = "select CONVERT(varchar(100), cdate, 23) as cdate,linetype,pointcount from openquery (LINKERP, 'select 日期 as cdate, 生产线别 as linetype,sum(生产总点数) as pointcount from CUX_SMT_PROD_RP where 工单类型 = ''正常'' and to_char(日期,''yyyy-mm'')=''" + dateTimePickerMonth.Text + "'' group by 日期, 生产线别 order by 日期')";
            strsql  = "insert into cost_pointcount(cdate,line_type_name,pointcount) select CONVERT(varchar(100), cdate, 23) as cdate,linetype,pointcount from openquery (LINKERPNEW, 'select 日期 as cdate, 生产线别 as linetype,sum(生产总点数) as pointcount from CUX_SMT_PROD_RP where  to_char(日期,''yyyy-mm'')=''" + dateTimePickerMonth.Text + "'' group by 日期, 生产线别 order by 日期')";
            strsql2 = "select * from cost_pointcount where cdate like '%" + dateTimePickerMonth.Text + "%'";
            rows    = conn.ReturnRecordCount(strsql2);
            if (rows > 0)
            {
                MessageBox.Show("该月点数已经存在,要重新导入,请先清空该月数据!");
            }
            else
            {
                bool isok = conn.EditDatabase(strsql);
                if (isok)
                {
                    MessageBox.Show("导入成功!");
                    showDetailLocal();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            conn.Close();
        }
コード例 #15
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update COST_TEMP_EMPLOYEE_price set supplier = '" + textEditSupplier.Text.ToString().Trim() + "',begin_date = '" + dateTimePickerBegin.Text + "',end_date='" + dateTimePickerEnd.Text + "',from_type='" + comboBoxType.SelectedValue.ToString() + "',price='" + Common.IsNull(textEditPrice.Text.ToString().Trim()) + "',meal_price='" + Common.IsNull(textEditMeal.Text.ToString().Trim()) + "',night_price='" + Common.IsNull(textEditNight.Text.ToString().Trim()) + "',travel_price='" + Common.IsNull(textEditTravel.Text.ToString().Trim()) + "',regular_price='" + Common.IsNull(textEditRegular.Text.ToString().Trim()) + "'";

            sql = sql + " where cid =  '" + id + "'";
            string sql2 = "select * from cost_temp_employee_price where cid <> '" + id + "' and supplier = '" + textEditSupplier.Text.ToString().Trim() + "' and not (begin_date > '" + dateTimePickerEnd.Text.ToString() + "' or end_date <'" + dateTimePickerBegin.Text.ToString() + "') and from_type = '" + comboBoxType.SelectedValue.ToString() + "' and type =1";
            int    rows = conn.ReturnRecordCount(sql2);

            if (rows > 0)
            {
                MessageBox.Show("此时间范围的价格信息已经存在!");
            }
            else
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    TempEmpPriceQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            conn.Close();
        }
コード例 #16
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update COST_EXPENSE set emp_no = '" + textEditEmpno.Text.ToString().Trim() + "',begin_date = '" + dateTimePickerDate.Text + "',expense='" + Common.IsNull(textEditPrice.Text.ToString().Trim()) + "'";

            sql = sql + " where cid =  '" + id + "'";
            string sql2 = "select * from COST_EXPENSE where cid <> '" + id + "' and emp_no = '" + textEditEmpno.Text.ToString().Trim() + "' and begin_date = '" + dateTimePickerDate.Text.ToString() + "'  and ctype =2";
            int    rows = conn.ReturnRecordCount(sql2);

            if (rows > 0)
            {
                MessageBox.Show("该员工这天的交通补贴信息已经存在!");
            }
            else
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    TempEmpTravelExpenseQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            conn.Close();
        }
コード例 #17
0
        private void simpleButtonSubmit_Click(object sender, EventArgs e)
        {
            if (ischange == true)
            {
                ConnDB conn = new ConnDB();
                string strsql;
                bool   isok = false;

                //gridView1.FocusInvalidRow();
                for (int i = 0; i < gridView1.SelectedRowsCount; i++)
                {
                    strsql = "update i set i.labour_num = " + gridView1.GetDataRow(gridView1.GetSelectedRows()[i]).ItemArray[3].ToString() + ",i.hours = " + gridView1.GetDataRow(gridView1.GetSelectedRows()[i]).ItemArray[4].ToString() + " from COST_temp_worker i where i.cid = " + gridView1.GetDataRow(gridView1.GetSelectedRows()[i]).ItemArray[0].ToString();
                    isok   = conn.EditDatabase(strsql);
                }

                if (isok)
                {
                    MessageBox.Show("提交成功!");
                    showDetail();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
                conn.Close();
                ischange = false;
            }
            else
            {
                MessageBox.Show("没有可更新的数据!");
            }
        }
コード例 #18
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2, password, log_name, person_name, dept1, dept2, dept3, dept, remark;
            int    rows;

            log_name    = textEditLogName.Text.ToString().Trim();
            password    = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim());
            person_name = textEditName.Text.ToString().Trim();
            dept1       = comboBoxDept1.Text.ToString();
            dept2       = comboBoxDept2.Text.ToString();
            dept3       = comboBoxDept3.Text.ToString();
            dept        = comboBoxDept.Text.ToString();
            remark      = textEditRemark.Text.ToString().Trim();
            if (dept1 == "请选择")
            {
                dept1 = "";
            }
            if (dept2 == "请选择")
            {
                dept2 = "";
            }
            if (dept3 == "请选择")
            {
                dept3 = "";
            }
            if (dept == "请选择")
            {
                dept = "";
            }
            strsql  = "insert into cost_user(CNAME,PASSWORD,PERSON_NAME,DEPT1,DEPT2,DEPT3,DEPT,remark) values('" + log_name + "','" + password + "','" + person_name + "','" + dept1 + "','" + dept2 + "','" + dept3 + "','" + dept + "','" + remark + "')";
            strsql2 = "select cname from cost_user where cname = '" + textEditLogName.Text.ToString().Trim() + "'";
            if (log_name != "" && textEditPsw.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该用户已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        UserQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空!");
            }
            conn.Close();
        }
コード例 #19
0
        public static void Save()
        {
            ConnDB conn = new ConnDB();
            string sql;
            bool   isok = false;

            if (ilpuform.gridView1.RowCount > 0)
            {
                ilpuform.gridView1.FocusInvalidRow();
                for (int i = 0; i < ilpuform.gridView1.RowCount; i++)
                {
                    sql  = "update cost_indirect_labour_price set price = " + ilpuform.gridView1.GetDataRow(i).ItemArray[7].ToString() + " where yyyymm = '" + ilpuform.gridView1.GetDataRow(i).ItemArray[1].ToString() + "' and work_type_id = " + ilpuform.gridView1.GetDataRow(i).ItemArray[5].ToString() + " and indirect_labour_id = " + ilpuform.gridView1.GetDataRow(i).ItemArray[0].ToString();
                    isok = conn.EditDatabase(sql);
                }
            }
            if (isok)
            {
                MessageBox.Show("修改成功!");
                IndirectLabourPriceQuery.RefreshEX();
                ilpuform.Close();
            }
            else
            {
                MessageBox.Show("失败!");
            }
            ilpuform.ischange = false;
            conn.Close();
            ilpuform.Close();
            IndirectLabourPrice.savetype = "insert";
        }
コード例 #20
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_festival(festival_date,festival_type,festival_note) values('" + dateTimePickerDate.Text.ToString() + "','" + comboBoxType.SelectedValue.ToString() + "','" + textEditNote.Text.ToString().Trim() + "')";
            strsql2 = "select * from cost_festival where festival_date = '" + dateTimePickerDate.Text.ToString() + "'";
            if (textEditNote.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该日期已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        FestivalQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空!");
            }
            conn.Close();
        }
コード例 #21
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;
                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.Exist())
                {
                    if (month < 0)
                    {
                        MessageBox.Show("不能新增以后的月份!");
                    }
                    else
                    {
                        strsql = "insert into cost_indirect_labour_price(yyyymm,indirect_labour_id,work_type_id,price) select '" + ilpiform.dateTimePicker1.Text + "',indirect_labour_id,work_type_id,price from cost_indirect_labour_price where YYYYMM = (select Max(yyyymm) from cost_indirect_labour_price) ";
                        isok   = conn.EditDatabase(strsql);
                        if (isok)
                        {
                            MessageBox.Show("复制成功!");
                            IndirectLabourPriceQuery.RefreshEX();
                            this.Close();
                        }
                    }
                }
                conn.Close();
            }
        }
コード例 #22
0
ファイル: UserPassReset.cs プロジェクト: Heuvelmann/work-back
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string password;

            password = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim());
            string sql = "update cost_user set password ='******' where cid = " + textEditID.Text.ToString();
            if (textEditLogName.Text.ToString().Trim() != "" && textEditPsw.Text.ToString().Trim() != "")
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    UserQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            else
            {
                MessageBox.Show("登录名和密码不能为空值!");
            }
            conn.Close();
        }
コード例 #23
0
        private void Clear()
        {
            ConnDB conn = new ConnDB();
            string strsql;

            strsql = "delete from COST_DIRECT_LABOUR";
            conn.EditDatabase(strsql);
            conn.Close();
        }
コード例 #24
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2, log_name, dept1, dept2, dept3;
            int    rows;

            log_name = textEditLogName.Text.ToString().Trim();
            dept1    = comboBoxDept1.Text.ToString();
            dept2    = comboBoxDept2.Text.ToString();
            dept3    = comboBoxDept3.Text.ToString();
            if (dept1 == "请选择")
            {
                dept1 = "";
            }
            if (dept2 == "请选择")
            {
                dept2 = "";
            }
            if (dept3 == "请选择")
            {
                dept3 = "";
            }

            strsql  = "insert into cost_check_dept(log_name,DEPT1,DEPT2,DEPT3) values('" + log_name + "','" + dept1 + "','" + dept2 + "','" + dept3 + "')";
            strsql2 = "select * from cost_check_dept where log_name = '" + log_name + "' and dept1 = '" + dept1 + "' and dept2 = '" + dept2 + "' and dept3 ='" + dept3 + "'";
            if (log_name != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该记录已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        UserDeptCheckQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空!");
            }
            conn.Close();
        }
コード例 #25
0
ファイル: TempEmpClose.cs プロジェクト: Heuvelmann/work-back
        private void simpleButtonOpen_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql;
            string month = dateTimePickerMonth.Text.ToString();

            sql = "update i set i.closed = 0 from  COST_TEMP_CLOSE i where cmonth = '" + month + "'";
            simpleButtonClose.Enabled = true;
            simpleButtonOpen.Enabled  = false;
            conn.EditDatabase(sql);
            conn.Close();
        }
コード例 #26
0
        /// <summary>
        /// 从System.Data.DataTable导入数据到数据库
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        private int UpdateData(DataTable dt)
        {
            int    i = 0;
            string cno = "", dept2 = "", dept3 = "", dept = "", leave_date = "", shift = "", status = "", sql = "";
            ConnDB conn = new ConnDB();
            bool   err  = false;

            foreach (DataRow dr in dt.Rows)
            {
                if (dr["临时工号"].ToString().Trim() == null || dr["临时工号"].ToString().Trim() == "")
                {
                    MessageBox.Show("临时工号格式有错误!");
                    err = true;
                    break;
                }
                sql = "select * from COST_SHIFT where cname = '" + dr["班次"].ToString().Trim() + "'";
                int count = conn.ReturnRecordCount(sql);
                if (count == 0)
                {
                    string msg = "班次:" + dr["班次"].ToString().Trim() + ",与考勤班次中现有的班次格式不一致!";
                    MessageBox.Show(msg);
                    err = true;
                    break;
                }
            }
            if (!err)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    cno        = dr["临时工号"].ToString().Trim();
                    dept2      = dr["二级部门"].ToString().Trim();
                    dept3      = dr["三级部门"].ToString().Trim();
                    dept       = dr["部门"].ToString().Trim();
                    leave_date = dr["离职日期"].ToString().Trim();
                    shift      = dr["班次"].ToString().Trim();
                    status     = dr["状态"].ToString().Trim();
                    if (leave_date == "")
                    {
                        sql = "update i set i.leave_date = NULL,i.dept2 = '" + dept2 + "',i.dept3 = '" + dept3 + "',i.dept = '" + dept + "',i.shift = '" + shift + "',i.status = '" + status + "' from cost_temp_employee i where cno = '" + cno + "'";
                    }
                    else
                    {
                        sql = "update i set i.leave_date = '" + leave_date + "',i.dept2 = '" + dept2 + "',i.dept3 = '" + dept3 + "',i.dept = '" + dept + "',i.shift = '" + shift + "',i.status = '" + status + "' from cost_temp_employee i where cno = '" + cno + "'";
                    }

                    conn.EditDatabase(sql);
                    i++;
                }
            }
            conn.Close();
            return(i);
        }
コード例 #27
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();
     }
 }
コード例 #28
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string dept1, dept2, dept3, dept, remark;

            dept1  = comboBoxDept1.Text;
            dept2  = comboBoxDept2.Text;
            dept3  = comboBoxDept3.Text;
            dept   = comboBoxDept.Text;
            remark = textEditRemark.Text.ToString().Trim();

            if (dept1 == "请选择")
            {
                dept1 = "";
            }
            if (dept2 == "请选择")
            {
                dept2 = "";
            }
            if (dept3 == "请选择")
            {
                dept3 = "";
            }
            if (dept == "请选择")
            {
                dept = "";
            }
            string sql = "update cost_user set cname ='" + textEditLogName.Text.ToString().Trim() + "',person_name ='" + textEditName.Text.ToString().Trim() + "',dept1 ='" + dept1 + "',dept2 ='" + dept2 + "',dept3 ='" + dept3 + "',dept ='" + dept + "',remark ='" + remark;

            sql = sql + "' where cid = " + textEditID.Text.ToString();
            // string sql2 = "select cname from cost_user where cname = '" + textEditLogName.Text.ToString().Trim() + "' and password ='******'";
            if (textEditLogName.Text.ToString().Trim() != "")
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    UserQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            else
            {
                MessageBox.Show("登录名不能为空值!");
            }
            conn.Close();
        }
コード例 #29
0
ファイル: UserRole.cs プロジェクト: Heuvelmann/work-back
        private void simpleButtonSubmit_Click(object sender, EventArgs e)
        {
            if (ischange == true)
            {
                ConnDB conn = new ConnDB();
                string strsql;
                string logname = "", personname = "", dept1 = "", dept2 = "", dept3 = "", dept = "", remark = "";
                int    cid = 0;
                UserQuery.GetInfo(ref cid, ref logname, ref personname, ref dept1, ref dept2, ref dept3, ref dept, ref remark);
                string sql = "insert into COST_user_role select i.cid,p.cid,'false' from COST_user i cross join COST_role p left join COST_user_role r on i.CID = r.user_ID and p.CID = r.role_ID where i.cid = " + cid + " and r.user_id is null";
                conn.EditDatabase(sql);
                bool isok = false;

                //gridView1.FocusInvalidRow();
                for (int i = 0; i < gridView1.RowCount; i++)
                {
                    strsql = "update i set i.have_right = '" + gridView1.GetDataRow(i).ItemArray[3].ToString() + "' from COST_user_role i where i.user_ID = " + gridView1.GetDataRow(i).ItemArray[0].ToString() + " and i.role_ID = " + gridView1.GetDataRow(i).ItemArray[1].ToString();
                    isok   = conn.EditDatabase(strsql);
                }

                if (isok)
                {
                    MessageBox.Show("提交成功!");
                    showDetail();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
                conn.Close();
                ischange = false;
            }
            else
            {
                MessageBox.Show("没有可更新的数据!");
            }
        }
コード例 #30
0
ファイル: CostService.cs プロジェクト: Heuvelmann/work-back
        /// <summary>
        /// 拉别点数
        /// </summary>
        private void ImportPointRaw(string month)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2, sqldel;
            int    rows;

            //string month = DateTime.Now.ToString("yyyy-MM");
            //string month = "2017-10";
            strsql  = "insert into cost_pointcount(cdate,line_type_name,pointcount) select CONVERT(varchar(100), cdate, 23) as cdate,linetype,pointcount from openquery (LINKERPNEW, 'select 日期 as cdate, 生产线别 as linetype,sum(生产总点数) as pointcount from CUX_SMT_PROD_RP where  to_char(日期,''yyyy-mm'')=''" + month + "'' group by 日期, 生产线别 order by 日期')";
            strsql2 = "select * from cost_pointcount where cdate like '%" + month + "%'";
            sqldel  = "delete from cost_pointcount where cdate like '%" + month + "%'";
            rows    = conn.ReturnRecordCount(strsql2);
            if (rows > 0)
            {
                conn.EditDatabase(sqldel);
                conn.EditDatabase(strsql);
            }
            else
            {
                conn.EditDatabase(strsql);
            }
            conn.Close();
        }