private void butNew_Click(object sender, System.EventArgs e) { //won't be visible if no permission FormProcCodeNew FormPCN = new FormProcCodeNew(); FormPCN.ShowDialog(); if (FormPCN.DialogResult != DialogResult.OK) { return; } if (FormPCN.textNewCode.Text == "") { return; } ProcedureCode procCode; if (ProcedureCodes.HList.ContainsKey(FormPCN.textNewCode.Text)) { procCode = (ProcedureCode)ProcedureCodes.HList[FormPCN.textNewCode.Text]; textAbbreviation.Text = ""; textDescription.Text = ""; textCode.Text = FormPCN.textNewCode.Text; if (DefB.GetHidden(DefCat.ProcCodeCats, procCode.ProcCat)) { checkShowHidden.Checked = true; FillCats(); } for (int i = 0; i < CatList.Length; i++) { if (CatList[i].DefNum == procCode.ProcCat) { listCategories.SetSelected(i, true); } else { listCategories.SetSelected(i, false); } } FillGrid(); MessageBox.Show(Lan.g(this, "That code already exists.")); return; } procCode = new ProcedureCode(); procCode.ADACode = FormPCN.textNewCode.Text; //procCode.ProcTime="/X/";//moved to contructor. procCode.ProcCat = DefB.Short[(int)DefCat.ProcCodeCats][0].DefNum; //procCode.GraphicColor=Color.FromArgb(0);//moved to contructor. ProcedureCodes.Insert(procCode); FormProcCodeEdit FormP = new FormProcCodeEdit(procCode); FormP.IsNew = true; FormP.ShowDialog(); if (FormP.DialogResult == DialogResult.OK) { changed = true; FillGrid(); } SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Added Procedure Code: " + procCode.ADACode); }
private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) { if(IsSelectionMode){ SelectedCodeNum=PIn.Long(ProcTable.Rows[e.Row]["CodeNum"].ToString()); DialogResult=DialogResult.OK; return; } //else not selecting a code if(!Security.IsAuthorized(Permissions.Setup,DateTime.MinValue,true)){ return; } long codeNum=PIn.Long(ProcTable.Rows[e.Row]["CodeNum"].ToString()); //string =ProcTable.Rows[e.Row]["ProcCode"].ToString(); if(e.Col>3){//if double clicked on a fee Fee FeeCur=null; long feesched=0; if(e.Col==4){ feesched=FeeSchedC.ListShort[listFeeSched.SelectedIndex].FeeSchedNum; FeeCur=Fees.GetFee(codeNum,feesched); } if(e.Col==5) { if(comboCompare1.SelectedIndex==0){ return; } feesched=FeeSchedC.ListShort[comboCompare1.SelectedIndex-1].FeeSchedNum; FeeCur=Fees.GetFee(codeNum,feesched); } if(e.Col==6) { if(comboCompare2.SelectedIndex==0) { return; } feesched=FeeSchedC.ListShort[comboCompare2.SelectedIndex-1].FeeSchedNum; FeeCur=Fees.GetFee(codeNum,feesched); } FormFeeEdit FormFE=new FormFeeEdit(); if(FeeCur==null) { FeeCur=new Fee(); FeeCur.FeeSched=feesched; FeeCur.CodeNum=codeNum; Fees.Insert(FeeCur); //SecurityLog is updated in FormFeeEdit. FormFE.IsNew=true; } FormFE.FeeCur=FeeCur; FormFE.ShowDialog(); if(FormFE.DialogResult==DialogResult.OK) { Fees.RefreshCache(); changed=true; FillGrid(); } } else {//not on a fee: Edit code instead FormProcCodeEdit FormPCE=new FormProcCodeEdit(ProcedureCodes.GetProcCodeFromDb(codeNum)); FormPCE.IsNew=false; FormPCE.ShowDialog(); if(FormPCE.DialogResult==DialogResult.OK) { //ProcedureCodes.Refresh(); changed=true; //Fees.Refresh();//fees were already refreshed within procCodeEdit FillGrid(); } } }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { if (IsSelectionMode) { SelectedADA = ProcTable.Rows[e.Row]["ADACode"].ToString(); DialogResult = DialogResult.OK; return; } //else not selecting a code if (!Security.IsAuthorized(Permissions.Setup, DateTime.MinValue, true)) { return; } string ada = ProcTable.Rows[e.Row]["ADACode"].ToString(); if (e.Col > 3) //if double clicked on a fee { Fee FeeCur = null; int feesched = 0; if (e.Col == 4) { FeeCur = Fees.GetFeeByOrder(ada, listFeeSched.SelectedIndex); feesched = DefB.Short[(int)DefCat.FeeSchedNames][listFeeSched.SelectedIndex].DefNum; } if (e.Col == 5) { if (comboCompare1.SelectedIndex == 0) { return; } FeeCur = Fees.GetFeeByOrder(ada, comboCompare1.SelectedIndex - 1); feesched = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare1.SelectedIndex - 1].DefNum; } if (e.Col == 6) { if (comboCompare2.SelectedIndex == 0) { return; } FeeCur = Fees.GetFeeByOrder(ada, comboCompare2.SelectedIndex - 1); feesched = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare2.SelectedIndex - 1].DefNum; } FormFeeEdit FormFE = new FormFeeEdit(); if (FeeCur == null) { FeeCur = new Fee(); FeeCur.ADACode = ada; FeeCur.FeeSched = feesched; Fees.Insert(FeeCur); FormFE.IsNew = true; } FormFE.FeeCur = FeeCur; FormFE.ShowDialog(); if (FormFE.DialogResult == DialogResult.OK) { Fees.Refresh(); changed = true; FillGrid(); } } else //not on a fee: Edit code instead { FormProcCodeEdit FormPCE = new FormProcCodeEdit(ProcedureCodes.GetProcCode(ada)); FormPCE.IsNew = false; FormPCE.ShowDialog(); if (FormPCE.DialogResult == DialogResult.OK) { //ProcedureCodes.Refresh(); changed = true; //Fees.Refresh();//fees were already refreshed within procCodeEdit FillGrid(); } } }