private void setButtonLabel(string taskEntryID, string publisher) { Button[] buttonArray = new Button[] { this.buttonEstimate, this.buttonPlanning, this.buttonOsDetail }; string[] buttonLabelArray = new string[] { "見積書 ", "予算書 ", "外注内訳書 " }; string[] selectTableArray = new string[] { "D_Estimate", "D_Planning", "D_Outsource" }; /***** 各ボタンに現在の最新版数表示 *****/ string verNo; string wParam; DataTable dt; SqlHandling sh; for (int i = 0; i < buttonLabelArray.Length; i++) { sh = new SqlHandling(selectTableArray[i]); wParam = " WHERE TaskEntryID = '" + taskEntryID + "' AND OfficeCode = '" + Convert.ToString(comboBoxOffice.SelectedValue) + "' AND Department = '" + Convert.ToString(comboBoxDepartment.SelectedValue) + "'"; dt = sh.SelectAllData(wParam); if (dt == null) { verNo = "(0)"; } else { DataRow dataRow = dt.Rows[0]; verNo = "(" + Convert.ToString(dataRow["VersionNo"]) + ")"; } buttonArray[i].Text = buttonLabelArray[i] + verNo; } }
private bool checkMembers() { // 社員マスタ SqlHandling sh = new SqlHandling("M_Members"); DataTable dt = sh.SelectAllData(" WHERE MemberCode = '" + textBoxMemberCode.Text + "'"); if (dt == null) { labelMessage.Text = "該当する社員番号がありません。再入力してください!"; labelMessage.ForeColor = Color.Red; return(false); } DataRow dr = dt.Rows[0]; hp.MemberType = Convert.ToInt32(dr["MemberType"]); hp.Enrollment = Convert.ToInt32(dr["Enrollment"]); if (hp.Enrollment == 0) { hp.MemberCode = Convert.ToString(dr["MemberCode"]); hp.MemberName = Convert.ToString(dr["Name"]); hp.OfficeCode = Convert.ToString(dr["OfficeCode"]); hp.Department = Convert.ToString(dr["Department"]); hp.AccessLevel = Convert.ToInt32(dr["AccessLevel"]); } else { labelMessage.Text = "操作未承認です。[取消]をクリックしてください。"; labelMessage.ForeColor = Color.Red; return(false); } return(true); }
private DataTable takeCostMasterTable() { SqlHandling sh = new SqlHandling("M_Cost"); DataTable dt = sh.SelectAllData("WHERE OfficeCode = '" + Convert.ToString(comboBoxOffice.SelectedValue) + "'"); return(dt); }
private DataTable takeTaskIndDataTable() { SqlHandling sh = new SqlHandling("D_TaskInd"); DataTable dt = sh.SelectAllData("WHERE OldverMark = 0 AND IssueMark = 0 AND OfficeCode = '" + Convert.ToString(comboBoxOffice.SelectedValue) + "'"); return(dt); }
private string[] edit_ComboBoxValueItem(int vidx, string[] vItem) { string[] dItem = new string[vItem.Length]; SqlHandling sh = new SqlHandling(cif.DITableArray[vidx]); string sqlStr = " WHERE " + cif.DItmKeyArray[vidx] + " = '"; string sqlStrOfficeCode = ""; if (vidx == 1 || vidx == 3)//業務コードと原価項目の場合、部署コードを条件に追加 { sqlStrOfficeCode = " AND OfficeCode = '" + comboBoxOffice.SelectedValue.ToString() + "'"; } DataTable dt; DataRow dr; string Item = ""; for (int i = 0; i < vItem.Length; i++) { Item = vItem[i].Trim(); dt = sh.SelectAllData(sqlStr + Item + "'" + sqlStrOfficeCode); if ((dt != null) && (dt.Rows.Count > 0)) { dr = dt.Rows[0]; dItem[i] = Convert.ToString(dr[cif.DItmNamArray[vidx]]); } } return(dItem); }
private bool dispCostMaster(DataGridViewRow dgvRow, string costCode, string officeCode) { SqlHandling sql = new SqlHandling("M_Cost"); DataTable dt; if ((dt = sql.SelectAllData("WHERE CostCode = '" + costCode + "' AND OfficeCode = '" + officeCode + "'")) == null) { return(false); } DataRow dr = dt.Rows[0]; CostData cmds = new CostData(dr); loadCostMasterData(dgvRow, cmds); return(true); }
private bool checkOffice() { // 事業所マスタ SqlHandling sh = new SqlHandling("M_Office"); DataTable dt = sh.SelectAllData(" WHERE OfficeCode = '" + hp.OfficeCode + "'"); if (dt == null) { labelMessage.Text = "事業所マスタの読み込みができません!"; labelMessage.ForeColor = Color.Red; return(false); } DataRow dr = dt.Rows[0]; hp.OfficeName = Convert.ToString(dr["OfficeName"]); return(true); }
private void viewPlanningContSummary() { decimal qty = 0; decimal direct = 0; decimal outs = 0; decimal matel = 0; SqlHandling sql = new SqlHandling("D_PlanningCont"); DataTable dt; DataRow dr; for (int i = 0; i < plnd.Length; i++) { if (plnd[i] == null) { break; } if (plnd[i].PlanningID == 0) { break; } dt = sql.SelectAllData("WHERE PlanningID = " + plnd[i].PlanningID); if (dt == null) { return; } direct = 0; outs = 0; matel = 0; for (int j = 0; j < dt.Rows.Count; j++) { dr = dt.Rows[j]; qty = Convert.ToDecimal(dr["Quantity"]); direct += Convert.ToDecimal(dr["Cost0"]) * qty; outs += Convert.ToDecimal(dr["Cost1"]) * qty; matel += Convert.ToDecimal(dr["Cost2"]) * qty; } } return; }
private bool dispTaskInformation(string taskCode) { ListFormDataOp lo = new ListFormDataOp(); TaskCodeNameData tcnd = lo.SelectTaskCodeNameData(taskCode, Convert.ToString(comboBoxOffice.SelectedValue)); TaskData td = lo.SelectTaskData(taskCode); if (td == null) { return(false); } textBoxTaskName.Text = td.TaskName; labelTaskPlace.Text = td.TaskPlace; labelStartDate.Text = (td.StartDate.StripTime()).ToString("yyyy年MM月dd日"); labelEndDate.Text = (td.EndDate.StripTime()).ToString("yyyy年MM月dd日"); labelSalesMCode.Text = td.SalesMCode; DataTable dt; DataRow dr; SqlHandling sql; if (td.PartnerCode != null) { sql = new SqlHandling("M_Partners"); if ((dt = sql.SelectAllData("WHERE PartnerCode = '" + td.PartnerCode + "'")) != null) { dr = dt.Rows[0]; labelPartnerName.Text = Convert.ToString(dr["PartnerName"]); labelPartnerCode.Text = Convert.ToString(dr["PartnerCode"]); } } // 20190302 asakawa // add start labelLeaderMName.Text = ""; labelSalesMName.Text = ""; // add end //if (tcnd.LeaderMCode != null && tcnd.LeaderMCode != " ") if (tcnd != null && tcnd.LeaderMCode != null && tcnd.LeaderMCode != " ") { sql = new SqlHandling("M_Members"); if ((dt = sql.SelectAllData("WHERE MemberCode = '" + tcnd.LeaderMCode + "'")) != null) { dr = dt.Rows[0]; labelLeaderMName.Text = Convert.ToString(dr["Name"]); labelLeaderMCode.Text = tcnd.LeaderMCode; } } if (td.SalesMCode != " ") { sql = new SqlHandling("M_Members"); if ((dt = sql.SelectAllData("WHERE MemberCode = '" + td.SalesMCode + "'")) != null) { dr = dt.Rows[0]; labelSalesMName.Text = Convert.ToString(dr["Name"]); } } return(true); }
private bool checkCommon() { // 共通マスタ SqlHandling sh = new SqlHandling("M_Common"); DataTable dt = sh.SelectAllData(" WHERE Kind = 'DEPT' AND ComSymbol = '" + hp.Department + "'"); if (dt == null) { commonSelectError(); return(false); } DataRow dr = dt.Rows[0]; hp.DepartName = Convert.ToString(dr["ComData"]); // 共通データを保持して画面遷移 if (hp.OfficeCode != "H") { hp.DepartName = "技術"; } string[] kindArray = new string[] { "TAX", "ADM", "OTH", "EXP" }; for (int i = 0; i < kindArray.Length; i++) { dt = sh.SelectAllData(" WHERE Kind = '" + kindArray[i] + "'"); if (dt == null) { commonSelectError(); return(false); } dr = dt.Rows[0]; if (i == 0) { hp.TaxRate = Convert.ToDecimal(dr["ComData"]) / 1000; } if (i == 1) { hp.AdminCostRate = Convert.ToDecimal(dr["ComData"]) / 1000; } if (i == 2) { hp.OthersCostRate = Convert.ToDecimal(dr["ComData"]) / 1000; } if (i == 3) { hp.Expenses = Convert.ToDecimal(dr["ComData"]) / 1000; } } // 最新締め月 dt = sh.SelectAllData(" WHERE Kind LIKE 'CLS%'"); if (dt == null) { commonSelectError(); return(false); } for (int i = 0; i < dt.Rows.Count; i++) { dr = dt.Rows[i]; switch (Convert.ToString(dr["Kind"])) { case "CLSH": hp.CloseHDate = Convert.ToDateTime(dr["ComData"]); break; case "CLSK": hp.CloseKDate = Convert.ToDateTime(dr["ComData"]); break; case "CLSS": hp.CloseSDate = Convert.ToDateTime(dr["ComData"]); break; case "CLST": hp.CloseTDate = Convert.ToDateTime(dr["ComData"]); break; default: break; } } return(true); }