Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                generateMapclass();
                string strTabName = ddlTableName.SelectedValue.ToString().ToUpper();
                //strTabName = "tre_random".ToUpper();;
                dataschemaGrid.Refresh();
                DataTable dt  = (DataTable)dataschemaGrid.DataSource;
                DataRow[] drs = dt.Select("TYPE=" + (int)Enums.ColType.Key);
                if (drs.Length == 0)
                {
                    Telerik.WinControls.RadMessageBox.Show(this, "Should map 'Key' to at least one column.", "Information", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                    return;
                }

                drs = dt.Select("TYPE=" + (int)Enums.ColType.Time);

                if (drs.Length > 1)
                {
                    // Telerik.WinControls.RadMessageBox.Show(this, "Should not map 'Time' to more than one column.", "Information", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                }
                else if (drs.Length == 0)
                {
                    Telerik.WinControls.RadMessageBox.Show(this, "Should map 'Time' to at least one column.", "Information", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                    return;
                }


                drs = dt.Select("Required='True'");
                if (drs.Length > 0)
                {
                    Common.strfiltertxt = clsDSOBJ.fnselectFilterCondition(Common.iProjectID);
                    clsDSOBJ.fnInsertTreMApping(drs, strTabName, Common.strfiltertxt, Common.iProjectID);
                    // clsDSOBJ.fnCreateTreMApping(drs, strTabName,Common.strfiltertxt);
                    Common.strTableName = ddlTableName.SelectedValue.ToString();
                    //  Common.strTableName = "tre_random";
                    Common.bIsTableMapped = true;
                    Common.SetLoginDetailsToRegistry();
                    dataschemaGridbinding();
                }
            }
            catch (Exception ex)
            {
                Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }