//--------------------------------Lookup ID , Policy-----------------------------------------------// public void LookupRestPolicy(IUimFormControlContext controlContext, IUimDataEntryFormContext form, string fieldName) { IUimDataContext datacontext = form.UimDataContext; string fname = controlContext.FieldDataContext.Name; try { if (fname == fieldName) { string value = controlContext.FieldDataContext.ValueAsString; // System.Windows.MessageBox.Show("Value policy = "+ value); if (!string.IsNullOrEmpty(value)) //Check Empty in Policy Field { var result = restPolicy(form.UimDataContext, "POLICYOWNER", value); if (result.Count == 0) { setLookupPolicy(form, false, "", "", "", ""); System.Windows.MessageBox.Show("Client not Found!"); } else { setLookupPolicy(form, true, result[0].firstName, result[0].lastName, result[0].idCardNo, result[0].birthDate); } } } } catch (Exception e) { System.Windows.MessageBox.Show(e.ToString()); } }
internal void setDropdownZipcode(IUimDataEntryFormContext form, List <LookupDropDownsZipcode> list, string nameDropdownlist) { try { IUimFormControlContext fcontrol = form.FindControl(nameDropdownlist); // GROUPBY Linq at here var result = list.GroupBy(u => u.postCode).Select(grp => grp.ToList()); List <DataObject> listObject = new List <DataObject>(); //Loop and Select First GroupBy for Add to list foreach (LookupDropDownsZipcode l in result.Select(o => o.First())) { listObject.Add(new DataObject { text = l.districtName, value = l.postCode }); } //Select and Set to Array string[] text = listObject.Select(o => o.text).ToArray(); string[] value = listObject.Select(o => o.value).ToArray(); fcontrol.SetListItems(value, value); } catch (Exception e) { System.Windows.MessageBox.Show(e.ToString()); } }
public void ButtonClick(IUimFormControlContext controlContext) { try { /// connection DB ScriptMain m = new ScriptMain(); IUimDataContext datacontext = controlContext.ParentForm.UimDataContext; //set fund name m.restFundName(datacontext); //dt_grid = m.setTEST(); wform.ShowDialog(); btnname = controlContext.ControlName.Remove(0, 4); IUimTableSectionContext table = controlContext.ParentForm.UimDataContext.FindTableSection(btnname); int row = table.RowCount; // Check click ok or cancel if (wform.flag_btn) { if (row == 0) { // MessageBox.Show("STAGE 1"); table.InsertNewRow(0); InsertRow(table, row); } else { if (flag_rowSelect) { // MessageBox.Show("STAGE 2"); if (row == rowSelect) { // MessageBox.Show("STAGE 2.1"); table.InsertNewRow(row); } InsertRow(table, rowSelect); } else { // MessageBox.Show("STAGE 3"); table.InsertNewRow(row); InsertRow(table, row); } } } wform.fundName = string.Empty; flag_rowSelect = false; } catch (Exception e) { string error = e.StackTrace; MessageBox.Show(e.ToString()); } }
public void parseValueDropdown(IUimFormControlContext controlContext, IUimDataEntryFormContext form, string fieldName, int step) { //Step 1 Simple value = code //Step 2 Province select get Text and keep value //Step 3 Simple value = text //Step 4 Empty IUimDataContext datacontext = form.UimDataContext; string fnamedropdown = controlContext.ControlName; // System.Windows.MessageBox.Show("Name Control " +fnamedropdown); try { if (fnamedropdown == fieldName) { // System.Windows.MessageBox.Show("START PARSE VALUE DDL"); string value = form.FindControl(fieldName).ChoiceValue; string text = form.FindControl(fieldName).Text; //System.Windows.MessageBox.Show(value1); if (step == 1) { IUimFieldDataContext fname = datacontext.FindFieldDataContext(fieldName.Substring(4)); fname.SetValue(value); } else if (step == 2) { IUimFieldDataContext fname = datacontext.FindFieldDataContext(fieldName.Substring(4)); fname.SetValue(text); //System.Windows.MessageBox.Show("Set Field :" + fieldName.Substring(4) + "[VALUE]:" + text); IUimFieldDataContext fname2 = datacontext.FindFieldDataContext(fieldName.Substring(4) + "Code"); fname2.SetValue(value); // System.Windows.MessageBox.Show("Set Field :" + fieldName.Substring(4)+"Code"+ "[VALUE]:" + value); } else if (step == 3) { IUimFieldDataContext fname = datacontext.FindFieldDataContext(fieldName.Substring(4)); fname.SetValue(text); } else if (step == 4) { IUimFieldDataContext fname = datacontext.FindFieldDataContext(fieldName.Substring(4)); fname.SetValue(string.Empty); } } } catch (Exception e) { System.Windows.MessageBox.Show(e.ToString()); } }
internal void setDropdownNull(IUimDataEntryFormContext form, string nameDropdownlist) { try { ////System.Windows.MessageBox.Show("list.Count ="+ list.Count.ToString() ); IUimFormControlContext fcontrol = form.FindControl(nameDropdownlist); fcontrol.SetListItems(null, null); } catch (Exception e) { System.Windows.MessageBox.Show(e.ToString()); } }
public void ExitControl(IUimFormControlContext controlContext) { try { //Lookup ScriptMain m = new ScriptMain(); m.LookupRestPolicy(controlContext, controlContext.ParentForm, "policyNo"); } catch (Exception e) { string error = e.StackTrace; } }
public void EnterControl(IUimFormControlContext controlContext) { try { if (controlContext.ControlName.StartsWith("c_")) { flag_rowSelect = true; rowSelect = controlContext.TableRowIndex; //MessageBox.Show("ControlName = " + controlContext.ControlName + "Select row = " + rowSelect.ToString()); } } catch (Exception e) { string error = e.StackTrace; } }
public void ExitControl(IUimFormControlContext controlContext) { try { //Lookup ScriptMain m = new ScriptMain(); // m.LookupIDCardSoap(controlContext, controlContext.ParentForm, "identityNo"); m.LookupRestID(controlContext, controlContext.ParentForm, "identityNo"); m.LookupRestPolicy(controlContext, controlContext.ParentForm, "policyNo"); m.parseValueDropdown(controlContext, controlContext.ParentForm, "ddl_bankName", 1); } catch (Exception e) { string error = e.StackTrace; } }
public void ExitControl(IUimFormControlContext controlContext) { try { //Lookup ScriptMain m = new ScriptMain(); // m.Lookup(controlContext, getFrom, "policyNo"); IUimDataContext datacontext = controlContext.ParentForm.UimDataContext; m.LookupRestPolicy(controlContext, controlContext.ParentForm, "policyNo"); m.parseValueDropdown(controlContext, controlContext.ParentForm, "ddl_partialWithdrawal_bankName", 1); } catch (Exception e) { string error = e.StackTrace; } }
public void ExitControl(IUimFormControlContext controlContext) { try { //Lookup ScriptMain m = new ScriptMain(); m.LookupRestPolicy(controlContext, controlContext.ParentForm, "policyNo"); m.parseValueDropdown(controlContext, controlContext.ParentForm, "ddl_changeICP_bankName", 1); if (controlContext.ControlName == "ddl_changeAddress_province") //ddl_Province ?? { // Set Null Zipcode at here m.setDropdownNull(controlContext.ParentForm, "ddl_changeAddress_zipCode"); m.parseValueEmpty(controlContext.ParentForm, "ddl_changeAddress_zipCode");//แก้ตรงนี้ <------- //System.Windows.MessageBox.Show("VALUE Null!!"); //set Value Province m.parseValueDropdown(controlContext, controlContext.ParentForm, "ddl_changeAddress_province", 2);//ddl_Province ?? // Fliter Zipcode Post Code string value_postCode = controlContext.ParentForm.UimDataContext.FindFieldDataContext("changeAddress_provinceCode").ValueAsString; //Province ?? เพื่อเอา Code ไป search Zipcode // System.Windows.MessageBox.Show("VALUE Post_Code="+ value_postCode); if (!string.IsNullOrEmpty(value_postCode)) { // System.Windows.MessageBox.Show("START SET DROPDOWN ZIPCODE"); List <ScriptMain.LookupDropDownsZipcode> listZipcode = new List <ScriptMain.LookupDropDownsZipcode>(); listZipcode = m.restDropDownZipcode(controlContext.ParentForm.UimDataContext, "POSTCODEMASTER", value_postCode); m.setDropdownZipcode(controlContext.ParentForm, listZipcode, "ddl_changeAddress_zipCode");// ddl_zipcode ?? } } if (controlContext.ControlName == "ddl_changeAddress_zipCode") // ddl_zipcode ?? { m.parseValueDropdown(controlContext, controlContext.ParentForm, "ddl_changeAddress_zipCode", 1); // ddl_zipcode ?? } } catch (Exception e) { string error = e.StackTrace; } }
public void LookupRestID(IUimFormControlContext controlContext, IUimDataEntryFormContext form, string fieldName) { IUimDataContext datacontext = form.UimDataContext; string fname = controlContext.FieldDataContext.Name; try { if (fname == fieldName) { string value = controlContext.FieldDataContext.ValueAsString; // System.Windows.MessageBox.Show("Value ID = "+ value); BigInteger num; bool flag = BigInteger.TryParse(value, out num); if (!string.IsNullOrEmpty(value) && value.Length == 13 && flag) //Check Empty in ID Field { // Edit at GETCLIENT var result = restIDCard(form.UimDataContext, "GETCLIENT", value); if (result.Count == 0) { setLookupIDCard(form, false, "", "", ""); System.Windows.MessageBox.Show("Client not Found!"); } else { setLookupIDCard(form, true, result[0].firstName, result[0].lastName, result[0].birthDate); } } else { System.Windows.MessageBox.Show("invalid format!"); } } } catch (Exception e) { System.Windows.MessageBox.Show(e.ToString()); } }
internal void setDropdownProvince(IUimDataEntryFormContext form, List <LookupDropDownsProvince> list, string nameDropdownlist) { try { ////System.Windows.MessageBox.Show("list.Count ="+ list.Count.ToString() ); IUimFormControlContext fcontrol = form.FindControl(nameDropdownlist); //List<string> Name = new List<string>(); //List<string> Code = new List<string>(); //foreach (var s in list) //{ // Name.Add(s.provinceName); // Code.Add(s.provinceCode); //} string[] text = list.Select(l => l.provinceName).ToList().ToArray(); string[] value = list.Select(l => l.provinceCode).ToList().ToArray(); fcontrol.SetListItems(text, value); } catch (Exception e) { System.Windows.MessageBox.Show(e.ToString()); } }
internal void setDropdownBankName(IUimDataEntryFormContext form, List <LookupDropDownsBankName> list, string nameDropdownlist) { try { //System.Windows.MessageBox.Show("list.Count ="+ list.Count.ToString() ); IUimFormControlContext fcontrol = form.FindControl(nameDropdownlist); List <string> Name = new List <string>(); List <string> Code = new List <string>(); foreach (var s in list) { Name.Add(s.BankName); Code.Add(s.BankCode); } fcontrol.SetListItems(Name.ToArray(), Code.ToArray()); } catch (Exception e) { System.Windows.MessageBox.Show(e.ToString()); } }