Exemple #1
0
 protected void btnSaveHandle_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtAttachmentHandle.Text != "" && txtAcessIndex.Text != "" && txtTableName.Text != "" && ddlDBID.SelectedValue != "Select")
         {
             objAttachmentcls                  = new AttachmentCls();
             objAttachmentcls.DBID             = ddlDBID.SelectedValue;
             objAttachmentcls.AttachmentHandle = txtAttachmentHandle.Text.Trim();
             objAttachmentcls.IndexValue       = txtAcessIndex.Text.Trim();
             objAttachmentcls.TableName        = txtTableName.Text.Trim();
             objAttachmentcls.TableDesc        = txtDescription.Text.Trim();
             objAttachmentcls.Remarks          = txtRemarks.Text.Trim();
             if (btnSaveHandle.Text == "Save")
             {
                 int res = objAttachmentcls.InsertHandle();
                 if (res > 0)
                 {
                     txtAttachmentHandle.Text = "";
                     txtAcessIndex.Text       = "";
                     txtTableName.Text        = "";
                     txtDescription.Text      = "";
                     txtRemarks.Text          = "";
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Data Saved Successfully');", true);
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Data Not Saved');", true);
                 }
             }
             else
             {
                 int res = objAttachmentcls.UpdateHandle();
                 if (res > 0)
                 {
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Data Updated Successfully');", true);
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Data Not Updated');", true);
                 }
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Please enter all data');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not found');", true);
     }
 }