예제 #1
0
        private void SetUserFlagColumns(ref DataTable table)
        {
            DataRow drFind = null;
            var flagType = "";
            try
            {
                //getUserFlags userFlags = new getUserFlags();
                //getUserFlagRequest ufr = new getUserFlagRequest();
                //ufr.userName = (inboundWebServices.userName.Text[0]).ToUpper();
                //userFlags.userFlagRequest = ufr;
                //getUserFlagsResponse userFlagResponse = inboundWebServices.getUserFlags(userFlags);

                var inboundDocUserFlagDal = new InboundDocUserFlagDal(sqlConnectionString);
                var userFlagList = new List<InboundDocUserFlagDto>();
                userFlagList = inboundDocUserFlagDal.Get(p_UserId);

                //if ([email protected] != null)
                if (userFlagList.Count > 0)
                {
                    //for (int i = 0; i < [email protected]; i++)
                    foreach (var data in userFlagList)
                    {
                        //drFind = table.Rows.Find([email protected][i].inboundDocId);
                        drFind = table.Rows.Find(data.InboundDocId);
                        if (drFind != null)
                        {
                            drFind["UserComments"] = InboundDocsUserFlags.CLEAR;
                            //flagType = [email protected][i].flagType;
                            flagType = data.FlagType;
                            switch (flagType)
                            {
                                case "BOOKMARK":
                                {
                                    drFind["BookmarkFlag"] = InboundDocsUserFlags.BOOKMARK;
                                    break;
                                }
                                case "IGNORE":
                                {
                                    drFind["IgnoreFlag"] = InboundDocsUserFlags.IGNORE;
                                    break;
                                }
                                case "COMMENT":
                                {
                                    drFind["CommentFlag"] = InboundDocsUserFlags.COMMENT;
                                    //drFind["CommentUser"] = [email protected][i].comments;
                                    drFind["CommentUser"] = data.Comments;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //throw ex;
                throw new Exception("An error occurred while setting the grid filter values." + Environment.NewLine +
                     "Error CNF-441 in " + FORM_NAME + ".SetUserFlagColumns(): " + ex.Message);
            }
        }
예제 #2
0
        private void SubmitIgnoreDocumentsRequest(List<InboundDocUserFlagDto> pUserFlagList)
        {            
            try
            {
                gridViewInboundDocs.BeginDataUpdate();
                InboundDocsViewTable.BeginLoadData();
                
                InboundDocUserFlagDal inboundDocUserFlagDal = new InboundDocUserFlagDal(sqlConnectionString);
                Dictionary<int, int> rowsUpdatedList = new Dictionary<int, int>();
                rowsUpdatedList = inboundDocUserFlagDal.UpdateFlags(pUserFlagList);

                foreach (InboundDocUserFlagDto data in pUserFlagList)
                {                    
                    int rowsUpdated = 0;
                    if (rowsUpdatedList.TryGetValue(data.InboundDocId, out rowsUpdated))
                    {
                        if (rowsUpdated > 0)
                        {                            
                            var drFind = InboundDocsViewTable.Rows.Find(data.InboundDocId);
                            if (drFind != null)
                            {                         
                                if (data.UpdateDeleteInd.Equals(USER_FLAG_DELETE))
                                {
                                    drFind["IgnoreFlag"] = System.DBNull.Value;
                                }
                                else
                                {
                                    drFind["IgnoreFlag"] = "IGNORE";
                                }
                            }
                        }
                    }
                    else
                    {                        
                        XtraMessageBox.Show("An error occurred while updating the database with the Ignore setting." + Environment.NewLine +
                               "Error CNF-501 in " + FORM_NAME + ".SubmitIgnoreDocumentsRequest().",
                             FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                LogAndDisplayException("An error occurred while updating the database with the Ignore setting." + Environment.NewLine +
                               "Error CNF-502 in " + FORM_NAME + ".SubmitIgnoreDocumentsRequest().", ex);
            }
            finally
            {
                FinishApplyingInboundGridViewChanges();                
            }
        }