public static MessageT SignOn(ProfileT profileT)
        {
            MessageT messageT = new MessageT();

            messageT.IsSuccess = false;
            messageT.Message = "";
            try
            {
                // DB 에서 사용자 인증 확인
                profileT = new ProfileBiz().LoginCheck(profileT);

                if (profileT != null)
                {
                    messageT.IsSuccess = true;

                    // 확인된 사용자 인증 처리
                    System.Web.Security.FormsAuthentication.SetAuthCookie(profileT.UserSeCode + "_" + profileT.UserId, false);

                    // 세션에는 사용자 기본정보만 저장
                    User = profileT;
                }

            }
            catch (Exception ex)
            {
                messageT.IsSuccess = false;
                messageT.Message = ex.Message;
            }
            return messageT;
        }
Beispiel #2
0
        /// <summary>
        /// 엑셀데이터 validation 검사
        /// </summary>
        /// <param name="data"></param>
        /// <param name="name"></param>
        /// <param name="arrRule"></param>
        /// <returns></returns>
        public MessageT ValidExcelData(string data, string name, string[] arrRule)
        {
            MessageT messageT = new MessageT();
            bool isSuccess = true;
            string errMessage = "";

            if (String.IsNullOrEmpty(data))
            {
                data = "";
            }

            //validate Rule에 의한 검사
            for (int i = 0; i < arrRule.Length; i++)
            {
                string strRule = "";
                string strValue = "";

                string[] arr = arrRule[i].Split(':');
                if (arr.Length > 0)
                {
                    strRule = arr[0];
                    if (arr.Length > 1)
                    {
                        strValue = arr[1];
                    }
                }

                //필수입력 검사
                if (strRule == "required")
                {
                    if (String.IsNullOrEmpty(data))
                    {
                        isSuccess = false;
                        errMessage = "[" + name + " 필수입력오류]";
                        break;
                    }
                }

                //공통코드 매핑 검사
                if (strRule == "mapping")
                {
                    string mappingCode = SelectCmmnCodeByCmmnCodeNm(strValue, data);
                    if (String.IsNullOrEmpty(mappingCode))
                    {
                        isSuccess = false;
                        errMessage = "[" + name + " 매핑오류]";
                        break;
                    }
                    else
                    {
                        messageT.MappingCode = mappingCode;
                    }
                }

                //최대길이 검사
                if (strRule == "maxlength")
                {
                    if (arrRule[i].ArchSplit(':', 1).Length > Convert.ToInt32(strValue))
                    {
                        isSuccess = false;
                        errMessage = "[" + name + " 최대길이오류(" + strValue + ")]";
                        break;
                    }
                }

                //데이터타입 변환 검사
                if (strRule == "datatype")
                {
                    string dataType = strValue;
                    if (dataType == "int")
                    {
                        try
                        {
                            int intData = Convert.ToInt32(data);
                        }
                        catch (Exception ex)
                        {
                            errMessage = "[정수형 변환오류] ";
                        }
                    }
                    else if (dataType == "long")
                    {
                        try
                        {
                            long longData = Convert.ToInt64(data);
                        }
                        catch (Exception ex)
                        {
                            errMessage = "[정수형 변환오류] ";
                        }
                    }
                    else if (dataType == "double")
                    {
                        try
                        {
                            double doubleData = Convert.ToDouble(data);
                        }
                        catch (Exception ex)
                        {
                            errMessage = "[실수형 변환오류] ";
                        }
                    }
                }

            }

            messageT.IsSuccess = isSuccess;
            messageT.Message = errMessage;

            return messageT;
        }