Beispiel #1
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            //int districtID = Int32.Parse(districtDropDownList.SelectedItem.Value);
            districtID = aUserManager.GetUserDistrictID(User.Identity.GetUserName());
            string result = aClientManager.AddNewClient(clientNameTextBox.Text, locationTextBox.Text, districtID);

            errorMessageLabel.Text = result;
            //Response.Write(result);
            if (result.Equals("Client creation is successful."))
            {
                //ClearForm();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('New Client has been created successfully.');window.location ='SiteEngineerHomePage.aspx';", true);
            }
        }
        public static int GetClientId(string ClientName)
        {
            int ClientId = -1;

            var    names       = ClientName.Split(' ');
            string firstName   = names[0];
            string lastName    = names[1];
            Client ClientExist = ClientManager.GetClientExist(firstName, lastName);

            if (ClientExist == null)
            {
                Client objClient = new Client
                {
                    FirstName = firstName,
                    LastName  = lastName
                };
                ClientId = ClientManager.AddNewClient(objClient);
            }
            return(ClientExist != null ? ClientExist.ClientId : ClientId);
        }