////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////
 //database insert methods
 public case_intake case_intake_insert()
 {
     case_intake.applic_end_date_time = Convert.ToDateTime(9/9/9);//null
     case_intake.applic_start_date_time = DateTime.Now;
     case_intake.circum_emergency_event = "N/A";
     case_intake.circum_help_request_memo = "N/A";
     case_intake.circum_income_stolen = "N/A";
     case_intake.circum_memo = "Warehouse to warehouse order";
     case_intake.circum_no_income = "N/A";
     case_intake.circum_not_enough_income = "N/A";
     case_intake.agency_id = 0;//null
     case_intake.call_center_id = Convert.ToInt32(DDL_Call_Center.SelectedValue);
     case_intake = case_intake.Insert(case_intake);
     return case_intake;
 }
 public case_intake Insert_case_intake_select(int ID)
 {
     case_intake = case_intake.Select(ID);
     Insert_applic_end_date_time_txt.Text     = Convert.ToString(case_intake.applic_end_date_time);
     Insert_applic_start_date_time_txt.Text   = Convert.ToString(case_intake.applic_start_date_time);
     Insert_circum_emergency_event_txt.Text   = Convert.ToString(case_intake.circum_emergency_event);
     Insert_circum_help_request_memo_txt.Text = Convert.ToString(case_intake.circum_help_request_memo);
     Insert_circum_income_stolen_txt.Text     = Convert.ToString(case_intake.circum_income_stolen);
     Insert_circum_memo_txt.Text              = Convert.ToString(case_intake.circum_memo);
     Insert_circum_no_income_txt.Text         = Convert.ToString(case_intake.circum_no_income);
     Insert_circum_not_enough_income_txt.Text = Convert.ToString(case_intake.circum_not_enough_income);
     Insert_agency_id_txt.Text      = Convert.ToString(case_intake.agency_id);
     Insert_call_center_id_txt.Text = Convert.ToString(case_intake.call_center_id);
     return(case_intake);
 }
        ////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////

        //database insert methods
        public case_intake case_intake_insert()
        {
            case_intake.applic_end_date_time     = Convert.ToDateTime(9 / 9 / 9);//null
            case_intake.applic_start_date_time   = DateTime.Now;
            case_intake.circum_emergency_event   = "N/A";
            case_intake.circum_help_request_memo = "N/A";
            case_intake.circum_income_stolen     = "N/A";
            case_intake.circum_memo              = "Warehouse to warehouse order";
            case_intake.circum_no_income         = "N/A";
            case_intake.circum_not_enough_income = "N/A";
            case_intake.agency_id      = 0;//null
            case_intake.call_center_id = Convert.ToInt32(DDL_Call_Center.SelectedValue);
            case_intake = case_intake.Insert(case_intake);
            return(case_intake);
        }
 public case_intake case_intake_insert()
 {
     case_intake.applic_end_date_time     = Convert.ToDateTime("1 / 1 / 1900");
     case_intake.applic_start_date_time   = DateTime.Now;
     case_intake.circum_emergency_event   = "YES";
     case_intake.circum_help_request_memo = "MISSING PERSON";
     case_intake.circum_income_stolen     = "NO";
     case_intake.circum_memo              = "NO";
     case_intake.circum_no_income         = "NO";
     case_intake.circum_not_enough_income = "NO";
     case_intake.agency_id      = 0;
     case_intake.call_center_id = Convert.ToInt32(Insert_DDL_Call_Center.SelectedValue);
     case_intake = case_intake.Insert(case_intake);
     //GridView1.DataBind();
     return(case_intake);
 }
 public case_intake case_intake_insert()
 {
     case_intake.applic_end_date_time = Convert.ToDateTime(Insert_applic_end_date_time_txt.Text);
     case_intake.applic_start_date_time = Convert.ToDateTime(Insert_applic_start_date_time_txt.Text);
     case_intake.circum_emergency_event = Insert_circum_emergency_event_txt.Text;
     case_intake.circum_help_request_memo = Insert_circum_help_request_memo_txt.Text;
     case_intake.circum_income_stolen = Insert_circum_income_stolen_txt.Text;
     case_intake.circum_memo = Insert_circum_memo_txt.Text;
     case_intake.circum_no_income = Insert_circum_no_income_txt.Text;
     case_intake.circum_not_enough_income = Insert_circum_not_enough_income_txt.Text;
     case_intake.agency_id = Convert.ToInt32(Insert_agency_id_txt.Text);
     case_intake.call_center_id = Convert.ToInt32(Insert_call_center_id_txt.Text);
     case_intake = case_intake.Insert(case_intake);
     Insert_case_intake_GridView.DataBind();
     Update_case_intake_GridView.DataBind();
     Delete_case_intake_GridView.DataBind();
     return case_intake;
 }
 public case_intake case_intake_insert()
 {
     case_intake.applic_end_date_time     = Convert.ToDateTime(Insert_applic_end_date_time_txt.Text);
     case_intake.applic_start_date_time   = Convert.ToDateTime(Insert_applic_start_date_time_txt.Text);
     case_intake.circum_emergency_event   = Insert_circum_emergency_event_txt.Text;
     case_intake.circum_help_request_memo = Insert_circum_help_request_memo_txt.Text;
     case_intake.circum_income_stolen     = Insert_circum_income_stolen_txt.Text;
     case_intake.circum_memo              = Insert_circum_memo_txt.Text;
     case_intake.circum_no_income         = Insert_circum_no_income_txt.Text;
     case_intake.circum_not_enough_income = Insert_circum_not_enough_income_txt.Text;
     case_intake.agency_id      = Convert.ToInt32(Insert_agency_id_txt.Text);
     case_intake.call_center_id = Convert.ToInt32(Insert_call_center_id_txt.Text);
     case_intake = case_intake.Insert(case_intake);
     Insert_case_intake_GridView.DataBind();
     Update_case_intake_GridView.DataBind();
     Delete_case_intake_GridView.DataBind();
     return(case_intake);
 }
        protected void updateDatabase()
        {
            //product_id_array has all product ids
            call_center        = call_center.Select(Convert.ToInt32(DDL_Call_Center.SelectedValue));
            selected_Warehouse = selected_Warehouse.Select(Convert.ToInt32(passWarehouseID_hf.Value));
            address            = address.Select(selected_Warehouse.address_id);

            //case_intake
            case_intake = case_intake_insert();
            //encounter
            encounter = encounter_insert();
            //requestor
            requestor = requestor_insert();
            //requestor_Order
            requestor_Order = requestor_Order_insert();
            //Order_product
            Order_Product = Order_Product_insert();
        }
        //INSERT
        protected void insert_Click(object sender, EventArgs e)
        {
            try
            {
                address = address_insert();
                person  = person_insert();
                client  = client_insert();
                missing = missing_insert();

                if (Insert_deceasedYes.Checked == true)
                {
                    deceased = deceased_insert();
                }
                case_intake = case_intake_insert();
                case_client = case_client_insert();
                encounter   = encounter_insert();
            }
            catch { Insert_lbl_Client_Error.Text = "There has been an error updating information for the missing client."; }
            finally { Insert_lbl_Client_Error.Text = "The missing client's information has been successfully updated."; }
        }
 public case_intake Delete_case_intake_select(int ID)
 {
     case_intake = case_intake.Select(ID);
     Delete_case_id_txt_lbl.Text = Convert.ToString(case_intake.case_id);
     Delete_applic_end_date_time_txt_lbl.Text = Convert.ToString(case_intake.applic_end_date_time);
     Delete_applic_start_date_time_txt_lbl.Text = Convert.ToString(case_intake.applic_start_date_time);
     Delete_circum_emergency_event_txt_lbl.Text = Convert.ToString(case_intake.circum_emergency_event);
     Delete_circum_help_request_memo_txt_lbl.Text = Convert.ToString(case_intake.circum_help_request_memo);
     Delete_circum_income_stolen_txt_lbl.Text = Convert.ToString(case_intake.circum_income_stolen);
     Delete_circum_memo_txt_lbl.Text = Convert.ToString(case_intake.circum_memo);
     Delete_circum_no_income_txt_lbl.Text = Convert.ToString(case_intake.circum_no_income);
     Delete_circum_not_enough_income_txt_lbl.Text = Convert.ToString(case_intake.circum_not_enough_income);
     Delete_agency_id_txt_lbl.Text = Convert.ToString(case_intake.agency_id);
     Delete_call_center_id_txt_lbl.Text = Convert.ToString(case_intake.call_center_id);
     return case_intake;
 }
        protected void Insert_refreshcase()
        {
            DataTable vlcaslst = new DataTable();
            DataTable casedt = new DataTable();

            vlcaslst.Columns.Add("Case_id", Type.GetType("System.Int32"));
            vlcaslst.Columns.Add("applic_end_Date_time", Type.GetType("System.DateTime"));
            vlcaslst.Columns.Add("applic_Start_Date_time", Type.GetType("System.DateTime"));

            String whereclause = "Client_id = " + person.person_id;
            casedt = case_client.Select(whereclause);

            if (casedt.Rows.Count > 0)
            {
                foreach (DataRow cr in casedt.Rows)
                {
                    DataRow caserow = vlcaslst.NewRow();

                    case_intake = case_intake.Select(Convert.ToInt32(cr["Case_id"]));

                    caserow.SetField(0, case_intake.case_id);
                    caserow.SetField(1, case_intake.applic_end_date_time);
                    caserow.SetField(2, case_intake.applic_start_date_time);

                    vlcaslst.Rows.Add(caserow);

                }

                Insert_GVcases.DataSource = vlcaslst;
                Insert_GVcases.DataBind();

            }
            else
            {
                Insert_lbl_pet_Error.Text = "No case information exists";
            }
        }
        //case search gridview
        protected void Insert_GVcases_SelectedIndexChanged(object sender, EventArgs e)
        {
            case_intake = case_intake.Select(Convert.ToInt32(Insert_GVcases.SelectedDataKey.Value));
            case_client = case_client.Select(Convert.ToInt32(Insert_GVcases.SelectedDataKey.Value), Convert.ToInt32(GlobalVariables.PersonID));

            GlobalVariables.CaseID = case_client.case_id;
            GlobalVariables.ClientID = case_client.client_id;
        }
 protected void INSERT(object sender, EventArgs e)
 {
     case_intake = case_intake_insert();
 }
        protected void GVcases_SelectedIndexChanged(object sender, EventArgs e)
        {
            clientCase_intake = clientCase_intake.Select(Convert.ToInt32(GVcases.SelectedDataKey.Value));
            clientcase = clientcase.Select(Convert.ToInt32(GVcases.SelectedDataKey.Value), Convert.ToInt32(GlobalVariables.PersonID));

            GlobalVariables.CaseID = clientcase.case_id;
            GlobalVariables.ClientID = clientcase.client_id;

            fill_Case_information();
            fill_pet_info();
            fill_employer_info();
            fill_Income_info();
            Fill_Expense_info();
            Fill_vehicle_info();
            fill_military_info();
            Fill_Debt_info();
            fill_Disaster_encouter();
        }
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     case_intake = Insert_case_intake_select(Convert.ToInt32(Insert_case_intake_GridView.SelectedValue));
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     case_intake = case_intake_update(Convert.ToInt32(Update_case_intake_GridView.SelectedValue));
 }
        protected void Save_Case_information()
        {
            clientCase_intake.SetColumnDefaults();
            clientcase.SetColumnDefaults();

            clientCase_intake.circum_no_income = Convert.ToString(CbNoIncome.Checked);
            clientCase_intake.circum_not_enough_income = Convert.ToString(CbNotenoughIncome.Checked);
            clientCase_intake.circum_income_stolen = Convert.ToString(CbStolanincome.Checked);
            clientCase_intake.circum_emergency_event = Convert.ToString(CBEmgEvent.Checked);
            clientCase_intake.circum_memo = txt_Circum_Memo.Text;
            clientCase_intake.circum_help_request_memo = txt_Circum_Help_Request_Memo.Text;
            clientCase_intake.applic_start_date_time = DateTime.Now;
            clientCase_intake.applic_end_date_time = DateTime.MaxValue;
            clientCase_intake.call_center_id = Convert.ToInt32(DDL_Call_Center.SelectedValue);
            clientCase_intake.case_id = GlobalVariables.CaseID;
            clientcase.case_id = GlobalVariables.CaseID;
            clientcase.client_id = GlobalVariables.ClientID;
            clientcase.address_id = GlobalVariables.ClientAddressID;

            if (clientCase_intake.case_id == 0)
            {
                clientCase_intake = clientCase_intake.Insert(clientCase_intake);
            }
            else
            {
                clientCase_intake.Update(clientCase_intake);
            }

            clientcase.housing_status = ddlHousingStatus.SelectedValue;
            clientcase.income_status = ddlIncomeStatus.SelectedValue;
            clientcase.employment_status = ddlEmpStatus.SelectedValue;
            clientcase.welfr_fraud_memo = txt_welfr_fraud_memo.Text;
            clientcase.denial_memo = txt_AFDC_denial_memo.Text;

            if (TxtCurr_addr_date_ocup.Text != "")
            {
                clientcase.curr_residence_date = Convert.ToDateTime(TxtCurr_addr_date_ocup.Text);
            }

            if (TxtPrev_addr_date_ocup.Text != "")
            {
                clientcase.prev_residence_date = Convert.ToDateTime(TxtPrev_addr_date_ocup.Text);
            }

            if (TxtutilallAmt.Text != "")
            {
                clientcase.util_allot_amt = Convert.ToDecimal(TxtutilallAmt.Text);
            }

            if (TxtutilallDate.Text != "")
            {
                clientcase.util_allot_app_date = Convert.ToDateTime(TxtutilallDate.Text);
            }
            clientcase.utilities_incl = ddlUtilall.SelectedValue;

            if (TxtFoodstmpAmt.Text != "")
            {
                clientcase.fd_stmps_amt = Convert.ToDecimal(TxtFoodstmpAmt.Text);
            }

            if (TxtFoodstmpDate.Text != "")
            {
                clientcase.fd_stmps_app_date = Convert.ToDateTime(TxtFoodstmpDate.Text);
            }
            clientcase.fd_Inc = ddlFoodstmp.SelectedValue;

            if (TxtAFDCAmt.Text != "")
            {
                clientcase.afdc_amt = Convert.ToDecimal(TxtAFDCAmt.Text);
            }

            if (TxtAFDCDate.Text != "")
            {
                clientcase.afdc_app_date = Convert.ToDateTime(TxtAFDCDate.Text);
            }
            clientcase.afdc_Inc = ddlAFDC.SelectedValue;

            if (TxtTrustOffAmt.Text != "")
            {
                clientcase.oth_trustee_amt = Convert.ToDecimal(TxtTrustOffAmt.Text);
            }

            if (TxtTrustOffDate.Text != "")
            {
                clientcase.oth_trustee_app_date = Convert.ToDateTime(TxtTrustOffDate.Text);
            }
            clientcase.oth_trustee_Inc = ddlOtherhelp.SelectedValue;
            if (txtssAmt.Text != "")
            {
                clientcase.ss_amt = Convert.ToDecimal(txtssAmt.Text);
            }
            if (txtssDate.Text != "")
            {
                clientcase.ss_app_date = Convert.ToDateTime(txtssDate.Text);
            }
            clientcase.ss_Inc = ddlSS.SelectedValue;
            if (txtVAAmt.Text != "")
            {
                clientcase.va_amt = Convert.ToDecimal(txtVAAmt.Text);
            }
            if (TxtutilallDate.Text != "")
            {
                clientcase.va_app_date = Convert.ToDateTime(TxtutilallDate.Text);
            }
            clientcase.va_Inc = ddlVA.SelectedValue;
            if (txtEAPAmt.Text != "")
            {
                clientcase.eap_amt = Convert.ToDecimal(txtEAPAmt.Text);
            }
            if (txtEAPDate.Text != "")
            {
                clientcase.eap_app_date = Convert.ToDateTime(txtEAPDate.Text);
            }
            clientcase.eap_Inc = ddlEAP.SelectedValue;
            if (TxtFemaAmt.Text != "")
            {
                clientcase.fema_amt = Convert.ToDecimal(TxtFemaAmt.Text);
            }
            if (TxtFEMADate.Text != "")
            {
                clientcase.fema_app_date = Convert.ToDateTime(TxtFEMADate.Text);
            }
            clientcase.fema_Inc = ddlFema.SelectedValue;
            if (txtUnemplAmt.Text != "")
            {
                clientcase.unempl_amt = Convert.ToDecimal(txtUnemplAmt.Text);
            }
            if (txtUnemplDate.Text != "")
            {
                clientcase.unempl_app_date = Convert.ToDateTime(txtUnemplDate.Text);
            }
            clientcase.unempl_Inc = ddlUnemployment.SelectedValue;
            if (txtGrantLoanAmt.Text != "")
            {
                clientcase.grants_loans_amt = Convert.ToDecimal(txtGrantLoanAmt.Text);
            }
            if (txtGrantLoanDate.Text != "")
            {
                clientcase.grants_loans_app_date = Convert.ToDateTime(txtGrantLoanDate.Text);
            }
            clientcase.grants_Inc = ddlGrantloan.SelectedValue;
            if (TxtotherhelpAmt.Text != "")
            {
                clientcase.other_amt = Convert.ToDecimal(TxtotherhelpAmt.Text);
            }
            if (TxtotherhelpDate.Text != "")
            {
                clientcase.other_app_date = Convert.ToDateTime(TxtotherhelpDate.Text);
            }
            clientcase.other_Inc = ddlOtherhelp.SelectedValue;
            if (txt_Mtg_Amt_Owed_Today.Text != "")
            {
                clientcase.mtg_amt_owed_today = Convert.ToDecimal(txt_Mtg_Amt_Owed_Today.Text);
            }
            if (txt_Electric_Amt_Owed_Today.Text != "")
            {
                clientcase.electric_amt_owed_today = Convert.ToDecimal(txt_Electric_Amt_Owed_Today.Text);
            }
            if (txt_Gas_or_Heating_Amt_Owed_Today.Text != "")
            {
                clientcase.gas_or_heating_amt_owed_today = Convert.ToDecimal(txt_Gas_or_Heating_Amt_Owed_Today.Text);
            }
            if (txt_Water_Amt_Owed_Today.Text != "")
            {
                clientcase.water_amt_owed_today = Convert.ToDecimal(txt_Water_Amt_Owed_Today.Text);
            }
            if (txt_Cable_Amt_Owed_Today.Text != "")
            {
                clientcase.cable_amt_owed_today = Convert.ToDecimal(txt_Cable_Amt_Owed_Today.Text);
            }
            if (txt_Telephone_Amt_Owed_Today.Text != "")
            {
                clientcase.telephone_amt_owed_today = Convert.ToDecimal(txt_Telephone_Amt_Owed_Today.Text);
            }
            if (txt_Sewage_Amt_Owed_Today.Text != "")
            {
                clientcase.sewage_amt_owed_today = Convert.ToDecimal(txt_Sewage_Amt_Owed_Today.Text);
            }
            if (txt_Trash_Removal_Amt_Owed_Today.Text != "")
            {
                clientcase.trash_removal_amt_owed_today = Convert.ToDecimal(txt_Trash_Removal_Amt_Owed_Today.Text);
            }

            if (clientcase.case_id == 0 && clientcase.client_id == 0)
            {
                clientcase.client_id = clientperson.person_id;
                clientcase.case_id = clientCase_intake.case_id;
                clientcase.address_id = clientAddress.address_id;
                clientcase = clientcase.Insert(clientcase);
            }
            else
            {
                clientcase.Update(clientcase);
            }
        }
 public case_intake case_intake_insert()
 {
     case_intake.applic_end_date_time = Convert.ToDateTime("1 / 1 / 1900");
     case_intake.applic_start_date_time = DateTime.Now;
     case_intake.circum_emergency_event = "YES";
     case_intake.circum_help_request_memo = "MISSING PERSON";
     case_intake.circum_income_stolen = "NO";
     case_intake.circum_memo = "NO";
     case_intake.circum_no_income = "NO";
     case_intake.circum_not_enough_income = "NO";
     case_intake.agency_id = 0;
     case_intake.call_center_id = Convert.ToInt32(Insert_DDL_Call_Center.SelectedValue);
     case_intake = case_intake.Insert(case_intake);
     //GridView1.DataBind();
     return case_intake;
 }
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     case_intake = Update_case_intake_select(Convert.ToInt32(Update_case_intake_GridView.SelectedValue));
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     case_intake = case_intake_update(Convert.ToInt32(Update_case_intake_GridView.SelectedValue));
 }
 protected void INSERT(object sender, EventArgs e)
 {
     case_intake = case_intake_insert();
 }
        private void Create_case()
        {
            clientCase_intake.applic_start_date_time = DateTime.Today;

            if (CBEmgEvent.Checked == false)
            {
                clientCase_intake.circum_emergency_event = "0";
            }
            else
            {
                clientCase_intake.circum_emergency_event = "1";
            }

            if (CbStolanincome.Checked == false)
            {
                clientCase_intake.circum_income_stolen = "0";
            }
            else
            {
                clientCase_intake.circum_income_stolen = "1";
            }

            if (CbNoIncome.Checked == false)
            {
                clientCase_intake.circum_no_income = "0";
            }
            else
            {
                clientCase_intake.circum_no_income = "1";
            }

            if (CbNotenoughIncome.Checked == false)
            {
                clientCase_intake.circum_not_enough_income = "0";
            }
            else
            {
                clientCase_intake.circum_not_enough_income = "1";
            }

            clientCase_intake.circum_help_request_memo = txt_Circum_Help_Request_Memo.Text;
            clientCase_intake.circum_memo = txt_Circum_Memo.Text;

            clientCase_intake = clientCase_intake.Insert(clientCase_intake);
        }
        //INSERT
        protected void insert_Click(object sender, EventArgs e)
        {
            try
            {
                address = address_insert();
                person = person_insert();
                client = client_insert();
                missing = missing_insert();

                if (Insert_deceasedYes.Checked == true)
                {
                    deceased = deceased_insert();
                }
                case_intake = case_intake_insert();
                case_client = case_client_insert();
                encounter = encounter_insert();
            }
            catch { Insert_lbl_Client_Error.Text = "There has been an error updating information for the missing client."; }
            finally { Insert_lbl_Client_Error.Text = "The missing client's information has been successfully updated."; }
        }
        protected void updateDatabase()
        {
            //product_id_array has all product ids
            call_center = call_center.Select(Convert.ToInt32(DDL_Call_Center.SelectedValue));
            selected_Warehouse = selected_Warehouse.Select(Convert.ToInt32(passWarehouseID_hf.Value));
            address = address.Select(selected_Warehouse.address_id);

            //case_intake
            case_intake = case_intake_insert();
            //encounter
            encounter = encounter_insert();
            //requestor
            requestor = requestor_insert();
            //requestor_Order
            requestor_Order = requestor_Order_insert();
            //Order_product
            Order_Product = Order_Product_insert();
        }