Пример #1
0
        private void cmd_save_Click(object sender, EventArgs e)
        {
            //f_mec.MentalDisorder = cbo_mendal.Text;
            //f_mec.Cardiovascular = cbo_cardio.Text;
            //f_mec.CircumferenceChest = cbo_circum.Text;
            //f_mec.Infection = cbo_incfection.Text;
            //f_mec.NervousSystem = cbo_nervous.Text;
            //f_mec.Digestive = cbo_digestive.Text;
            //f_mec.Liver = cbo_liver.Text;
            //f_mec.Anemia = cbo_anemia.Text;
            //f_mec.UrineSyphilisis = cbo_urine.Text;
            //this.Close();


            DataClasses2DataContext db = new DataClasses2DataContext(Properties.Settings.Default.MyConString);

            var count = db.sp_countKrPan(this.Tag.ToString()).FirstOrDefault();

            if (count.Column1.Value >= 1)
            {
                db.sp_update_krpan(cbo_mendal.Text, cbo_cardio.Text, cbo_circum.Text, cbo_incfection.Text, cbo_nervous.Text, cbo_digestive.Text, cbo_liver.Text, cbo_anemia.Text, cbo_urine.Text, this.Tag.ToString());
                //db.ExecuteCommand("UPDATE [Centerport_Medical].[dbo].[tbl_krpan] SET [BloodDisorder]={0}, [MentalDisorder]={1}, [Cardiovascular]={2}, [CircumferenceChest]={3}, [Infection]={4}, [NervousSystem]={5}, [Digestive]={6}, [Liver]={7}, [Anemia]={8}, [UrineSyphilisis]={9} WHERE ([cn]='10')", "", cbo_mendal.Text, cbo_cardio.Text, cbo_circum.Text, cbo_incfection.Text, cbo_nervous.Text,         cbo_digestive.Text, cbo_liver.Text, cbo_anemia.Text, cbo_urine.Text, this.Tag.ToString());
                //, [Cardiovascular]={2}, [CircumferenceChest]={3}, [Infection]={4},    [NervousSystem]={5}, [Digestive]={6}, [Liver]={7},   [Anemia]={8},  [UrineSyphilisis]={9}
            }
            else
            {
                db.ExecuteCommand("INSERT INTO [Centerport_Medical].[dbo].[tbl_krpan] ([Resultid], [BloodDisorder], [MentalDisorder], [Cardiovascular], [CircumferenceChest], [Infection], [NervousSystem], [Digestive], [Liver], [Anemia], [UrineSyphilisis]) VALUES ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10})", this.Tag.ToString(), "", cbo_mendal.Text, cbo_cardio.Text, cbo_circum.Text, cbo_incfection.Text, cbo_nervous.Text, cbo_digestive.Text, cbo_liver.Text, cbo_anemia.Text, cbo_urine.Text);
            }                                                                                                                                                                                                                                                                                                           //[Resultid], [BloodDisorder], [MentalDisorder], [Cardiovascular], [CircumferenceChest], [Infection],   [NervousSystem],  [Digestive],       [Liver],        [Anemia],      [UrineSyphilisis]
            this.Close();
        }
Пример #2
0
        private void cmd_save_Click(object sender, EventArgs e)
        {
            string Levelcn = ((this.cbo_level.SelectedItem as ComboBoxItem).Value.ToString());

            if (txt_name.Text == "" || txt_username.Text == "" || txt_password.Text == "" || txt_password.Text != txt_confirmPassword.Text || cbo_level.Text == "")
            {
                MessageBox.Show("Please check/Verify required informaion", "Action Denied", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            else
            {
                if (cmd_save.Text == "Save")
                {
                    db.ExecuteCommand("INSERT INTO [Centerport_Medical].[dbo].[tbl_user] ([Fullname], [Username], [Password], [UserLevel], [Remark]) VALUES ({0},{1}, {2}, {3}, {4})", txt_name.Text, txt_username.Text, EncodeString.Encrypt(txt_password.Text), Levelcn, "1");
                    Availability(false, "Save");
                    cmd_edit.Enabled = false;
                    cmd_new.Enabled  = true;
                    cmd_save.Enabled = false;
                    txt_name.Clear();
                    txt_username.Clear();
                    txt_password.Clear();
                    txt_confirmPassword.Clear();
                    cbo_level.SelectedIndex = -1;
                    cmd_new.Text            = "New";
                }
                else
                {
                    db.ExecuteCommand("UPDATE [Centerport_Medical].[dbo].[tbl_user] SET [Fullname]={0}, [Username]={1}, [Password]={2}, [UserLevel]={3} WHERE ([cn]={4})", txt_name.Text, txt_username.Text, EncodeString.Encrypt(txt_password.Text), Levelcn, dataGridView1.SelectedRows[0].Cells[0].Value.ToString());
                    Availability(false, "Modify");
                    cmd_edit.Enabled = false;
                    cmd_new.Enabled  = true;
                    cmd_save.Enabled = false;
                    txt_confirmPassword.Clear();
                    cmd_new.Text = "New";
                }
            }

            loaduser();
        }