Example #1
0
        private long UpdateUserMappingValue(InbAttribMapValDto pData)
        {
            long mappingValId = 0;
            try
            {
                InbAttribMapValDal inbAttribMapValDal = new InbAttribMapValDal(sqlConnectionStr);
                int inbAttribMapValId = inbAttribMapValDal.Insert(pData);

                if (inbAttribMapValId > 0)
                {
                    DataRow dr = tblUserMappings.NewRow();
                    dr["ID"] = inbAttribMapValId;
                    dr["Description"] = pData.Descr;

                    if (pData.ActiveFlag.Equals("Y"))
                    {
                        tblUserMappings.Rows.Add(dr);
                    }
                    mappingValId = inbAttribMapValId;
                }
                else
                {
                    throw new Exception("The new Attribute Mapping value was unexpectedly not inserted into the database.");
                }
            }
            catch (Exception err)
            {
                //throw new Exception("Error in UpdateUserMappingValue(InbAttribMapValDto pData): " + err.Message);
                throw new Exception("An error occurred while updating a mapping value." + Environment.NewLine +
                     "Error CNF-180 in " + FORM_NAME + ".UpdateUserMappingValue(): " + err.Message);
            }
            return mappingValId;
        }
Example #2
0
 private void btnPhraseEditor_Click(object sender, EventArgs e)
 {
     string mapDescr = "";
     DataRow row = null;
     try
     {
         myTimer.Stop();
         lkupMappings.Properties.BestFit();
         lkupMappings.Properties.ValueMember = "Description";
         if (lkupMappedValue.EditValue != null)
         {
             row = ((System.Data.DataRowView)(lkupMappedValue.EditValue)).Row;
         }
         if (row != null)
         {
             InputBoxResult result = InputBox.Show("Unique Descr:", "Cpty Short Code Mapping", mapDescr, null);
             if (result.OK)
             {
                 InbAttribMapValDto inbAttribMapValData = new InbAttribMapValDto();
                 mapDescr = result.Text;
                 if (mapDescr.Trim().Length > 0)
                 {
                     inbAttribMapValData.ActiveFlag = "Y";
                     inbAttribMapValData.Id = 0;
                     inbAttribMapValData.InbAttribCode = "CPTY_SN";
                     inbAttribMapValData.MappedValue = row["CptySn"].ToString().Trim();
                     inbAttribMapValData.Descr = mapDescr.Trim();
                     UpdateUserMappingValue(inbAttribMapValData);
                     lkupMappings.EditValue = inbAttribMapValData.Descr;
                 }
             }
         }
         else
         {
             XtraMessageBox.Show("Please select a valid value for mapping.");
         }
     }
     catch (Exception ex)
     {
         //XtraMessageBox.Show("Exception in Map Phrase Event: " + ex.Message);
         XtraMessageBox.Show("An error occurred while mapping a phrase." + Environment.NewLine +
             "Error CNF-179 in " + FORM_NAME + ".tabctrlInboundViewer_SelectedPageChanged(): " + ex.Message,
           MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         myTimer.Start();
     }
     //  OpenMappedPhraseEditor("CPTY_SN");
 }