/// <summary> /// binds treeview with line def reason details /// </summary> private void BindTreeView() { LineVo lineInVo = new LineVo(); if (Line_cmb.SelectedIndex > -1) { lineInVo.LineId = Convert.ToInt32(Line_cmb.SelectedValue); } LineVo lineOutVo = new LineVo(); try { lineOutVo = (LineVo)base.InvokeCbm(new GetLineMasterMntCbm(), lineInVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); Logger.Error(exception.GetMessageData()); return; } string message = string.Format(Properties.Resources.mmci00009); StartProgress(message); PopulateTreeView(lineOutVo.LineListVo); CompleteProgress(); }
public ValueObject Execute(TransactionContext trxContext, ValueObject vo) { List <ValueObject> inList = ((ValueObjectList <ValueObject>)vo).GetList(); LineVo lineInVo = (LineVo)inList.FirstOrDefault(); ProcessWorkLineVo processWorkLineInVo = (ProcessWorkLineVo)inList.Skip(1).FirstOrDefault(); LineVo lineOutVo = (LineVo)updateLineMasterMntCbm.Execute(trxContext, lineInVo); if (lineOutVo.AffectedCount > 0) { ProcessWorkLineVo deleteInVo = new ProcessWorkLineVo(); deleteInVo.LineId = lineInVo.LineId; ProcessWorkLineVo deleteOutVo = (ProcessWorkLineVo)deleteProcessWorkLineMasterMntCbm.Execute(trxContext, deleteInVo); foreach (ProcessWorkLineVo curInVo in processWorkLineInVo.ProcessWorkLineListVo) { curInVo.LineId = lineInVo.LineId; ProcessWorkLineVo processWorkLineOutVo = (ProcessWorkLineVo)addProcessWorkLineMasterMntCbm.Execute(trxContext, curInVo); } } return(lineOutVo); }
/// <summary> /// selects user record for updation and show Line form /// </summary> private void BindUpdateLineData() { int selectedrowindex = LineDetails_dgv.SelectedCells[0].RowIndex; LineVo selectedLine = (LineVo)LineDetails_dgv.Rows[selectedrowindex].DataBoundItem; AddLineRestTimeForm newAddForm = new AddLineRestTimeForm(CommonConstants.MODE_UPDATE, selectedLine); newAddForm.ShowDialog(this); if (newAddForm.IntSuccess > 0) { messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } else if (newAddForm.IntSuccess == 0) { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { LineVo inVo = (LineVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <LineVo> voList = new ValueObjectList <LineVo>(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append(@"SELECT b.line_id, b.line_cd from m_line b, m_ncvp_model_line a where a.line_id = b.line_id and model_id = :model_id order by line_id"); sqlParameter.AddParameterInteger("model_id", inVo.LineId); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { LineVo outVo = new LineVo { LineId = int.Parse(dataReader["line_id"].ToString()), LineCode = dataReader["line_cd"].ToString() }; voList.add(outVo); } dataReader.Close(); return(voList); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { LineVo inVo = (LineVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Delete From m_line"); sqlQuery.Append(" Where "); sqlQuery.Append(" line_id = :lineid "); sqlQuery.Append(" and factory_cd = :faccd ;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("lineid", inVo.LineId); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); LineVo outVo = new LineVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { LineVo inVo = (LineVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Update m_line"); sqlQuery.Append(" Set "); sqlQuery.Append(" line_name = :linename "); sqlQuery.Append(" Where "); sqlQuery.Append(" line_id = :lineid ;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("lineid", inVo.LineId); sqlParameter.AddParameterString("linename", inVo.LineName); LineVo outVo = new LineVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public ValueObject Execute(TransactionContext trxContext, ValueObject vo) { List <ValueObject> inList = ((ValueObjectList <ValueObject>)vo).GetList(); LineVo lineInVo = (LineVo)inList.FirstOrDefault(); ProcessWorkLineVo processWorkLineInVo = (ProcessWorkLineVo)inList.Skip(1).FirstOrDefault(); LineVo lineOutVo = (LineVo)addLineMasterMntCbm.Execute(trxContext, lineInVo); int count = 0; if (lineOutVo != null && lineOutVo.LineId > 0) { count += 1; foreach (ProcessWorkLineVo curInVo in processWorkLineInVo.ProcessWorkLineListVo) { curInVo.LineId = lineOutVo.LineId; ProcessWorkLineVo processWorkLineOutVo = (ProcessWorkLineVo)addProcessWorkLineMasterMntCbm.Execute(trxContext, curInVo); } } lineOutVo.AffectedCount = count; return(lineOutVo); }
/// <summary> /// Fills all user records to gridview control /// </summary> private void GridBind(LineVo conditionInVo) { LineDetails_dgv.DataSource = null; try { LineVo outVo = (LineVo)base.InvokeCbm(new GetLineMasterMntCbm(), conditionInVo, false); LineDetails_dgv.AutoGenerateColumns = false; BindingSource lineBindingSource = new BindingSource(outVo.LineListVo, null); if (lineBindingSource.Count > 0) { LineDetails_dgv.DataSource = lineBindingSource; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } LineDetails_dgv.ClearSelection(); Update_btn.Enabled = false; Delete_btn.Enabled = false; } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }
/// <summary> /// For setting selected Line record into respective controls(textbox and combobox) for update operation /// passing selected Line data as parameter /// </summary> /// <param name="dgvLine"></param> private void LoadLineData(LineVo dgvLine) { if (dgvLine != null) { this.LineCode_txt.Text = dgvLine.LineCode; this.LineName_txt.Text = dgvLine.LineName; } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { LineVo inVo = (LineVo)arg; LineVo outVo = new LineVo(); StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Select * from m_line "); sqlQuery.Append(" where 1 = 1 "); if (inVo.LineCode != null) { sqlQuery.Append(" and line_cd like :linecd "); } if (inVo.LineName != null) { sqlQuery.Append(" and line_name like :linename "); } sqlQuery.Append(" order by line_name"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); if (inVo.LineCode != null) { sqlParameter.AddParameterString("linecd", inVo.LineCode + "%"); } if (inVo.LineName != null) { sqlParameter.AddParameterString("linename", inVo.LineName + "%"); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { LineVo currOutVo = new LineVo { LineId = Convert.ToInt32(dataReader["line_id"]), LineCode = dataReader["line_cd"].ToString(), LineName = dataReader["line_name"].ToString(), }; outVo.LineListVo.Add(currOutVo); } dataReader.Close(); return(outVo); }
/// <summary> /// constructor /// </summary> /// <param name="pmode"></param> /// <param name="LineItem"></param> public AddLineMasterForm(string pmode, LineVo LineItem = null) { InitializeComponent(); mode = pmode; updateData = LineItem; if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { this.Text = UpdateText_lbl.Text; } }
/// <summary> /// event to delete the selected record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Delete_btn_Click(object sender, EventArgs e) { if (isExcelUpload) { return; } int selectedrowindex = LineDetails_dgv.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = LineDetails_dgv.Rows[selectedrowindex]; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colLineName"].Value.ToString()); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { LineVo inVo = new LineVo { LineId = Convert.ToInt32(selectedRow.Cells["colLineId"].Value) }; try { LineVo outVo = (LineVo)base.InvokeCbm(new DeleteLineMasterAndProcessworkCbm(), inVo, false); if (outVo.AffectedCount > 0) { messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } else if (outVo.AffectedCount == 0) { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } } else if (dialogResult == DialogResult.Cancel) { //do something else } }
public ValueObject Execute(TransactionContext trxContext, ValueObject vo) { LineVo deleteLineOutVo = (LineVo)deleteLineMasterMntCbm.Execute(trxContext, vo); if (deleteLineOutVo.AffectedCount > 0) { ProcessWorkLineVo inVo = new ProcessWorkLineVo(); inVo.LineId = ((LineVo)vo).LineId; ProcessWorkLineVo deleteProcessWorkLineOutVo = (ProcessWorkLineVo)deleteProcessWorkLineMasterMntCbm.Execute(trxContext, inVo); } return(deleteLineOutVo); }
/// <summary> /// Check for duplicate /// </summary> /// <returns></returns> private LineVo DuplicateCheck(LineVo pLineVo) { LineVo outVo = new LineVo(); try { outVo = (LineVo)base.InvokeCbm(new CheckLineMasterMntCbm(), pLineVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } return(outVo); }
/// <summary> /// Creates seacrh condition as per user inputs /// </summary> /// <returns>search condition</returns> private LineVo FormConditionVo() { LineVo inVo = new LineVo(); if (LineCode_txt.Text != string.Empty) { inVo.LineCode = LineCode_txt.Text; } if (LineName_txt.Text != string.Empty) { inVo.LineName = LineName_txt.Text; } return(inVo); }
private void LoadLine() { LineVo outVo = new LineVo(); try { outVo = (LineVo)base.InvokeCbm(new GetLineMasterMntCbm(), new LineVo(), false); outVo.LineListVo.ForEach(p => p.LineName = p.LineCode + " " + p.LineName); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } ComboBind(Line_cmb, outVo.LineListVo, "LineName", "LineId"); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { LineVo inVo = (LineVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Insert into m_line"); sqlQuery.Append(" ( "); sqlQuery.Append(" line_cd, "); sqlQuery.Append(" line_name, "); sqlQuery.Append(" registration_user_cd, "); sqlQuery.Append(" registration_date_time, "); sqlQuery.Append(" factory_cd "); sqlQuery.Append(" ) "); sqlQuery.Append("VALUES "); sqlQuery.Append(" ( "); sqlQuery.Append(" :linecd ,"); sqlQuery.Append(" :linename ,"); sqlQuery.Append(" :registrationusercode ,"); sqlQuery.Append(" :registrationdatetime ,"); sqlQuery.Append(" :factorycode "); sqlQuery.Append(" ) "); sqlQuery.Append(" RETURNING line_id;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("linecd", inVo.LineCode); sqlParameter.AddParameterString("linename", inVo.LineName); sqlParameter.AddParameterString("registrationusercode", UserData.GetUserData().UserCode); sqlParameter.AddParameterDateTime("registrationdatetime", trxContext.ProcessingDBDateTime); sqlParameter.AddParameterString("factorycode", UserData.GetUserData().FactoryCode); LineVo outVo = new LineVo(); outVo.LineId = (int?)sqlCommandAdapter.ExecuteScalar(sqlParameter) ?? 0; return(outVo); }
private void GetLineInfomation() { LineVo lineinVo = new LineVo(); LineVo lineoutVo = new LineVo(); lineinVo.FactoryCode = UserData.GetUserData().FactoryCode; try { lineoutVo = (LineVo)DefaultCbmInvoker.Invoke(new GetLineMasterMntCbm(), lineinVo); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } if (lineoutVo != null && lineoutVo.LineListVo.Count > 0) { ComboBind(Line_cmb, lineoutVo.LineListVo, "LineName", "LineId"); } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { LineVo inVo = (LineVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Select Count(*) as LineCount from m_line "); sqlQuery.Append(" where factory_cd = :faccd "); if (inVo.LineCode != null) { sqlQuery.Append(" and UPPER(line_cd) = UPPER(:linecd)"); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); if (inVo.LineCode != null) { sqlParameter.AddParameterString("linecd", inVo.LineCode); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); LineVo outVo = new LineVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["LineCount"]); } dataReader.Close(); return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { LineVo inVo = (LineVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Insert into m_line"); sqlQuery.Append(" ( "); sqlQuery.Append(" line_cd, "); sqlQuery.Append(" line_name, "); sqlQuery.Append(" registration_user_cd, "); sqlQuery.Append(" registration_date_time, "); sqlQuery.Append(" factory_cd "); sqlQuery.Append(" ) "); sqlQuery.Append("VALUES "); sqlQuery.Append(" ( "); sqlQuery.Append(" :linecd ,"); sqlQuery.Append(" :linename ,"); sqlQuery.Append(" :registrationusercode ,"); sqlQuery.Append(" now() ,"); sqlQuery.Append(" :factorycode "); sqlQuery.Append(" ); "); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("linecd", inVo.LineCode); sqlParameter.AddParameterString("linename", inVo.LineName); sqlParameter.AddParameterString("registrationusercode", inVo.RegistrationUserCode); //sqlParameter.AddParameterDateTime("registrationdatetime", inVo.RegistrationDateTime); sqlParameter.AddParameterString("factorycode", inVo.FactoryCode); LineVo outVo = new LineVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
private void ModelLineMasterForm_Load(object sender, EventArgs e) { try { LineVo linevo = (LineVo)DefaultCbmInvoker.Invoke(getLineMasterMntCbm, new LineVo()); ValueObjectList <ModelVo> modellist = (ValueObjectList <ModelVo>)DefaultCbmInvoker.Invoke(getModelCbm, new ModelVo()); modelname_cmb.DisplayMember = "ModelName"; modelname_cmb.DataSource = modellist.GetList(); modelname_cmb.SelectedIndex = -1; foreach (LineVo vo in linevo.LineListVo) { modeline.Add(new ModelLine { mvo = vo, Selected = false, ModelLineId = 0 }); } BindingSource bds = new BindingSource(modeline, null); Model_dgv.DataSource = bds; } catch { } //gfg }
private void LoadLineListBox() { LineVo outMVo = (LineVo)DefaultCbmInvoker.Invoke(new GetLineMasterMntCbm(), new LineVo()); outMVo.LineListVo.ForEach(l => l.LineName = l.LineCode + " " + l.LineName); if (outMVo.LineListVo.Count > 0) { Line_chlst.DataSource = outMVo.LineListVo.OrderBy(o => o.LineCode).ToList(); Line_chlst.DisplayMember = "LineName"; Line_chlst.ValueMember = "LineId"; Update_btn.Enabled = true; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, Line_lbl.Text); logger.Info(messageData); popUpMessage.Information(messageData, Text); Update_btn.Enabled = false; } }
private void Upload_btn_Click(object sender, EventArgs e) { OpenFileDialog openDialog_dlg = new OpenFileDialog(); openDialog_dlg.Filter = "Excel Files(*.xls) |*.xls"; if (openDialog_dlg.ShowDialog() == DialogResult.OK) { this.StartProgress(Properties.Resources.mmci00009); try { excelUploadDt = new ExcelUpload().ReadExcel(openDialog_dlg.FileName, Properties.Settings.Default.EXCEL_SHEET_LINE_MASTER); } catch (Framework.ApplicationException exception) { this.CompleteProgress(); popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } LineVo lineVo = new LineVo(); ProcessWorkLineVo processWorkLineVo = new ProcessWorkLineVo(); LineDetails_dgv.DataSource = null; excelUploadDt.Columns.Add("Remarks"); var sch = StringCheckHelper.GetInstance(); bool inputDataNG = false; foreach (DataRow row in excelUploadDt.Rows) { if (row["LineCode"] == null || string.IsNullOrWhiteSpace(row["LineCode"].ToString())) { row["Remarks"] = string.Format(Properties.Resources.mmce00011, LineCode_lbl.Text); inputDataNG = true; continue; } if (!sch.IsASCII(row["LineCode"].ToString())) { row["Remarks"] = string.Format(Properties.Resources.mmci00017, LineCode_lbl.Text); inputDataNG = true; continue; } if (row["LineName"] == null || string.IsNullOrWhiteSpace(row["LineName"].ToString())) { row["Remarks"] = string.Format(Properties.Resources.mmce00011, LineName_lbl.Text); inputDataNG = true; continue; } lineVo = new LineVo(); processWorkLineVo = new ProcessWorkLineVo(); lineVo.LineCode = row["LineCode"].ToString(); lineVo.LineName = row["LineName"].ToString(); if (!ValidateProcessWorkCodeInExcel(excelUploadDt, lineVo.LineCode)) { row["Remarks"] = string.Format(Properties.Resources.mmci00019); inputDataNG = true; continue; } LineVo checkVo = DuplicateCheck(lineVo); if (checkVo != null && checkVo.AffectedCount > 0) { row["Remarks"] = string.Format(Properties.Resources.mmce00012, LineCode_lbl.Text + " : " + lineVo.LineCode); inputDataNG = true; continue; } var duplicates = excelUploadDt.AsEnumerable().GroupBy(r => r["LineCode"]).Where(gr => gr.Count() > 1).ToList(); if (duplicates.Any() && duplicates.Select(dupl => dupl.Key).ToList().FirstOrDefault().ToString() == row["LineCode"].ToString()) { row["Remarks"] = string.Format(Properties.Resources.mmce00009, LineCode_lbl.Text + " : " + row["LineCode"].ToString()); inputDataNG = true; continue; } } LineDetails_dgv.AutoGenerateColumns = false; isExcelUpload = true; LineDetails_dgv.Columns["colRemarks"].Visible = true; LineDetails_dgv.DataSource = excelUploadDt; if (inputDataNG) { Save_btn.Enabled = false; } else { Save_btn.Enabled = true; } this.CompleteProgress(); } }
/// <summary> /// update data to db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Ok_btn_Click(object sender, EventArgs e) { LineVo inVo = new LineVo(); if (CheckMandatory()) { var sch = StringCheckHelper.GetInstance(); if (!sch.IsASCII(LineCode_txt.Text)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); LineCode_txt.Focus(); return; } inVo.LineCode = LineCode_txt.Text.Trim(); inVo.LineName = LineName_txt.Text.Trim(); //inVo.RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); inVo.RegistrationUserCode = UserData.GetUserData().UserCode; inVo.FactoryCode = UserData.GetUserData().FactoryCode; if (string.Equals(mode, CommonConstants.MODE_ADD)) { LineVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, LineCode_lbl.Text + " : " + LineCode_txt.Text); logger.Info(messageData); popUpMessage.ApplicationError(messageData, Text); return; } } ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>(); try { this.StartProgress(Properties.Resources.mmci00009); if (string.Equals(mode, CommonConstants.MODE_ADD)) { inVoList.add(inVo); inVoList.add(GetSelectedProcessWork()); LineVo outVo = (LineVo)base.InvokeCbm(new AddLineMasterAndProcessworkCbm(), inVoList, false); IntSuccess = (outVo.LineId > 0) ? 1 : 0; } else if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { inVo.LineId = updateData.LineId; inVoList.add(inVo); inVoList.add(GetSelectedProcessWork()); LineVo outVo = (LineVo)base.InvokeCbm(new UpdateLineMasterAndProcessworkCbm(), inVoList, false); IntSuccess = (outVo.AffectedCount > 0) ? 1 : 0; } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } finally { this.CompleteProgress(); } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.Close(); } } }
/// <summary> /// Binds tree view /// </summary> /// <param name="prcWrkList"></param> private void PopulateTreeView(List <CustomerVo> prcWrkList) { LineVo linOutVo = new LineVo(); try { linOutVo = (LineVo)base.InvokeCbm(new GetLineMasterMntCbm(), linInVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); Logger.Error(exception.GetMessageData()); return; } CustomerLineDetails_tv.Nodes.Clear(); TreeNode[] headerNode = new TreeNode[prcWrkList.Count]; int i = 0; foreach (CustomerVo prcW in prcWrkList) { TreeNode child = new TreeNode { Text = prcW.CustomerCode + " " + prcW.CustomerName, Tag = prcW.CustomerId }; headerNode[i] = child; int childNodes = linOutVo.LineListVo.Count; TreeNode[] rootNodes = new TreeNode[childNodes]; int node = 0; CustomerLineVo inVo = new CustomerLineVo(); inVo.CustomerId = Convert.ToInt32(Customer_cmb.SelectedValue); CustomerLineVo prcDefRsnOutVo = new CustomerLineVo(); try { prcDefRsnOutVo = (CustomerLineVo)base.InvokeCbm(new GetCustomerLineMasterMntCbm(), inVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); Logger.Error(exception.GetMessageData()); return; } foreach (LineVo dfrVo in linOutVo.LineListVo) { TreeNode rootChild = new TreeNode { Text = dfrVo.LineCode + " " + dfrVo.LineName, Tag = dfrVo.LineId }; List <CustomerLineVo> prcDefRsnList = prcDefRsnOutVo.customerLineListVo.Where(t => t.CustomerId == Convert.ToInt32(child.Tag)).ToList(); foreach (CustomerLineVo prDfRsnVo in prcDefRsnList) { if (prDfRsnVo.LineId == Convert.ToInt32(rootChild.Tag)) { rootChild.Checked = true; } } rootNodes[node] = rootChild; headerNode[i].Nodes.Add(rootNodes[node]); node += 1; } CustomerLineDetails_tv.Nodes.Add(headerNode[i]); i += 1; } if (CustomerLineDetails_tv.Nodes.Count > 0) { Update_btn.Enabled = true; } }
/// <summary> /// update data to db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Ok_btn_Click(object sender, EventArgs e) { LineVo inVo = new LineVo(); if (CheckMandatory()) { var sch = StringCheckHelper.GetInstance(); if (string.IsNullOrEmpty(LineCode_txt.Text) || string.IsNullOrEmpty(LineName_txt.Text)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); if (string.IsNullOrEmpty(LineCode_txt.Text)) { LineCode_txt.Focus(); } else { LineName_txt.Focus(); } return; } inVo.LineCode = LineCode_txt.Text.Trim(); inVo.LineName = LineName_txt.Text.Trim(); //inVo.RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); inVo.RegistrationUserCode = UserData.GetUserData().UserCode; inVo.FactoryCode = UserData.GetUserData().FactoryCode; if (string.Equals(mode, CommonConstants.MODE_ADD)) { LineVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, LineCode_lbl.Text + " : " + LineCode_txt.Text); logger.Info(messageData); popUpMessage.ApplicationError(messageData, Text); return; } } try { if (string.Equals(mode, CommonConstants.MODE_ADD)) { LineVo outVo = (LineVo)base.InvokeCbm(new AddLineMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } else if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { inVo.LineId = updateData.LineId; LineVo outVo = (LineVo)base.InvokeCbm(new UpdateLineMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.Close(); } } }
/// <summary> /// Binds tree view /// </summary> /// <param name="Buildinglist"></param> private void PopulateTreeView(List <BuildingVo> Buildinglist) { LineVo lineOutVo = new LineVo(); try { lineOutVo = (LineVo)base.InvokeCbm(new GetLineMasterMntCbm(), lineInVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); Logger.Error(exception.GetMessageData()); return; } LineBuildingDetails_tv.Nodes.Clear(); TreeNode[] headerNode = new TreeNode[Buildinglist.Count]; int i = 0; foreach (BuildingVo building in Buildinglist) { TreeNode child = new TreeNode { Text = building.BuildingCode + " " + building.BuildingName, Tag = building.BuildingId }; headerNode[i] = child; int childNodes = lineOutVo.LineListVo.Count; TreeNode[] rootNodes = new TreeNode[childNodes]; int node = 0; ValueObjectList <LineBuildingVo> linBuildingOutVo = new ValueObjectList <LineBuildingVo>(); try { linBuildingOutVo = (ValueObjectList <LineBuildingVo>)base.InvokeCbm(new GetLineBuildingMasterMntCbm(), new LineBuildingVo(), false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); Logger.Error(exception.GetMessageData()); return; } foreach (LineVo lineVo in lineOutVo.LineListVo) { TreeNode rootChild = new TreeNode { Text = lineVo.LineCode + " " + lineVo.LineName, Tag = lineVo.LineId }; if (linBuildingOutVo != null && linBuildingOutVo.GetList() != null && linBuildingOutVo.GetList().Count > 0) { List <LineBuildingVo> linBuildingList = linBuildingOutVo.GetList().Where(t => t.BuildingId == Convert.ToInt32(child.Tag)).ToList(); foreach (LineBuildingVo linBuildVo in linBuildingList) { if (linBuildVo.LineId == Convert.ToInt32(rootChild.Tag)) { rootChild.Checked = true; } } } rootNodes[node] = rootChild; headerNode[i].Nodes.Add(rootNodes[node]); node += 1; } LineBuildingDetails_tv.Nodes.Add(headerNode[i]); i += 1; } if (LineBuildingDetails_tv.Nodes.Count > 0) { Update_btn.Enabled = true; } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { LineVo inVo = (LineVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Select "); sqlQuery.Append(" line_id "); sqlQuery.Append(" ,line_cd "); sqlQuery.Append(" ,CONCAT(line_cd, ' - ', line_name) as line_name "); sqlQuery.Append(" from m_line "); sqlQuery.Append(" where factory_cd = :faccd "); if (inVo.LineCode != null) { sqlQuery.Append(" and line_cd like :linecd "); } if (inVo.LineName != null) { sqlQuery.Append(" and line_name like :linename "); } sqlQuery.Append(" order by line_name"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); if (inVo.LineCode != null) { sqlParameter.AddParameterString("linecd", inVo.LineCode + "%"); } if (inVo.LineName != null) { sqlParameter.AddParameterString("linename", inVo.LineName + "%"); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ValueObjectList <LineVo> outVo = null; while (dataReader.Read()) { LineVo currOutVo = new LineVo(); currOutVo.LineId = ConvertDBNull <Int32>(dataReader, "line_id"); currOutVo.LineCode = ConvertDBNull <string>(dataReader, "line_cd"); currOutVo.LineName = ConvertDBNull <string>(dataReader, "line_name"); if (outVo == null) { outVo = new ValueObjectList <LineVo>(); } outVo.add(currOutVo); } dataReader.Close(); return(outVo); }
private void Save_btn_Click(object sender, EventArgs e) { if (LineDetails_dgv.RowCount > 0 && LineDetails_dgv.Columns["colRemarks"].Visible == true) { if (processWorkList.Count == 0) { GetProcessWork(); } this.StartProgress(Properties.Resources.mmci00009); string previousLineCode = string.Empty; int uploadedCount = 0; int insertedCount = 0; LineVo lineVo = new LineVo(); ProcessWorkLineVo processWorkLineVo = new ProcessWorkLineVo(); foreach (DataRow row in excelUploadDt.Rows) { if (!string.IsNullOrEmpty(row["LineCode"].ToString()) && previousLineCode != row["LineCode"].ToString()) { lineVo = new LineVo(); processWorkLineVo = new ProcessWorkLineVo(); lineVo.LineCode = row["LineCode"].ToString(); lineVo.LineName = row["LineName"].ToString(); uploadedCount += 1; DataRow[] processWorkCodeList = excelUploadDt.Select("LineCode = '" + lineVo.LineCode + "'"); foreach (DataRow item in processWorkCodeList) { ProcessWorkLineVo addVo = new ProcessWorkLineVo(); ProcessWorkVo processWorkVo = processWorkList.Where(t => t.ProcessWorkCode == item["ProcessWorkCode"].ToString()).FirstOrDefault(); if (processWorkVo != null && processWorkVo.ProcessWorkId > 0) { addVo.ProcessWorkId = processWorkVo.ProcessWorkId; processWorkLineVo.ProcessWorkLineListVo.Add(addVo); } } ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>(); inVoList.add(lineVo); inVoList.add(processWorkLineVo); LineVo outVo = null; try { outVo = (LineVo)base.InvokeCbm(new AddLineMasterAndProcessworkCbm(), inVoList, false); } catch (Framework.ApplicationException exception) { this.CompleteProgress(); popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if (outVo != null && outVo.AffectedCount > 0) { insertedCount += outVo.AffectedCount; } } previousLineCode = row["LineCode"].ToString(); } this.CompleteProgress(); if (insertedCount > 0 && uploadedCount > 0 && insertedCount == uploadedCount) { messageData = new MessageData("mmci00010", Properties.Resources.mmci00010, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } } else { messageData = new MessageData("mmci00016", Properties.Resources.mmci00016, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } }