コード例 #1
0
 private void SetNewState(bool	bNewMessageID,bool	bEditMode,int	pMessageID)
 {
     m_bNewMessage	=	bNewMessageID;
     m_bEditMode	=	bEditMode;
     m_MessageID	=	pMessageID;
     if(m_MessageID	<	0)
         m_MessageRow	=	null;
     StoreInViewState();
     BindAll();
 }
コード例 #2
0
        private bool SaveData()
        {
            try
            {

                m_MessageID = Convert.ToInt32(MessageID.Text);
                int T = Convert.ToInt32(Timeout.Text);
                if (T < 0)
                    throw new Exception("Invalid timeout value");

                if (m_bNewMessage)
                {
                    m_MessageRow = m_DS.Message.NewMessageRow();
                    m_MessageRow.ID = m_MessageID;
                }
                else
                    if (!m_bEditMode)
                    {
                        throw new Exception("Invalid mode on save");
                    }
                m_MessageRow.Description = Description.Text.Trim();
                m_MessageRow.WSDllFile = WSDllFile.Text.Trim();
                m_MessageRow.WSDllFunction = WSDllFunction.Text.Trim();
                m_MessageRow.WSSoapAction = WSSoapAction.Text.Trim();
                m_MessageRow.WSURL = WSURL.Text.Trim();
                m_MessageRow.ID = m_MessageID;
                m_MessageRow.Stateful = Stateful.Checked;
                m_MessageRow.Timeout = Convert.ToInt32(Timeout.Text);

                if (m_bNewMessage)
                {
                    m_MessageRow.Table.Rows.Add(m_MessageRow);
                }
                ConvertEmptyStringToNull(m_MessageRow);
                return true;
            }
            catch (Exception E)
            {
                if (E is FormatException)
                    Utilities.SetError(this, "Invalid numeric value specified", null);
                else
                    Utilities.SetError(this, E.Message, null);
                return false;
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            m_DS	=	EnvInit();
            m_MessageRow	=	null;
            m_bEditMode	=	false;
            m_bNewMessage	=	false;
            m_MessageID	=	-1;

            if(!IsPostBack)
            {
                if(Request["MessageID"]	!=	null)
                {
                    if(Request["MessageID"].ToLower()	==	"new")
                    {
                        SetNewState(true,false,m_MessageID);
                        return;
                    }
                    m_MessageID	=	Convert.ToInt32(Request["MessageID"]);
                }
                else
                {
                    m_MessageID	=	-1;
                }

                if (m_MessageID >= 0)
                {
                    m_MessageRow	=	m_DS.Message.FindByID(m_MessageID);
                    if(m_MessageRow	==	null)
                        Utilities.SetError(this,"Message not defined in the system",null);
                }
                SetNewState(false,false,m_MessageID);
            }
            else
            {
                LoadFromViewState();
                if(m_MessageID	>=	0)
                {
                    m_MessageRow	=	m_DS.Message.FindByID(m_MessageID);
                }
            }
        }
コード例 #4
0
        protected void ShowMessageBtn_Click(object sender, System.EventArgs e)
        {
            try
            {
                int	l_ID	=	Convert.ToInt32(MessageID.Text);
                m_MessageRow	=	m_DS.Message.FindByID(l_ID);

                if(m_MessageRow	==	null)
                {
                    SetNewState(false,false,-1);
                    MessageID.Text	=	l_ID.ToString();
                    Utilities.Confirm(this,"Message not defined in the system, to add a new one, click OK","document.all('NewMessageBtn').click()",null);
                }
                else
                {
                    SetNewState(false,false,l_ID);
                }
            }
            catch
            {
                Utilities.SetError(this, "Invalid Message ID Specified", null);
                SetNewState(false, false, -1);
            }
        }
コード例 #5
0
        protected void NewMessageBtn_Click(object sender, System.EventArgs e)
        {
            try
            {
                int	l_ID	=	Convert.ToInt32(MessageID.Text);
                if (l_ID < 0 || l_ID > 99999999)
                    throw new Exception();

                MessageID.Text	=	l_ID.ToString();
                if(m_MessageRow	==	null	&&	l_ID	>	0)
                {
                    if(m_DS.Message.FindByID(l_ID)	!=	null)
                    {
                        Utilities.SetError(this,"Message ID already defined in the system",null);
                        SetNewState(false,false,-1);
                    }
                    else
                    {
                        m_MessageRow	=	m_DS.Message.NewMessageRow();
                        m_MessageRow.ID	=	l_ID;
                        m_DS.Message.AddMessageRow(m_MessageRow);
                        SetNewState(false,true,l_ID);
                    }
                }
            }
            catch
            {
                Utilities.SetError(this, "Invalid Message ID Specified", null);
                SetNewState(false, false, -1);
            }
        }