//保存设置 private void btnSet_Click(object sender, EventArgs e) { if (OperateSetFee == string.Empty) { return; } string SetInfoSql = string.Empty; DataRowView dr = (DataRowView)cbk.GetSelectedRow(0); string UnitType = decimal.Parse(dr["克工费"].ToString()) != 0 ? "Weight" : "Amount"; for (int j = 5; j < this.gridVMain.Columns.Count - 1; j++) { for (int i = 0; i < gridVMain.RowCount; i++) { if (i == gridVMain.RowCount - 1) { SetInfoSql = SetInfoSql + "SELECT '" + gridVMain.GetDataRow(i)[0].ToString() + "', '" + Operate + "','" + this.gridVMain.Columns[j].FieldName + "','" + this.gridVMain.GetDataRow(i)[1].ToString() + "','" + gridVMain.GetDataRow(i)[2].ToString() + "', '" + gridVMain.GetDataRow(i)[3].ToString() + "','" + gridVMain.GetDataRow(i)[4].ToString() + "','" + OperateSetFee + "','" + gridVMain.GetDataRow(i)[5].ToString() + "'"; string[] strKey = "EUser_Id,EDept_Id,Fy_Id,COL_SQL_MAX,Flag".Split(",".ToCharArray()); string[] strVal = new string[] { CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), SetInfoSql, "4" }; DataTable dt = this.DataRequest_By_DataTable(strSpName, strKey, strVal); if (dt != null && dt.Rows[0][0].ToString() == "OK") { SetInfoSql = string.Empty; } } else { if (cbk.IsRowSelected(i) == true) { SetInfoSql = SetInfoSql + "SELECT '" + gridVMain.GetDataRow(i)[0].ToString() + "', '" + Operate + "','" + this.gridVMain.Columns[j].FieldName + "','" + this.gridVMain.GetDataRow(i)[1].ToString() + "','" + gridVMain.GetDataRow(i)[2].ToString() + "', '" + gridVMain.GetDataRow(i)[3].ToString() + "','" + gridVMain.GetDataRow(i)[4].ToString() + "','" + OperateSetFee + "','" + gridVMain.GetDataRow(i)[5].ToString() + "' UNION ALL "; } } } } MessageBox.Show("特殊工费设置成功"); }
//设置 private void btnSet_Click(object sender, EventArgs e) { if (txtCost.Text.Trim().Length == 0) { MessageBox.Show("输入修改后的基础销售工费"); return; } if (cbk.SelectedCount == 0) { MessageBox.Show("请选择要修改的款式"); return; } string Pm_Ids = cbk.GetKeyIds("PM_Id"); string[] strKey = "EUser_Id,EDept_Id,Fy_Id,WeightFee,AmoutFee,UnitType,Key_Ids,Flag".Split(",".ToCharArray()); string[] strVal = new string[] { CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), txtCost.Text.Trim(), txtCost.Text.Trim(), cboUnitFee.SelectedIndex.ToString().Trim(), Pm_Ids, "202" }; DataSet dsUpdate = this.DataRequest_By_DataSet(strSpName, strKey, strVal); if (dsUpdate.Tables[0].Rows[0][0].ToString() == "OK") { for (int i = 0; i < gridVMain.RowCount; i++) { if (cbk.IsRowSelected(i)) { if (cboUnitFee.SelectedIndex.ToString().Trim() == "0") { gridVMain.SetRowCellValue(i, "WeightFee", txtCost.Text.Trim()); } else { gridVMain.SetRowCellValue(i, "AmoutFee", txtCost.Text.Trim()); } } } } cbk.ClearSelection(); MessageBox.Show("设置成功"); txtCost.Text = string.Empty; }
private void btnSet_Click(object sender, EventArgs e) { if (txtMergePNumber.Text.Trim().Length == 0) { MessageBox.Show("请输入合并后的款号"); txtMergePNumber.Focus(); return; } if (cbk.SelectedCount == 0) { MessageBox.Show("请选择要修改的款式"); return; } string Pm_Ids = cbk.GetKeyIds("PM_Id"); string[] strKey = "EUser_Id,EDept_Id,Fy_Id,MergePNumber,Key_Ids,flag".Split(",".ToCharArray()); string[] strVal = new string[] { CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), txtMergePNumber.Text.Trim(), Pm_Ids, "101" }; DataSet ds = this.DataRequest_By_DataSet(strSpName, strKey, strVal); if (ds.Tables[0].Rows[0][0].ToString() == "OK") { for (int i = 0; i < gridView1.RowCount; i++) { if (cbk.IsRowSelected(i)) { gridView1.SetRowCellValue(i, "MergePNumber", txtMergePNumber.Text.Trim()); } } } cbk.ClearSelection(); MessageBox.Show("合并成功"); txtMergePNumber.Text = string.Empty; }