Example #1
0
        private void FillContract()
        {
            const string METHOD_NAME = "FillContract";

            try {
                lstGtContract.Items.Clear();
                string   contractList = Common.UILib.GetListText(lstGtContract, ",");
                string[] list         = contractList.Split(new char[] { ',' });
                System.Collections.ArrayList contractIDs = new System.Collections.ArrayList(list);

                string cropYear = ((HarvestReportTemplate)Master).CropYear;
                int    shid     = ((HarvestReportTemplate)Master).SHID;

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    using (SqlDataReader dr = WSCReportsExec.ContractsByPayeeNumber(conn, Convert.ToInt32(cropYear), shid)) {
                        while (dr.Read())
                        {
                            string contractNo = dr.GetInt32(dr.GetOrdinal("cnt_contract_no")).ToString();

                            System.Web.UI.WebControls.ListItem item = new ListItem(contractNo, contractNo);

                            lstGtContract.Items.Add(item);
                            if (contractIDs.Contains(contractNo))
                            {
                                lstGtContract.Items[lstGtContract.Items.Count - 1].Selected = true;
                            }
                        }
                    }
                }
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }