Exemplo n.º 1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ATTMeetingType Mtype = new ATTMeetingType();

        Mtype.MeetingTypeName = this.txtMeetingType.Text;
        Mtype.MeetingTypeDesc = this.txtDescription.Text;

        if (this.lstMeetingType.SelectedIndex < 0)//add mode
        {
            Mtype.MeetingTypeID = 0;
            Mtype.Action        = "A";
        }
        else //edit mode
        {
            Mtype.MeetingTypeID = ((List <ATTMeetingType>)Session["MeetingTypeLst"])[this.lstMeetingType.SelectedIndex].MeetingTypeID;
            Mtype.Action        = "E";
        }

        ObjectValidation result = BLLMeetingType.Validate(Mtype);

        if (result.IsValid == false)
        {
            this.lblStatusMessage.Text = result.ErrorMessage;
            this.programmaticModalPopup.Show();
            return;
        }

        try
        {
            BLLMeetingType.AddMeetingType(Mtype);
            List <ATTMeetingType> lst = ((List <ATTMeetingType>)Session["MeetingTypeLst"]);

            if (Mtype.Action == "A")
            {
                lst.Add(Mtype);
            }
            else
            {
                lst[this.lstMeetingType.SelectedIndex] = Mtype;
            }

            this.lstMeetingType.DataSource     = lst;
            this.lstMeetingType.DataTextField  = "MeetingTypeName";
            this.lstMeetingType.DataValueField = "MeetingTypeID";
            this.lstMeetingType.DataBind();

            this.ClearME();
            this.lstMeetingType.SelectedIndex = -1;
            this.lblStatusMessage.Text        = "Meeting Type successfully saved.";
            this.programmaticModalPopup.Show();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
Exemplo n.º 2
0
 void LoadMeetingType()
 {
     try
     {
         Session["MeetingTypeLst"]          = BLLMeetingType.GetMeetingTypeList();
         this.lstMeetingType.DataSource     = Session["MeetingTypeLst"];
         this.lstMeetingType.DataTextField  = "MeetingTypeName";
         this.lstMeetingType.DataValueField = "MeetingTypeID";
         this.lstMeetingType.DataBind();
     }
     catch (Exception ex)
     {
         this.lblStatusMessage.Text = ex.Message;
         this.programmaticModalPopup.Show();
     }
 }
Exemplo n.º 3
0
 void LoadMeetingType()
 {
     try
     {
         List <ATTMeetingType> lst = BLLMeetingType.GetMeetingTypeList();
         if (lst.Count > 0)
         {
             lst.Insert(0, new ATTMeetingType(0, "---- छान्नुहोस् ----", ""));
         }
         this.ddlMeetingType.DataSource     = lst;
         this.ddlMeetingType.DataTextField  = "MeetingTypeName";
         this.ddlMeetingType.DataValueField = "MeetingTypeID";
         this.ddlMeetingType.DataBind();
     }
     catch (Exception ex)
     {
         this.lblStatusMessage.Text = ex.Message;
         this.programmaticModalPopup.Show();
     }
 }