示例#1
0
        public void getClientResult()
        {
            dsResult = myDal.ExecuteProcedure("spGetAllClientsInfo");
            ClientList = new List<ServiceClients>();
            DataSet ds = dsResult;
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                ServiceClients c = new ServiceClients(
                 dr["ClientID"].ToString(),
                dr["ClientName"].ToString(),
                dr["PhoneNumber"].ToString(),
                dr["Address"].ToString()

                );

                //foreach (var item in dr[2].ToString())
                //{
                //    c = new ServiceClients(new Contacts());
                //};

                ClientList.Add(c);
            }
            ClientList.ToList();
        }
示例#2
0
        protected void gvClients_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                int rowID = Convert.ToInt32(e.CommandArgument);
                gvClients.SelectedIndex = rowID;
                string ClientID = gvClients.SelectedDataKey.Value.ToString();
                string cmd = e.CommandName;

                switch (cmd)
                {
                    case "EditRow":
                        pnlEditClient.Visible = true;
                        ds = new DataSet();
                        myDal.AddParam("ClientID", ClientID);
                        ds = myDal.ExecuteProcedure("spGetAllClientsInfo");
                        DataRow dr = ds.Tables[0].Rows[0];
                        client = new ServiceClients(
                            dr["ClientID"].ToString(),
                            dr["ClientName"].ToString(),
                            dr["PhoneNumber"].ToString(),
                            dr["Address"].ToString());

                       // client.AuthorizedContacts.Add(new Contacts (dr["ContactName"].ToString()));
                    //    client.AuthorizedContacts = new List<string>()
                    //{
                    //    dr["ContactName"].ToString()
                    //};
                        txtEditClientID.Text = client.ClientID;
                        txtEditClientName.Text = client.ClientName;
                        txtEditPhone.Text = client.Phone;
                        txtEditAddress.Text = client.Address;
                        break;
                }
            }

            LoadGVClients();
        }