コード例 #1
0
 protected void btnSaveElementGroup_Click(object sender, EventArgs e)
 {
     try
     {
         initialDataBLL lookupBll = new initialDataBLL();
         lookupBll.ElementGroupName = txtbxGroupName.Text;
         lookupBll.ElementGroupDes  = txtDescription.Text;
         if (btnSave.Text != "Update")
         {
             if (lookupBll.checkDuplicateLookupGroup())
             {
                 bool Status = lookupBll.SaveLookUpGroup();
                 if (Status)
                 {
                     string message = " <span class='actionTopic'>" + " Data Saved Successfully as Id: " +
                                      lookupBll.ElementGroupId.ToString() + "</span>.";
                     MyAlertBox(
                         "var callbackOk = function () { window.location = \"/HRUI/LookUpData/ElementGroup/AddElementGroup.aspx\"; }; SuccessAlert(\"" +
                         "Process Succeed" + "\", \"" + message + "\", \"\");");
                     GetElementGroupList();
                 }
             }
             else
             {
                 msgbox.Visible     = true;
                 msgTitleLabel.Text = "Duplicate Data";
                 msgTitleLabel.Text = "This Group is already Added.";
             }
         }
         else
         {
             lookupBll.ElementGroupId = hdbFieldId.Value;
             lookupBll.UpdateLookUpGroup();
             btnSave.Text = "Save";
             string message = " <span class='actionTopic'>" + " Data Updated Successfully of Id: " +
                              lookupBll.ElementGroupId.ToString() + "</span>.";
             MyAlertBox(
                 "var callbackOk = function () { window.location = \"/HRUI/LookUpData/ElementGroup/AddElementGroup.aspx\"; }; SuccessAlert(\"" +
                 "Process Succeed" + "\", \"" + message + "\", \"\");");
             GetElementGroupList();
             txtDescription.Text = "";
             txtbxGroupName.Text = "";
         }
     }
     catch (Exception ex)
     {
         string message = ex.Message;
         if (ex.InnerException != null)
         {
             message += " --> " + ex.InnerException.Message;
         }
         MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
     }
 }