Exemplo n.º 1
0
    private UserCustomPropertyData ReadFormPostData()
    {
        UserCustomPropertyData ucpdata = new UserCustomPropertyData();
        string strLabel;
        bool bReq = false;

        EkEnumeration.ObjectPropertyValueTypes ty = new EkEnumeration.ObjectPropertyValueTypes();
        EkEnumeration.ObjectPropertyDisplayTypes inputtype = new EkEnumeration.ObjectPropertyDisplayTypes();

        int validation = 0;
        string strValidationMsg = "";
        string strMinVal = "";
        string strMaxVal = "";

        strLabel = Request.Form[txtLabel.UniqueID].ToString().Trim();
        if (!(Request.Form[txtMessage.UniqueID] == null))
        {
            strValidationMsg = (string)(Request.Form[txtMessage.UniqueID].ToString().Trim());
        }
        if (ContentLanguage != m_CommAPI.DefaultContentLanguage)
        {
            if ((!(Request.Form["hdnRequired"] == null)) && ((Request.Form["hdnRequired"].ToString() == "on") || (Request.Form["hdnRequired"].ToString() == "1") || (Request.Form["hdnRequired"].ToString().ToLower() == "true")))
            {
                bReq = true;
            }
            if (Request.Form["hdnddTypes"] != null)
                ty = (EkEnumeration.ObjectPropertyValueTypes)Enum.Parse(typeof(EkEnumeration.ObjectPropertyValueTypes), Request.Form["hdnddTypes"].ToString());

            if (Request.Form["hdninputtype"] != null)
                inputtype = (EkEnumeration.ObjectPropertyDisplayTypes)Enum.Parse(typeof(EkEnumeration.ObjectPropertyDisplayTypes), Request.Form["hdninputtype"].ToString());
            int.TryParse(Request.Form["hdnddValidationType"], out validation);
            if (Request.Form["hdnMinValue"] != null)
                strMinVal = Request.Form["hdnMinValue"].ToString().Trim();
            if (Request.Form["hdnMaxValue"] != null)
                strMaxVal = Request.Form["hdnMaxValue"].ToString().Trim();
        }
        else
        {
            //If ((Not Request.Form(chkRequired.UniqueID.ToString) Is Nothing) AndAlso ((Request.Form(chkRequired.UniqueID.ToString).ToString() = "on") Or (Request.Form(chkRequired.UniqueID.ToString).ToString() = "1"))) Then
            //    bReq = True
            //End If
            if (!(Request.Form["hdnddTypes"] == null))
            {
                ty = (EkEnumeration.ObjectPropertyValueTypes)Enum.Parse(typeof(EkEnumeration.ObjectPropertyValueTypes), Request.Form["hdnddTypes"].ToString());
            }
            else
            {
                ty = (EkEnumeration.ObjectPropertyValueTypes)Enum.Parse(typeof(EkEnumeration.ObjectPropertyValueTypes), Request.Form[ddTypes.UniqueID].ToString());
            }
            if (!string.IsNullOrEmpty(Request.Form[ddInputType.UniqueID]))
            {
                inputtype = (EkEnumeration.ObjectPropertyDisplayTypes)Enum.Parse(typeof(EkEnumeration.ObjectPropertyDisplayTypes), Request.Form[ddInputType.UniqueID].ToString());
            }
            if (!(Request.Form[ddValidationType.UniqueID] == null))
            {
                validation = System.Convert.ToInt32(Request.Form[ddValidationType.UniqueID]);
            }
            if (ty == EkEnumeration.ObjectPropertyValueTypes.Date)
            {
                if (!(Request.Form["start_Date"] == null))
                {
                    strMinVal = (string)(Request.Form["start_Date"].ToString().Trim());
                }
                if (!(Request.Form["end_date"] == null))
                {
                    strMaxVal = (string)(Request.Form["end_date"].ToString().Trim());
                }
            }
            else
            {
                if (!(Request.Form[txtMinValue.UniqueID] == null))
                {
                    strMinVal = (string)(Request.Form[txtMinValue.UniqueID].ToString().Trim());
                }
                if (!(Request.Form[txtMaxValue.UniqueID] == null))
                {
                    strMaxVal = (string)(Request.Form[txtMaxValue.UniqueID].ToString().Trim());
                }
            }
        }
        if (ty == EkEnumeration.ObjectPropertyValueTypes.SelectList || ty == EkEnumeration.ObjectPropertyValueTypes.MultiSelectList)
        {
            if (Request.Form["selectedvalues"] == "")
            {
                throw (new Exception("please add atleast one item into select list"));
            }
            else
            {
                ucpdata.PropertyValidationSelectList = Request.Form["selectedvalues"];
                if (!string.IsNullOrEmpty(Request.Form["chkValidation"]))
                {
                    bReq = true;
                    validation = 8;
                }
                else
                {
                    bReq = false;
                    validation = 0;
                }
            }
        }
        if (strLabel == string.Empty)
        {
            throw (new Exception("Please insert the label."));
        }
        ucpdata.Name = strLabel;
        ucpdata.Required = bReq || (validation > 0);
        ucpdata.PropertyValueType = ty;
        ucpdata.PropertyValidationType = validation;
        ucpdata.PropertyValidationMinVal = strMinVal;
        ucpdata.PropertyValidationMaxVal = strMaxVal;
        ucpdata.PropertyValidationMessage = strValidationMsg;
        ucpdata.PropertyDisplayValueType = inputtype;

        return ucpdata;
    }
Exemplo n.º 2
0
 private void initPage()
 {
     if (!(Request.QueryString["id"] == null))
     {
         m_iId = Convert.ToInt64(Request.QueryString["id"]);
     }
     if (!(Request.QueryString["action"] == null))
     {
         PageAction = (string)(Request.QueryString["action"].ToString().ToLower());
     }
     m_refMsg = m_CommAPI.EkMsgRef;
     AppImgPath = m_CommAPI.AppImgPath;
     EnableMultiLanguage = m_CommAPI.EnableMultilingual;
     if (Request.QueryString["LangType"] != null)
     {
         ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
         m_CommAPI.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
     }
     else
     {
         if (m_CommAPI.GetCookieValue("LastValidLanguageID") != "")
         {
             ContentLanguage = int.Parse(m_CommAPI.GetCookieValue("LastValidLanguageID"));
         }
     }
     m_CommAPI.ContentLanguage = ContentLanguage;
     m_UserRef = m_CommAPI.EkUserRef;
     m_ucpdata = m_UserRef.GetCustomProperty(m_iId);
     allUCPData = m_UserRef.GetAllCustomProperty("");
 }