コード例 #1
0
ファイル: frmMain.cs プロジェクト: Amphora2015/DemoTest
        private void DeleteUserMapping()
        {
            string mappDesc = "";
            DataRow row = null;
            try
            {
                myTimer.Stop();
                if (lkupMappings.EditValue != null)
                {
                    mappDesc = lkupMappings.Text;
                    string select = "Description = " + "'" + mappDesc.Replace("'", "''") + "'";
                    DataRow[] rows = tblUserMappings.Select(select);
                    if (rows.Length == 0) return;
                    row = rows[0];

                }
                if (row != null)
                {
                    Int32 id = Convert.ToInt32(row["ID"]);
                    InbAttribMapValDal inbAttribMapValDal = new InbAttribMapValDal(sqlConnectionStr);
                    inbAttribMapValDal.Delete(id);

                    row.Delete();
                    resetPhraseTable();
                }
                else
                {
                    XtraMessageBox.Show("Please select a valid value for mapping.");
                }
            }
            catch (Exception ex)
            {
                //XtraMessageBox.Show("Exception in Delete User Mapping: " + ex.Message);
                XtraMessageBox.Show("An error occurred while deleting user mappings." + Environment.NewLine +
                    "Error CNF-193 in " + FORM_NAME + ".DeleteUserMapping(): " + ex.Message,
                  MAIN_FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                myTimer.Start();
            }
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: Amphora2015/DemoTest
        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;
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: Amphora2015/DemoTest
        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);
            }

        }
コード例 #4
0
ファイル: frmMapPhrase.cs プロジェクト: Amphora2015/DemoTest
       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;
       }