protected void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                labelMessage.Text = string.Empty;
                using (MappingTableRT receiverTransfer = new MappingTableRT())
                {
                    hdIsDelete.Value = "true";
                    hdIsEdit.Value   = "true";
                    MappingTable mapping = CreateMappingTable();

                    if (mapping != null)
                    {
                        receiverTransfer.UpdateMappingTable(mapping);
                        labelMessage.Text      = "Data successfully deleted...";
                        labelMessage.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        labelMessage.Text      = "Data not deleted...";
                        labelMessage.ForeColor = System.Drawing.Color.Red;
                    }
                }
                LoadMappingTable();
                ClearField();
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
            SetButton();
        }
 //For Edit Mapping
 protected void lvMapping_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (e.CommandName == "EditMapping")
     {
         try
         {
             labelMessage.Text = string.Empty;
             btnSave.Visible   = false;
             btnUpdate.Visible = true;
             btnDelete.Visible = true;
             btnCancel.Visible = true;
             int mappingID = Convert.ToInt32(e.CommandArgument);
             hdMappingID.Value = mappingID.ToString();
             using (MappingTableRT receiverTransfer = new MappingTableRT())
             {
                 MappingTable mapping = receiverTransfer.GetMappingByIID(mappingID);
                 FillMappingTableForEdit(mapping);
             }
         }
         catch (Exception ex)
         {
             labelMessage.Text      = "Error : " + ex.Message;
             labelMessage.ForeColor = System.Drawing.Color.Red;
         }
     }
 }
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                labelMessage.Text = string.Empty;
                using (MappingTableRT receiverTransfer = new MappingTableRT())
                {
                    hdIsEdit.Value = "true";
                    MappingTable mapping = CreateMappingTable();

                    if (mapping != null)
                    {
                        //    if (receiverTransfer.IsMappingTableNameExistOtherRows(mapping.IID, mapping.Name) && receiverTransfer.IsMappingNameExistOtherRows(mapping.IID, mapping.Name))
                        //    {
                        //        labelMessage.Text = "Mapping Code " + txtCode.Text + " & Name " + txtName.Text + " Already Exists!";
                        //        labelMessage.ForeColor = System.Drawing.Color.Red;
                        //        return;
                        //    }
                        //    if (receiverTransfer.IsMappingCodeExistOtherRows(mapping.IID, mapping.Code))
                        //    {
                        //        labelMessage.Text = "Mapping Code  " + txtCode.Text + " Already Exists!";
                        //        labelMessage.ForeColor = System.Drawing.Color.Red;
                        //        return;
                        //    }

                        //    else if (receiverTransfer.IsMappingNameExistOtherRows(mapping.IID, mapping.Name))
                        //    {
                        //        labelMessage.Text = "Mapping Name  " + txtName.Text + " Already Exists!";
                        //        labelMessage.ForeColor = System.Drawing.Color.Red;
                        //        return;
                        //    }
                        //else
                        //{
                        receiverTransfer.UpdateMappingTable(mapping);
                        labelMessage.Text      = "Data successfully updated...";
                        labelMessage.ForeColor = System.Drawing.Color.Green;
                        //}
                    }
                    else
                    {
                        labelMessage.Text      = "Data not updated...";
                        labelMessage.ForeColor = System.Drawing.Color.Red;
                    }
                }
                ClearField();
                SetButton();
                btnSave.Visible = true;
                LoadMappingTable();
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                labelMessage.Text = string.Empty;
                using (MappingTableRT receiverTransfer = new MappingTableRT())
                {
                    //List<Mapping> MappingList = new List<Mapping>(); // Comment By Hasan
                    //MappingList = receiverTransfer.GetMappingName(txtName.Text);
                    //if (MappingList != null && MappingList.Count > 0)
                    if (receiverTransfer.IsMappingTableCodeExists(txtMappingName.Text) && (receiverTransfer.IsMappingTableNameExists(txtMappingName.Text)))
                    {
                        labelMessage.Text      = "Mapping  " + txtMappingName.Text + " Already Exists!";
                        labelMessage.ForeColor = System.Drawing.Color.Red;
                        return;
                    }

                    //else if (receiverTransfer.IsMappingTableNameExists(txtMappingName.Text))
                    //{
                    //    labelMessage.Text = "Mapping   " + txtMappingName.Text + " Already Exists!";
                    //    labelMessage.ForeColor = System.Drawing.Color.Red;
                    //    return;
                    //}
                    //else if (receiverTransfer.IsMappingTableNameExists(txtMappingName.Text))
                    //{
                    //    labelMessage.Text = "Mapping Name  " + txtMappingName.Text + " Already Exists!";
                    //    labelMessage.ForeColor = System.Drawing.Color.Red;
                    //    return;
                    //}

                    MappingTable mapping = CreateMappingTable();
                    receiverTransfer.AddMappingTable(mapping);
                    if (mapping.IID > 0)
                    {
                        labelMessage.Text      = "Data successfully saved...";
                        labelMessage.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        labelMessage.Text      = "Data not saved...";
                        labelMessage.ForeColor = System.Drawing.Color.Red;
                    }
                }

                ClearField();
                LoadMappingTable();
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
 private void LoadMappingTable()
 {
     try
     {
         using (MappingTableRT receiverTransfer = new MappingTableRT())
         {
             lvMapping.DataSource = receiverTransfer.GetAllMappingTableForListView();;
             lvMapping.DataBind();
         }
     }
     catch (Exception ex)
     {
         labelMessage.Text      = "Error : " + ex.Message;
         labelMessage.ForeColor = System.Drawing.Color.Red;
     }
 }