Beispiel #1
0
        public static dynamic check_InternetID_exist(string contains)
        {
            dynamic found = new ExpandoObject();

            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = getConnection();

                found.status   = false;
                found.idstring = "";
                found.username = contains;
                found.remark   = "Username must not be empty.";



                if (!string.IsNullOrEmpty(contains))
                {
                    var ds = tx.individual_datas.FirstOrDefault(w => w.username == contains);
                    found.status   = false;
                    found.idstring = "";
                    found.username = contains;
                    found.remark   = "Client Data Not Downloaded yet";

                    if (ds != null)
                    {
                        found.status   = true;
                        found.idstring = "";
                        found.username = ds.username;
                        found.remark   = "Client Data Downloaded, but yet to Enroll";
                        found.enrolled = false;

                        var ds2 = tx.userTable_1s
                                  .FirstOrDefault(w => (w.username == contains) || (w.idString == contains));
                        if (ds2 != null)
                        {
                            found.status   = true;
                            found.idstring = ds2.idString;
                            found.username = ds2.username;
                            found.remark   = "Client already Enrolled......";
                            found.enrolled = true;
                            //found.Add(ds2.idString, ds2.username);
                        }
                    }
                    else
                    {
                        var ds2 = tx.userTable_1s.FirstOrDefault(w => (w.username == contains) || (w.idString == contains));
                        if (ds2 != null)
                        {
                            found.status   = true;
                            found.idstring = ds2.idString;
                            found.username = ds2.username;
                            found.remark   = "Client Data not Downloaded, but " + Environment.NewLine + "Client already Enrolled......";
                            found.enrolled = false;
                            //found.Add(ds2.idString, ds2.username);
                        }
                    }
                }
            }
            return(found);
        }
Beispiel #2
0
        private void show_ClientExist()
        {
            //pix_login.Visible = true;
            String          enteredUsername = xamlTextBoxUsername.Text.Trim();
            individual_data strResponse     = null;

            //Task.Run(() =>
            {
                {
                    // displayMessage("Verifying Template File.....", Utils.COLOR_DERMALOG_RED);
                    //string externalAPI = Properties.Settings.Default.ExternalAPIAddress;
                    //string servNAME = string.Format("infometriq-partner-api/individuals/{0}/username", enteredUsername);
                    //strResponse = Utils.call_External_WEBAPI_GETService(servNAME);
                    using (tranxDataContext tx = new tranxDataContext())
                    {
                        tx.Connection.ConnectionString = Utils.getConnection();
                        var ds = tx.individual_datas.FirstOrDefault(s => s.username == enteredUsername);
                        strResponse = ds;
                        //strResponse = Newtonsoft.Json.JsonConvert.SerializeObject(ds);
                    }
                    //strResponse = Utils.call_WEBAPI_GETService("infometriq-partner-api/individuals");
                }
            }
            //).Wait();


            //AlertForm1 fmm = new AlertForm1("Client Data Received Successfully.....");
            //fmm.ShowDialog();

            //pix_login.Visible = false;


            winforms.Form_data fm = new winforms.Form_data(strResponse, true);
            fm.ShowDialog();
        }
Beispiel #3
0
        public static Dictionary <long, LocalUser> convertFoldersTosingleUser(string username)
        {
            //LocalDB.makeDirectory();

            Dictionary <long, LocalUser> userList = new Dictionary <long, LocalUser>();

            using (tranxDataContext tx = new tranxDataContext())
            {
                // string[] dirs = Directory.GetDirectories(StoragePath);
                tx.Connection.ConnectionString = Utils.getConnection();
                var usr = tx.userTable_1s.FirstOrDefault(w => w.idString == username);
                if (usr == null)
                {
                    return(userList);
                }

                //if (dirs == null || dirs.Length == 0)
                //    return userList;
                else
                //foreach (userTable_1 dir in usr)
                {
                    LocalUser localUser = new LocalUser();
                    //String dirId = Path.GetFileName(dir);
                    localUser.ID = long.Parse(usr.idString);

                    //StreamReader sr = new StreamReader(Path.Combine(dir, FILE_DEMOGRAPHIC));
                    localUser.Name = usr.username;
                    //sr.Close();
                    var fng = tx.fingerprint_Tables.Select(f => f).Where(w => w.refNO == usr.idString);
                    //string[] templateFiles = Directory.GetFiles(dir, "template*");
                    foreach (fingerprint_Table templateFile in fng)
                    {
                        byte[] data = Utils.convert_string2byteArray(templateFile.finger_data);

                        //String templateFileString = Path.GetFileNameWithoutExtension(templateFile);
                        String fingerPos = templateFile.position;

                        Fingerprint fingerprint = new Fingerprint();
                        fingerprint.Template = new Template();

                        //fingerprint.Template.Data = data;
                        string templateFormat = Properties.Settings.Default.TemplateFORMAT;
                        //fingerprint.Template.Format = Utils.Generate_Template_Encoder(templateFormat);

                        //fingerprint.Template.Format = data;

                        fingerprint.Template.SetData(data, Utils.Generate_Template_Encoder(templateFormat));

                        //fingerprint.Template.SetData(data, Dermalog.Afis.FingerCode3.Enums.TemplateFormat.Dermalog);
                        fingerprint.Position = UInt32.Parse(fingerPos);
                        localUser.Fingerprints.Add(fingerprint);
                    }

                    userList.Add(localUser.ID, localUser);
                }
            }

            return(userList);
        }
Beispiel #4
0
        private void NewMethod_verify()
        {
            AFISVerificationResult result = new AFISVerificationResult();
            LocalUser user_found          = new LocalUser();
            //_afis = new LocalAFIS();
            //Dictionary<long, LocalUser> userList = _afis.GetUserList();
            int threshold = Properties.Settings.Default.VerificationThreshold;

            //xamlListBoxUsers.Items.Clear();
            //bool found = false; ;
            //double matchValue = 0;


            //List<Fingerprint> fg = new List<Fingerprint>();
            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = Utils.getConnection();
                var fng = tx.fingerprint_Table_verifies.Select(s => s);
                lst_feedback2.Items.Clear();
                //foreach (fingerprint_Table_verify templateFile in fng)
                Parallel.ForEach(fng, templateFile =>
                {
                    lst_feedback2.Items.Insert(0, templateFile.refNO);

                    byte[] data = Utils.convert_string2byteArray(templateFile.finger_data);

                    //String templateFileString = Path.GetFileNameWithoutExtension(templateFile);
                    String fingerPos = templateFile.position;

                    Fingerprint fingerprint = new Fingerprint();
                    fingerprint.Template    = new Template();
                    fingerprint.Template.SetData(data, Dermalog.Afis.FingerCode3.Enums.TemplateFormat.Dermalog);
                    fingerprint.Position = UInt32.Parse(fingerPos);
                    //fg.Add(fingerprint);

                    dynamic verifyme = gen_FingerPrints(templateFile.refNO, fingerprint);

                    templateFile.VerifiedAS = "NOT_Verified_OK";
                    if (verifyme.found)
                    {
                        templateFile.VerifiedAS = "VerifiedOK";
                    }
                }

                                 );

                tx.SubmitChanges();
            }
            //return "";
        }
Beispiel #5
0
        private dynamic gen_FingerPrints(string refNO, Fingerprint fp)
        {
            dynamic verify_Result         = new ExpandoObject();
            AFISVerificationResult result = new AFISVerificationResult();
            int threshold = Properties.Settings.Default.VerificationThreshold;

            //List<Fingerprint> fg = new List<Fingerprint>();
            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = Utils.getConnection();
                var fng = tx.fingerprint_Tables.Select(s => s).Where(w => w.refNO == refNO);
                //lst_feedback.Items.Clear();
                //foreach (fingerprint_Table_verify templateFile in fng)
                Parallel.ForEach(fng, (templateFile, loopState) =>
                {
                    //lst_feedback.Items.Insert(0, templateFile.refNO);

                    byte[] data = Utils.convert_string2byteArray(templateFile.finger_data);

                    //String templateFileString = Path.GetFileNameWithoutExtension(templateFile);
                    String fingerPos = templateFile.position;

                    Fingerprint fingerprint = new Fingerprint();
                    fingerprint.Template    = new Template();
                    fingerprint.Template.SetData(data, Dermalog.Afis.FingerCode3.Enums.TemplateFormat.Dermalog);
                    //fingerprint.Position = UInt32.Parse(fingerPos);
                    //fg.Add(fingerprint);

                    double dScore = new Matcher().Match(fingerprint.Template, fp.Template);
                    //double dScore = new Matcher().Match(userFingerprints[i].Template, fingerprints[j].Template);

                    if (dScore > threshold)
                    {
                        //dMaxScore = dScore;
                        result.Score = dScore;;
                        result.Hit   = true;
                        //return result;
                        verify_Result.found     = true;
                        verify_Result.result    = result;
                        verify_Result.fingerPos = fingerPos;
                        //tx.SubmitChanges();
                        //str.Append(user.Value.Name);
                        loopState.Stop();
                    }
                });
            }
            return(verify_Result);
        }
Beispiel #6
0
        public static string get_ParamValue(string key)
        {
            string retval = "";

            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = getConnection();
                if (!string.IsNullOrEmpty(key))
                {
                    var ds2 = tx.appControlTable_1s.FirstOrDefault(w => w.paramName == key);
                    if (ds2 != null)
                    {
                        retval = ds2.paramValue;
                    }
                }
            }
            return(retval);
        }
Beispiel #7
0
        public static Dictionary <string, string> get_RefCode(string contains)
        {
            Dictionary <string, string> found = new Dictionary <string, string>();

            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = getConnection();
                if (!string.IsNullOrEmpty(contains))
                {
                    var ds2 = tx.userTable_1s.FirstOrDefault(w => w.username == contains);
                    if (ds2 != null)
                    {
                        string newID = "NGN-IID-" + ds2.idString;
                        found.Add(newID, ds2.username);
                    }
                }
            }
            return(found);
        }
Beispiel #8
0
        public static dynamic get_finger_Details(string refNO)
        {
            dynamic dd = new ExpandoObject();

            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = getConnection();
                var ds = tx.userTable_1s
                         //.Where(w => w.idString == refNO)
                         //.Select(s => s.username)
                         .FirstOrDefault(w => w.idString == refNO);

                dd.username = ds.username;
                dd.Photo    = ds.live_image;
                //dd.Photo = Utils.convert_string2byteArray(ds.live_image);
                return(dd);
            }
            //return null
        }
Beispiel #9
0
        public static bool check_usernames_exist(string contains)
        {
            bool found = false;

            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = getConnection();
                if (!string.IsNullOrEmpty(contains))
                {
                    var ds = tx.userTable_1s.FirstOrDefault(w => w.username == contains);


                    if (ds != null)
                    {
                        found = true;
                    }
                }
            }
            return(found);
        }
Beispiel #10
0
        // bool stop_scan = false;
        private void xamlListBoxUsers_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                //connect_Device();
                //txt_selectedUser.Text
                string user_found = xamlListBoxUsers.SelectedItem.ToString();
                txt_selectedUser.Text = user_found;
                if (!string.IsNullOrEmpty(user_found))
                {
                    // = txt_selectedUser.Text;
                    using (tranxDataContext tx = new tranxDataContext())
                    {
                        var ds = tx.userTable_1s.Where(w => w.username == user_found)
                                 .Select(s => s);

                        if (ds.Any())
                        {
                            byte[] bb = Utils.convert_string2byteArray(ds.First().live_image);
                            pic_Webcam.Image = Utils.convertBinarytoImage(bb);

                            //tx.SubmitChanges();
                        }
                        else
                        {
                            pic_Webcam.Image = null;
                        }
                    }

                    // Start_Capture_selectedUser();
                }
            }
            catch (Exception ex)
            {
                string str = ex.Message;
            }



            //backgroundWorker1.RunWorkerAsync();
        }
Beispiel #11
0
        public static void show_ClientExist(String enteredUsername)
        {
            //pix_login.Visible = true;
            //String enteredUsername = xamlTextBoxUsername.Text.Trim();
            //individual_data strResponse = null;
            dynamic strResponse = new ExpandoObject();
            //Task.Run(() =>
            {
                {
                    using (tranxDataContext tx = new tranxDataContext())
                    {
                        tx.Connection.ConnectionString = Utils.getConnection();
                        var ds = tx.individual_datas
                                 .FirstOrDefault(s => s.username == enteredUsername);

                        if (ds != null)
                        {
                            strResponse = ds;
                            winforms.Form_data fm = new winforms.Form_data(strResponse, true);
                            fm.ShowDialog();
                        }
                        else
                        {
                            AlertForm1 al = new AlertForm1("Individual Data noavailable Locally",
                                                           AlertForm1.AlertOptions.OK, AlertForm1.AlertType.error);
                            al.ShowDialog();
                        }
                        //strResponse = Newtonsoft.Json.JsonConvert.SerializeObject(ds);
                    }
                    //strResponse = Utils.call_WEBAPI_GETService("infometriq-partner-api/individuals");
                }
            }
            //).Wait();


            //AlertForm1 fmm = new AlertForm1("Client Data Received Successfully.....");
            //fmm.ShowDialog();

            //pix_login.Visible = false;
        }
Beispiel #12
0
        public static List <string> get_usernames(string contains)
        {
            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = getConnection();
                if (!string.IsNullOrEmpty(contains))
                {
                    var ds = tx.userTable_1s.Where(w => w.username.StartsWith(contains))
                             .Select(s => s.username).ToList();


                    return(ds);
                }
                else
                {
                    var ds = tx.userTable_1s
                             .Select(s => s.username).ToList();


                    return(ds);
                }
            }
        }
Beispiel #13
0
        public static Dictionary <string, string> check_InternetID_exist_old(string contains)
        {
            Dictionary <string, string> found = new Dictionary <string, string>();

            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = getConnection();
                if (!string.IsNullOrEmpty(contains))
                {
                    var ds = tx.individual_datas.FirstOrDefault(w => w.username == contains);


                    if (ds != null)
                    {
                        var ds2 = tx.userTable_1s.FirstOrDefault(w => w.username == contains);
                        if (ds2 != null)
                        {
                            found.Add(ds2.idString, ds2.username);
                        }
                    }
                }
            }
            return(found);
        }
Beispiel #14
0
        private void NewMethod()
        {
            AFISVerificationResult result = new AFISVerificationResult();
            LocalUser user_found          = new LocalUser();

            _afis = new LocalAFIS();
            Dictionary <long, LocalUser> userList = _afis.GetUserList();
            int threshold = Properties.Settings.Default.VerificationThreshold;
            //xamlListBoxUsers.Items.Clear();
            bool   found      = false;;
            double matchValue = 0;


            List <Fingerprint> fg = new List <Fingerprint>();

            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = Utils.getConnection();
                var fng = tx.fingerprint_Table_verifies.Select(s => s);
                lst_feedback.Items.Clear();
                //foreach (fingerprint_Table_verify templateFile in fng)
                Parallel.ForEach(fng, templateFile =>
                {
                    lst_feedback.Items.Insert(0, templateFile.refNO);

                    byte[] data = Utils.convert_string2byteArray(templateFile.finger_data);

                    //String templateFileString = Path.GetFileNameWithoutExtension(templateFile);
                    String fingerPos = templateFile.position;

                    Fingerprint fingerprint = new Fingerprint();
                    fingerprint.Template    = new Template();
                    fingerprint.Template.SetData(data, Dermalog.Afis.FingerCode3.Enums.TemplateFormat.Dermalog);
                    fingerprint.Position = UInt32.Parse(fingerPos);
                    fg.Add(fingerprint);

                    StringBuilder str = new StringBuilder();
                    Parallel.ForEach(userList, (user, loopState) =>
                                     //Parallel.ForEach(userList, options, (user, loopState) =>
                    {
                        foreach (Fingerprint fd in user.Value.Fingerprints)
                        {
                            //str.Clear();
                            //xamlListBoxUsers.Items.Add(user);
                            double dScore = new Matcher().Match(fingerprint.Template, fd.Template);
                            //double dScore = new Matcher().Match(userFingerprints[i].Template, fingerprints[j].Template);

                            if (dScore > threshold)
                            {
                                //dMaxScore = dScore;
                                result.Score = dScore;;
                                result.Hit   = true;
                                //return result;
                                templateFile.identifiedAS = user.Value.Name;
                                //tx.SubmitChanges();
                                //str.Append(user.Value.Name);
                                loopState.Stop();
                            }
                        }
                        //result = _afis.IdentifyUser_New(user.Key, fg, Properties.Settings.Default.VerificationThreshold);
                        //result = _afis.IdentifyUser(user.Key, fingerprints_all, Properties.Settings.Default.VerificationThreshold);
                        //if (result.Hit)
                        {
                            //templateFile.identifiedAS = str.ToString();
                            //found = true;
                            //matchValue = result.Score;
                            //loopState.Stop();
                        }
                    });
                });
                tx.SubmitChanges();
            }
            //return "";
        }
Beispiel #15
0
        private void NewServerConnetionMethod(bool suppressMsg = false)
        {
            try
            {
                string  serverName;      // = comboBox1.SelectedValue.ToString() ;
                Server  server;
                Boolean cmanualflag = ch_useDirect.Checked;

                serverName = ((cb_datasource.Items.Count == 0) ? "" : cb_datasource.SelectedValue.ToString());

                if ((serverName.Trim() == "") || (cmanualflag))
                {
                    serverName = txt_serverAddress.Text.Trim();    //      ToString();
                    SqlConnection    sqlj = getNewSqlConnection(serverName, txt_userID.Text, txt_pwd.Text);
                    ServerConnection scip = new ServerConnection(sqlj);


                    String dbname   = txt_serverSource.Text.Trim();
                    String con_str  = ConfigurationManager.ConnectionStrings["APPDIRECT"].ConnectionString;
                    String con_str1 = con_str.Replace("SERVERNAME", serverName);
                    con_str1 = con_str1.Replace("DBNAME", dbname);
                    con_str1 = con_str1.Replace("USERNAME", txt_userID.Text.Trim());
                    con_str1 = con_str1.Replace("PASSWORD", txt_pwd.Text.Trim());

                    Properties.Settings.Default.informetriQConnectionString = con_str1;
                    // MessageBox.Show(con_str1);
                    txt_connection.Text = con_str1;
                    Properties.Settings.Default.CONNECTIONMODE = "1";

                    Properties.Settings.Default.Save();

                    using (tranxDataContext tx = new tranxDataContext())
                    {
                        try
                        {
                            tx.Connection.ConnectionString = con_str1;
                            int ii = tx.ExecuteCommand(string.Format("Exec testtesttesttest '{0}'", txt_userID.Text));
                            tx.SubmitChanges();
                            if (!suppressMsg)
                            {
                                AlertForm1 al = new AlertForm1("Connection Successful...", AlertForm1.AlertOptions.OK, AlertForm1.AlertType.success);
                                al.ShowDialog();
                                //MessageBox.Show("Connection Successful");
                            }
                        }
                        catch (Exception ex)
                        {
                            if (!suppressMsg)
                            {
                                AlertForm1 al = new AlertForm1(ex.Message, AlertForm1.AlertOptions.OK, AlertForm1.AlertType.error);
                                al.ShowDialog();
                                //MessageBox.Show(ex.Message);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #16
0
        public static void createUserFolder_DBTable_old(LocalUser localUser, dynamic dd, Image pic_Webcam = null)
        {
            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = Utils.getConnection();
                userTable_1 usr      = new userTable_1();
                string      idLength = string.Format("D{0}", Utils.get_ParamValue("IDLENGTH"));
                //string idLength = string.Format("D{0}", Utils.get_ParamValue(localUser.Name));
                String idString = localUser.ID.ToString(idLength);
                String idPath   = Path.Combine(StoragePath, idString);
                if (!Directory.Exists(idPath))
                {
                    Directory.CreateDirectory(idPath);
                }

                String       userPath = Path.Combine(idPath, FILE_DEMOGRAPHIC);
                StreamWriter sw       = new StreamWriter(userPath);
                sw.Write(localUser.Name);
                sw.Flush();
                sw.Close();


                usr.id               = localUser.ID;
                usr.idString         = idString;
                usr.idPath           = idPath;
                usr.userPath         = FILE_DEMOGRAPHIC;
                usr.username         = localUser.Name;
                usr.finger_remark    = dd.remark;
                usr.createdby        = dd.loggedin_staff;
                usr.LastActivityDate = DateTime.Now;
                usr.finger_Enrolled  = "Y";

                if (pic_Webcam != null)
                {
                    //string strpath = idPath + @"\" + idString + ".jpg";
                    //pic_Webcam.Save(strpath);
                    //Task.Run(() =>
                    //{
                    //    MemoryStream ms = new MemoryStream();
                    //    pic_Webcam.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
                    //    byte[] bb = ms.ToArray();
                    //    //ms = null;
                    //    ms.Dispose();
                    //    ms.Close();
                    ////Image img = Image.FromFile(strpath);
                    ////byte[] bArr = imgToByteArray(img);

                    ////byte[] bb = Utils.convertImagetoBinary(pic_Webcam);
                    ////byte[] bb = Utils.convertImagetoBinary(pic_Webcam);
                    //usr.live_image = Utils.convert_byteArray2string(bb);
                    //}).Wait();
                    dynamic ue = new ExpandoObject();
                    ue.idstring   = idString;
                    ue.Location   = "Head Office";
                    ue.imageSTR   = Utils.ImageToBase64(pic_Webcam);
                    ue.stage      = "CAPTURE";
                    ue.capturedBy = dd.loggedin_staff;
                    ue.capturedDT = DateTime.Now;


                    object usertable_extension = ue;

                    string str = Newtonsoft.Json.JsonConvert.SerializeObject(usertable_extension);
                    //string APIHandle = @"infometriq-partner-api/capture/feedback";
                    string APIHandle = @"submit_usertable_extension";

                    string resp = "";
                    Task.Run(() =>
                    {
                        //resp = Utils.call_External_WEBAPI_Service(APIHandle, ss);
                        resp = Utils.call_WEBAPI_Service(APIHandle, str);
                    }).Wait();


                    usr.live_image = Utils.ImageToBase64(pic_Webcam);
                }
                tx.userTable_1s.InsertOnSubmit(usr);


                for (int i = 0; i < localUser.Fingerprints.Count; i++)
                {
                    String templateString = String.Format("template{0}{1}.dat", i.ToString("D2"),
                                                          localUser.Fingerprints[i].Position.ToString("D2"));

                    String fingerPos = String.Format("{0}{1}", i.ToString("D2"),
                                                     localUser.Fingerprints[i].Position.ToString("D2"));

                    string Hand         = String.Format("{0}", localUser.Fingerprints[i].Hand.ToString());
                    string HandPosition = String.Format("{0}", localUser.Fingerprints[i].Position.ToString("D2"));


                    String     templatePath = Path.Combine(idPath, templateString);
                    FileStream fs           = File.Create(templatePath);
                    byte[]     data         = localUser.Fingerprints[i].Template.GetData();
                    fs.Write(data, 0, data.Length);
                    fs.Flush();
                    fs.Close();

                    fingerprint_Table fp = new fingerprint_Table();
                    fp.refNO          = idString;
                    fp.position       = fingerPos;
                    fp.hand_spec      = Hand;
                    fp.hand_position  = HandPosition;
                    fp.templatePath   = idPath;
                    fp.templateString = templateString;
                    fp.finger_data    = Utils.convert_byteArray2string(data);
                    tx.fingerprint_Tables.InsertOnSubmit(fp);
                }
                tx.SubmitChanges();
            }
        }
Beispiel #17
0
        private void saveData(dynamic dm, string Profession_desc, string strResponse)
        {
            //dynamic dm = new ExpandoObject();
            // individual_data ind = Newtonsoft.Json.JsonConvert.DeserializeObject<individual_data>(dd);
            //individual_data ind = dd;
            try
            {
                using (tranxDataContext tx = new tranxDataContext())
                {
                    tx.Connection.ConnectionString = Utils.getConnection();
                    string strUsername = dm.username;
                    var    ds          = tx.individual_datas.FirstOrDefault(s => s.username == strUsername);

                    if (ds == null)
                    {
                        individual_data ind = new individual_data();
                        ind.id                = dm.id;
                        ind.first_name        = dm.first_name;
                        ind.last_name         = dm.last_name;
                        ind.username          = dm.username;
                        ind.email             = dm.email;
                        ind.dob               = dm.dob;
                        ind.state             = dm.state;
                        ind.country           = dm.country;
                        ind.profession        = dm.profession;
                        ind.about             = dm.about;
                        ind.phone             = dm.phone;
                        ind.website           = dm.website;
                        ind.gender            = dm.gender;
                        ind.confirmation_code = dm.confirmation_code;
                        ind.social_facebook   = dm.social_facebook;
                        ind.social_twitter    = dm.social_twitter;
                        ind.social_instagram  = dm.social_instagram;
                        ind.social_linkedin   = dm.social_linkedin;
                        ind.social_youtube    = dm.social_youtube;
                        ind.politics          = dm.politics;
                        ind.recognition       = dm.recognition;
                        ind.hide_dob          = dm.hide_dob;
                        ind.rating            = dm.rating;
                        ind.status            = dm.status;
                        ind.verified_status   = dm.verified_status;
                        ind.created_on        = dm.created_on;
                        ind.last_updated_on   = dm.last_updated_on;
                        ind.state_name        = dm.state_name;

                        ind.profession_name = Profession_desc;
                        ind.strResponse     = strResponse;
                        ind.account_type    = dm.account_type;
                        tx.individual_datas.InsertOnSubmit(ind);
                        tx.SubmitChanges();

                        AlertForm1 fm  = new AlertForm1("Saved Successfully...", AlertForm1.AlertOptions.OK, AlertForm1.AlertType.success);
                        var        rst = fm.ShowDialog();
                    }
                    else
                    {
                        AlertForm1 fm  = new AlertForm1("User Details already saved...", AlertForm1.AlertOptions.OK, AlertForm1.AlertType.info);
                        var        rst = fm.ShowDialog();
                        btn_save.Enabled = false;
                    }
                }
            }
            catch (Exception ex)
            {
                AlertForm1 fm  = new AlertForm1(ex.Message, AlertForm1.AlertOptions.OK, AlertForm1.AlertType.error);
                var        rst = fm.ShowDialog();
            }
        }