Exemplo n.º 1
0
        public void button_saveCAREP_PA(object sender, EventArgs e)
        {
            bool      flag         = false;
            ArrayList carep_PAList = new ArrayList();


            if (validateCAREPPAFields().Equals(true))
            {
                carep_PAList.Add(modalDDList.SelectedValue); //0
                carep_PAList.Add(modalFName.Value);          //1
                carep_PAList.Add(modalSname.Value);          //2
                carep_PAList.Add(modalEmail.Value);          //3
                carep_PAList.Add(modalTelNo.Value);          //4
                carep_PAList.Add(pID.InnerText.ToString());
                carep_PAList.Add(caID.InnerText.ToString());
                carep_PAList.Add(orgID.InnerText.ToString());

                flag = true;
            }
            else
            {
            }


            if (flag != false)
            {
                int check = 0;
                try
                {
                    check = db.addCAREP_PA(carep_PAList);
                    ScriptManager.RegisterStartupScript(Page, GetType(), "AlertUnauthorised", "showmodal();", true);
                    bindPAtable();

                    if (check == 2)
                    {
                        ScriptManager.RegisterStartupScript(Page, GetType(), "AlertDisplay", "displaySuccess('Successfully Created New Personal Assistantnt: " + txtSurname.Value + " " + txtFirstName.Value + "');", true);
                        bindtable();
                    }
                    else if (check == 0)
                    {
                        ScriptManager.RegisterStartupScript(Page, GetType(), "AlertFailureDisplay", "displayFailure();", true);
                    }
                }
                catch (Exception ex)
                {
                    ErrorLog.WriteErrorLog(ex.ToString());
                    ScriptManager.RegisterStartupScript(Page, GetType(), "AlertFailureDisplay", "displayFailure();", true);
                }
            }
        }