Ejemplo n.º 1
0
        private void PopulateUserMappings()
        {

            try
            {
                if (lkupMappedValue.Text.Equals("")) return;
                resetMappingTable();
                DataRow row = ((System.Data.DataRowView)(lkupMappedValue.EditValue)).Row;

                if (row != null)
                {
                    string inbAttribCode = row["CptySn"].ToString();
                    btnPhraseEditor.ToolTip = "Create a new mapping for: " + inbAttribCode;
                    InbAttribMapValDal inbAttribMapValDal = new InbAttribMapValDal(sqlConnectionStr);
                    List<InbAttribMapValDto> inbAttribMapValList = new List<InbAttribMapValDto>();
                    inbAttribMapValList = inbAttribMapValDal.GetMapValues(inbAttribCode);

                    if (inbAttribMapValList.Count > 0)
                    {
                        foreach (InbAttribMapValDto data in inbAttribMapValList)
                        {
                            DataRow dr = tblUserMappings.NewRow();
                            dr[1] = data.Id;
                            dr[0] = data.Descr;
                            tblUserMappings.Rows.Add(dr);
                        }
                        PopulatePhrases();
                    }
                    else
                    {
                        //throw new Exception("Error PopulateUserMappings() List");
                        throw new Exception("An error occurred while populating user mappings." + Environment.NewLine +
                            "Error CNF-184 in " + FORM_NAME + ".PopulateUserMappings()");
                    }
                }
            }
            catch (Exception err)
            {
                //XtraMessageBox.Show(err.Message);
                XtraMessageBox.Show("An error occurred while processing user mappings." + Environment.NewLine +
                    "Error CNF-185 in " + FORM_NAME + ".PopulateUserMappings(): " + err.Message,
                  MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
Ejemplo n.º 2
0
       private DataTable GetInbAttribMapVals(string pAttribCode)
       {
           DataTable dt = null;
           try
           {
               List<InbAttribMapValDto> inbAttribMapValList = new List<InbAttribMapValDto>();
               InbAttribMapValDal inbAttribMapValDal = new InbAttribMapValDal(sqlConnectionString);
               inbAttribMapValList = inbAttribMapValDal.GetMapValues(pAttribCode);

               if (inbAttribMapValList.Count > 0)
               {
                    dt = new DataTable();
                    dt.Columns.Add("Mapping Value");
                    dt.Columns.Add("Descr");
                    dt.Columns.Add("ID");

                    foreach(InbAttribMapValDto data in inbAttribMapValList)
                       {
                        DataRow dr = dt.NewRow();
                        dr[0] = data.MappedValue;
                        dr[1] = data.Descr;
                        dr[2] = data.Id;
                        dt.Rows.Add(dr);
                       }
               }
               else
               {
                   throw new Exception("Error CNF-302: The mapped value update did not occur for Attribute Code: " + pAttribCode + ".");
               }
           }
           catch (Exception err)
           {
               XtraMessageBox.Show("An error occurred while attempting to perform the requested update." + Environment.NewLine +
                     "Error CNF-535 in " + FORM_NAME + ".GetInbAttribMapVals(): " + err.Message,
                   FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
           return dt;
       }