Esempio n. 1
0
 private void btnOK_Click(object sender, RoutedEventArgs e)
 {
     if (txtCustID.Text.Equals("") || txtFirstname.Text.Equals("") || txtLastname.Text.Equals(""))
     {
         MessageBox.Show("Bạn không được để trống CustID hoặc Họ và Tên");
     }
     else
     {
         INDIVIDUAL    i  = new INDIVIDUAL();
         IndividualDao id = new IndividualDao();
         i.CUST_ID    = int.Parse(txtCustID.Text);
         i.LAST_NAME  = txtLastname.Text;
         i.FIRST_NAME = txtFirstname.Text;
         if (Birthdate.Text.Equals(""))
         {
             i.BIRTH_DATE = null;
         }
         else
         {
             i.BIRTH_DATE = Convert.ToDateTime(Birthdate.Text);
         }
         if (cv == "insert")
         {
             id.Insert(i);
         }
         else
         {
             id.Update(i);
         }
         this.Close();
         il.UpdateDatagrid();
     }
 }
Esempio n. 2
0
        /*   public ObservableCollection<CUSTOMER> UpdateListview()
         * {
         *     List<EMPLOYEE> listp = CustomerDao.Instance().getAll();
         *
         *     ObservableCollection<CUSTOMER> result = new ObservableCollection<CUSTOMER>();
         *     foreach (EMPLOYEE p in listp)
         *     {
         *         CUSTOMER pv = new CUSTOMER(p);
         *         result.Add(pv);
         *     }
         *     return result;
         *
         * }
         */
        private void SelectedItem(CUSTOMER p)
        {
            ResetView();
            OFFICER    of  = OfficerDao.Instance().SelectbyCustId(p.CUST_ID);
            BUSINESS   bu  = BusinessDao.Instance().SelectbyId(p.CUST_ID);
            INDIVIDUAL ind = IndividualDao.Instance().SelectbyId(p.CUST_ID);

            if (ind != null)
            {
                In_lastname  = ind.LAST_NAME;
                In_firstname = ind.FIRST_NAME;
                In_birthdate = ind.BIRTH_DATE.ToString();
            }
            if (of != null)
            {
                Of_lastname  = of.LAST_NAME;
                Of_firstname = of.FIRST_NAME;
                Of_title     = of.TITLE;
                Of_startdate = of.START_DATE.ToString();
                Of_enddate   = of.END_DATE.ToString();
            }
            if (bu != null)
            {
                Bu_name       = bu.NAME;
                Bu_stateid    = bu.STATE_ID;
                Bu_incorpdate = bu.INCORP_DATE.ToString();
            }
        }
Esempio n. 3
0
        private void buttonRegisterNewCustomer_Click(object sender, RoutedEventArgs e)//Новый клиент //Изменить данные клиента
        {
            if (buttonNewCustomer.Content.ToString() == "Register a new client")
            {
                CUSTOMER cust = new CUSTOMER();
                cust.ADDRESS      = textBoxAddressClient.Text;
                cust.CITY         = textBoxCityClient.Text;
                cust.FED_ID       = textBoxFedClient.Text;
                cust.POSTAL_CODE  = textBoxPostalCodeClient.Text;
                cust.STATE        = BankView.db.BRANCH.Where(x => x.BRANCH_ID == bank.Select).Select(y => y.STATE).FirstOrDefault();
                cust.CUST_TYPE_CD = "I";
                BankView.db.CUSTOMER.InsertOnSubmit(cust);
                BankView.db.SubmitChanges();
                INDIVIDUAL indiv = new INDIVIDUAL();
                indiv.FIRST_NAME = textBoxFirstClient.Text;
                indiv.LAST_NAME  = textBoxLastClient.Text;
                indiv.CUST_ID    = cust.CUST_ID;
                BankView.db.INDIVIDUAL.InsertOnSubmit(indiv);
                BankView.db.SubmitChanges();

                listBoxUser.ItemsSource = null;
                listBoxUser.ItemsSource = BankView.db.CUSTOMER.Where(x => x.CUST_TYPE_CD == "I");
            }
            else if (buttonNewCustomer.Content.ToString() == "Save changed data")
            {
                BankView.db.SubmitChanges();
            }
        }
        public static INDIVIDUAL GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 IND_ID)
        {
            INDIVIDUAL   objReturn = null;
            INDIVIDUALDB objDB     = new INDIVIDUALDB();

            objReturn = objDB.GetItem(CURRENT_USER, CURRENT_REGISTRY_ID, IND_ID);

            return(objReturn);
        }
        public static Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, INDIVIDUAL objSave)
        {
            Int32        objReturn = 0;
            INDIVIDUALDB objDB     = new INDIVIDUALDB();

            objReturn = objDB.Save(CURRENT_USER, CURRENT_REGISTRY_ID, objSave);

            return(objReturn);
        }
Esempio n. 6
0
 public IndividualEdit(INDIVIDUAL i, IndividualList il)
 {
     InitializeComponent();
     this.cv           = "update";
     this.il           = il;
     txtFirstname.Text = i.FIRST_NAME;
     txtLastname.Text  = i.LAST_NAME;
     txtCustID.Text    = i.CUST_ID.ToString();
     Birthdate.Text    = i.BIRTH_DATE.ToString();
 }
Esempio n. 7
0
        private void Find(FrameworkElement p)
        {
            string id = "";

            if (p != null)
            {
                var fe = p as Grid;
                if (fe != null)
                {
                    foreach (var item in fe.Children)
                    {
                        var tx = item as TextBox;
                        if (tx != null)
                        {
                            if (tx.Name.Equals("txtSearch"))
                            {
                                id = tx.Text;
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(id))
            {
                String key = id.ToLower();
                ObservableCollection <CUSTOMER> result = new ObservableCollection <CUSTOMER>();
                foreach (CUSTOMER c in CustomerLists)
                {
                    OFFICER    of   = OfficerDao.Instance().SelectbyCustId(c.CUST_ID);
                    BUSINESS   bu   = BusinessDao.Instance().SelectbyId(c.CUST_ID);
                    INDIVIDUAL ind  = IndividualDao.Instance().SelectbyId(c.CUST_ID);
                    String     temp = c.CUST_ID.ToString() + " " + c.ADDRESS + " " + c.CITY + " " + c.FED_ID + " " + c.POSTAL_CODE + " " + c.STATE + " ";
                    if (of != null && bu != null)
                    {
                        temp +=
                            of.FIRST_NAME + " " + of.LAST_NAME + " " + of.OFFICER_ID + " " + of.TITLE + " " + of.START_DATE.ToString() + " " + of.END_DATE.ToString() + " " +
                            bu.NAME + "  " + bu.STATE_ID + " " + bu.INCORP_DATE.ToString() + " ";
                    }
                    if (ind != null)
                    {
                        temp += ind.LAST_NAME + " " + ind.FIRST_NAME + " " + ind.BIRTH_DATE.ToString();
                    }
                    temp.ToLower();
                    if (temp.Contains(key))
                    {
                        result.Add(c);
                    }
                }
                CustomerLists = result;
            }
            else
            {
                CustomerLists = new ObservableCollection <CUSTOMER>(CustomerDao.Instance().getAll());
            }
        }
Esempio n. 8
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            INDIVIDUAL row = grindividual.SelectedItem as INDIVIDUAL;

            if (row == null)
            {
                MessageBox.Show("Bạn chưa chọn phòng nào", "Thông báo");
            }
            else
            {
                new IndividualEdit(row, this).Show();
            }
        }
Esempio n. 9
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            INDIVIDUAL row = grindividual.SelectedItem as INDIVIDUAL;

            if (row == null)
            {
                MessageBox.Show("Bạn chưa chọn phòng nào", "Thông báo");
            }
            else
            {
                IndividualDao In = new IndividualDao();
                In.Delete(row.CUST_ID);
                UpdateDatagrid();
            }
        }
Esempio n. 10
0
        public INDIVIDUAL ParseReaderCustom(DataRow row)
        {
            INDIVIDUAL objReturn = new INDIVIDUAL
            {
                BIRTH_DATE  = (DateTime?)GetNullableObject(row.Field <object>("INDIVIDUAL_BIRTH_DATE")),
                CREATED     = (DateTime?)GetNullableObject(row.Field <object>("INDIVIDUAL_CREATED")),
                CREATEDBY   = (string)GetNullableObject(row.Field <object>("INDIVIDUAL_CREATEDBY")),
                DEATH_DATE  = (DateTime?)GetNullableObject(row.Field <object>("INDIVIDUAL_DEATH_DATE")),
                FIRST_NAME  = (string)GetNullableObject(row.Field <object>("INDIVIDUAL_FIRST_NAME")),
                IND_ID      = (Int32)GetNullableObject(row.Field <object>("INDIVIDUAL_IND_ID")),
                LAST_NAME   = (string)GetNullableObject(row.Field <object>("INDIVIDUAL_LAST_NAME")),
                MIDDLE_NAME = (string)GetNullableObject(row.Field <object>("INDIVIDUAL_MIDDLE_NAME")),
                PATIENT_ID  = (Int32?)GetNullableObject(row.Field <object>("INDIVIDUAL_PATIENT_ID")),
                PREFIX      = (string)GetNullableObject(row.Field <object>("INDIVIDUAL_PREFIX")),
                SUFFIX      = (string)GetNullableObject(row.Field <object>("INDIVIDUAL_SUFFIX")),
                TITLE       = (string)GetNullableObject(row.Field <object>("INDIVIDUAL_TITLE")),
                UPDATED     = (DateTime?)GetNullableObject(row.Field <object>("INDIVIDUAL_UPDATED")),
                UPDATEDBY   = (string)GetNullableObject(row.Field <object>("INDIVIDUAL_UPDATEDBY"))
            };

            return(objReturn);
        }
Esempio n. 11
0
 public AccountView(ACCOUNT a)
 {
     this.id              = a.ACCOUNT_ID;
     this.avail_balance   = a.AVAIL_BALANCE;
     this.close_date      = a.CLOSE_DATE;
     this.last_date       = a.LAST_ACTIVITY_DATE;
     this.open_date       = a.OPEN_DATE;
     this.pending_balance = a.PENDING_BALANCE;
     this.status          = a.STATUS;
     this.branch          = BranchDao.Instance().SelectbyId(a.OPEN_BRANCH_ID).NAME;
     this.employee        = EmployeeDao.Instance().SelectbyId(a.OPEN_EMP_ID);
     this.NameEm          = employee.FIRST_NAME + " " + employee.LAST_NAME;
     this.product         = ProductDao.Instance().SelectbyId(a.PRODUCT_CD).NAME;
     this.customer        = CustomerDao.Instance().SelectbyId(a.CUST_ID);
     if (customer.CUST_TYPE_CD == "I")
     {
         INDIVIDUAL ind = IndividualDao.Instance().SelectbyId(a.CUST_ID);
         if (ind == null)
         {
             this.NameCus = "";
         }
         else
         {
             this.NameCus = ind.FIRST_NAME + " " + ind.LAST_NAME;
         }
     }
     else
     {
         OFFICER off = OfficerDao.Instance().SelectbyCustId(a.CUST_ID);
         if (off == null)
         {
             this.NameCus = "";
         }
         else
         {
             this.NameCus = off.FIRST_NAME + " " + off.LAST_NAME;
         }
     }
 }
Esempio n. 12
0
        private void buttonRemoveCustomer_Click(object sender, RoutedEventArgs e)//Удалить клиента со всеми аккаунтами
        {
            CUSTOMER             cust = (CUSTOMER)listBoxUser.SelectedItem;
            IQueryable <ACCOUNT> acc  = BankView.db.ACCOUNT.Where(x => x.CUST_ID == cust.CUST_ID);

            foreach (ACCOUNT item in acc)
            {
                IQueryable <ACC_TRANSACTION> tran = BankView.db.ACC_TRANSACTION.Where(x => x.ACCOUNT_ID == item.ACCOUNT_ID);
                BankView.db.ACC_TRANSACTION.DeleteAllOnSubmit(tran);
            }
            BankView.db.ACCOUNT.DeleteAllOnSubmit(acc);

            INDIVIDUAL individ = BankView.db.INDIVIDUAL.Where(x => x.CUST_ID == cust.CUST_ID).FirstOrDefault();


            BankView.db.INDIVIDUAL.DeleteOnSubmit(individ);
            BankView.db.CUSTOMER.DeleteOnSubmit(cust);

            BankView.db.SubmitChanges();

            listBoxUser.ItemsSource = null;
            listBoxUser.ItemsSource = BankView.db.CUSTOMER.Where(x => x.CUST_TYPE_CD == "I");
        }
Esempio n. 13
0
        private void OKevent(Window p)
        {
            if (validate_customer() == true)
            {
                CUSTOMER cus = new CUSTOMER();
                cus.ADDRESS      = Cus_address;
                cus.CITY         = Cus_city;
                cus.CUST_TYPE_CD = Cus_custype;
                cus.FED_ID       = Cus_fedid;
                cus.POSTAL_CODE  = Cus_postalcode;
                cus.STATE        = Cus_state;
                if (cv == "insert")
                {
                    CustomerDao.Instance().Insert(cus);
                    off = new OFFICER();
                    ind = new INDIVIDUAL();
                    bus = new BUSINESS();
                    int last_cus = CustomerDao.Instance().LastCUST().CUST_ID;
                    off.CUST_ID = last_cus;
                    ind.CUST_ID = last_cus;
                    bus.CUST_ID = last_cus;
                    if (Cus_custype == "I")
                    {
                        if (validate_individual() == true)
                        {
                            if (In_birthdate.Equals(""))
                            {
                                ind.BIRTH_DATE = null;
                            }
                            else
                            {
                                ind.BIRTH_DATE = Convert.ToDateTime(In_birthdate);
                            }
                            ind.FIRST_NAME = In_firstname;
                            ind.LAST_NAME  = In_lastname;

                            IndividualDao.Instance().Insert(ind);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Individual!", "Thông báo");
                        }
                    }
                    else
                    {
                        if (validate_officer() == true && validate_business() == true)
                        {
                            bus.NAME     = Bu_name;
                            bus.STATE_ID = Bu_stateid;
                            if (Bu_incorpdate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                bus.INCORP_DATE = Convert.ToDateTime(Bu_incorpdate);
                            }
                            off.LAST_NAME  = Of_lastname;
                            off.FIRST_NAME = Of_firstname;
                            off.TITLE      = Of_title;
                            off.START_DATE = Convert.ToDateTime(Of_startdate);
                            if (Of_enddate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                off.END_DATE = Convert.ToDateTime(Of_enddate);
                            }

                            OfficerDao.Instance().Insert(off);
                            BusinessDao.Instance().Insert(bus);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Officer và Business!", "Thông báo");
                        }
                    }
                }
                else
                {
                    cus.CUST_ID = custid;
                    if (Cus_custype == "I")
                    {
                        if (validate_individual() == true)
                        {
                            if (In_birthdate.Equals(""))
                            {
                                ind.BIRTH_DATE = null;
                            }
                            else
                            {
                                ind.BIRTH_DATE = Convert.ToDateTime(In_birthdate);
                            }
                            ind.FIRST_NAME = In_firstname;
                            ind.LAST_NAME  = In_lastname;
                            CustomerDao.Instance().Update(cus);
                            IndividualDao.Instance().Update(ind);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Individual!", "Thông báo");
                        }
                    }
                    else
                    {
                        if (validate_officer() == true && validate_business() == true)
                        {
                            bus.NAME     = Bu_name;
                            bus.STATE_ID = Bu_stateid;
                            if (Bu_incorpdate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                bus.INCORP_DATE = Convert.ToDateTime(Bu_incorpdate);
                            }
                            off.LAST_NAME  = Of_lastname;
                            off.FIRST_NAME = Of_firstname;
                            off.TITLE      = Of_title;
                            off.START_DATE = Convert.ToDateTime(Of_startdate);
                            if (Of_enddate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                off.END_DATE = Convert.ToDateTime(Of_enddate);
                            }
                            CustomerDao.Instance().Update(cus);
                            OfficerDao.Instance().Update(off);
                            BusinessDao.Instance().Update(bus);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Officer và Business!", "Thông báo");
                        }
                    }
                }
                p.Close();
                vm.CustomerLists = new ObservableCollection <CUSTOMER>(CustomerDao.Instance().getAll());
            }
            else
            {
                MessageBox.Show("Customer:Bạn điền thiếu thông tin!", "Thông báo");
            }
        }
Esempio n. 14
0
        public CustomerEditVM(CUSTOMER c, CustomerVM vm)
        {
            if (c == null)
            {
                this.In_firstname = "";
                this.In_lastname  = "";
                this.In_birthdate = "";

                this.Bu_name       = "";
                this.Bu_stateid    = "";
                this.Bu_incorpdate = "";

                this.Of_enddate   = "";
                this.Of_firstname = "";
                this.Of_startdate = "";
                this.Of_title     = "";
                this.Of_lastname  = "";

                this.Cus_address    = "";
                this.Cus_city       = "";
                this.Cus_custype    = "";
                this.Cus_postalcode = "";
                this.Cus_fedid      = "";
                this.Cus_state      = "";
                this.cv             = "insert";
            }
            else
            {
                ind = IndividualDao.Instance().SelectbyId(c.CUST_ID);
                bus = BusinessDao.Instance().SelectbyId(c.CUST_ID);
                off = OfficerDao.Instance().SelectbyCustId(c.CUST_ID);
                if (ind != null)
                {
                    In_lastname  = ind.LAST_NAME;
                    In_firstname = ind.FIRST_NAME;
                    In_birthdate = ind.BIRTH_DATE.ToString();
                }
                if (off != null && bus != null)
                {
                    Of_lastname   = off.LAST_NAME;
                    Of_firstname  = off.FIRST_NAME;
                    Of_title      = off.TITLE;
                    Of_startdate  = off.START_DATE.ToString();
                    Of_enddate    = off.END_DATE.ToString();
                    Bu_name       = bus.NAME;
                    Bu_stateid    = bus.STATE_ID;
                    Bu_incorpdate = bus.INCORP_DATE.ToString();
                }

                this.Cus_address    = c.ADDRESS;
                this.Cus_city       = c.CITY;
                this.Cus_custype    = c.CUST_TYPE_CD;
                this.Cus_postalcode = c.POSTAL_CODE;
                this.Cus_fedid      = c.FED_ID;
                this.Cus_state      = c.STATE;
                this.cv             = "update";
                this.custid         = c.CUST_ID;
            }
            this.vm       = vm;
            OKCommand     = new RelayCommand <Window>((p) => { return(p != null ? true : false); }, (p) => { OKevent(p); });
            CancelCommand = new RelayCommand <Window>((p) => true, (p) => { p.Close(); });
        }
Esempio n. 15
0
        public INDIVIDUAL GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 IND_ID)
        {
            INDIVIDUAL objReturn = null;

            SqlConnection  sConn    = null;
            SqlCommand     sCmd     = null;
            SqlDataAdapter sAdapter = null;
            DataSet        objTemp  = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_INDIVIDUAL_getitem", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER);
                sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_ID);
                sCmd.Parameters.AddWithValue("@IND_ID", IND_ID);

                objTemp  = new DataSet();
                sAdapter = new SqlDataAdapter(sCmd);

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                sAdapter.Fill(objTemp);
                LogManager.LogTiming(logDetails);
                CheckDataSet(objTemp);

                if (objTemp != null && objTemp.Tables.Count > 0 && objTemp.Tables[0].Rows.Count > 0)
                {
                    objReturn = ParseReader(objTemp.Tables[0].Rows[0]);
                }

                sConn.Close();
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                throw ex;
            }
            finally
            {
                if (sAdapter != null)
                {
                    sAdapter.Dispose();
                    sAdapter = null;
                }
                if (sCmd != null)
                {
                    sCmd.Dispose();
                    sCmd = null;
                }
                if (sConn != null)
                {
                    if (sConn.State != ConnectionState.Closed)
                    {
                        sConn.Close();
                    }
                    sConn.Dispose();
                    sConn = null;
                }
            }

            return(objReturn);
        }
Esempio n. 16
0
        public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, INDIVIDUAL objSave)
        {
            Int32 objReturn = 0;

            SqlConnection sConn = null;
            SqlCommand    sCmd  = null;
            SqlParameter  p     = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_INDIVIDUAL_save", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER);
                sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_ID);

                p           = new SqlParameter("@BIRTH_DATE", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.BIRTH_DATE);
                p           = new SqlParameter("@CREATED", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.CREATED);
                p           = new SqlParameter("@CREATEDBY", SqlDbType.VarChar, 30);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CREATEDBY);
                p           = new SqlParameter("@DEATH_DATE", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.DEATH_DATE);
                p           = new SqlParameter("@FIRST_NAME", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.FIRST_NAME);
                p           = new SqlParameter("@IND_ID", SqlDbType.Int, 4);
                p.Direction = ParameterDirection.InputOutput;
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.IND_ID);
                p           = new SqlParameter("@LAST_NAME", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.LAST_NAME);
                p           = new SqlParameter("@MIDDLE_NAME", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.MIDDLE_NAME);
                p           = new SqlParameter("@PATIENT_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PATIENT_ID);
                p           = new SqlParameter("@PREFIX", SqlDbType.VarChar, 50);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PREFIX);
                p           = new SqlParameter("@SUFFIX", SqlDbType.VarChar, 25);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.SUFFIX);
                p           = new SqlParameter("@TITLE", SqlDbType.VarChar, 100);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.TITLE);
                p           = new SqlParameter("@UPDATED", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.UPDATED);
                p           = new SqlParameter("@UPDATEDBY", SqlDbType.VarChar, 30);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.UPDATEDBY);

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                int        cnt        = sCmd.ExecuteNonQuery();
                LogManager.LogTiming(logDetails);

                objReturn = (Int32)sCmd.Parameters["@IND_ID"].Value;

                sConn.Close();
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                throw ex;
            }
            finally
            {
                if (sCmd != null)
                {
                    sCmd.Dispose();
                    sCmd = null;
                }
                if (sConn != null)
                {
                    if (sConn.State != ConnectionState.Closed)
                    {
                        sConn.Close();
                    }
                    sConn.Dispose();
                    sConn = null;
                }
            }

            return(objReturn);
        }
 public static Boolean Delete(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, INDIVIDUAL objDelete)
 {
     return(Delete(CURRENT_USER, CURRENT_REGISTRY_ID, objDelete.IND_ID));
 }