Exemple #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Company_DB cdb    = new Company_DB();
            int        UserID = 0;

            try
            {
                //if (txtComName.Text == "")
                //{
                //    lblMsg.Text = "You must enter company name!!!!!";
                //    lblMsg.ForeColor = System.Drawing.Color.Red;
                //    return;
                //}
                //if (txtComAdd.Text == "")
                //{
                //    lblMsg.Text = "You must enter company address!!!!!";
                //    lblMsg.ForeColor = System.Drawing.Color.Red;
                //    return;
                //}
                //if (TxtComEmail.Text == "")
                //{
                //    lblMsg.Text = "You must enter Email!!!!!";
                //    lblMsg.ForeColor = System.Drawing.Color.Red;
                //    return;
                //}
                //if (txtPhone.Text == "")
                //{
                //    lblMsg.Text = "You must enter phone number!!!!!";
                //    lblMsg.ForeColor = System.Drawing.Color.Red;
                //    return;
                //}

                //if (txtTelephone.Text == "")
                //{
                //    lblMsg.Text = "You must enter telephone number!!!!!";
                //    lblMsg.ForeColor = System.Drawing.Color.Red;
                //    return;
                //}

                //if (txtWeb.Text == "")
                //{
                //    lblMsg.Text = "You must enter website url!!!!!";
                //    lblMsg.ForeColor = System.Drawing.Color.Red;
                //    return;
                //}

                //int Userids = 0;
                //Userids = Convert.ToInt32(HttpContext.Current.Session["UserID"]);
                // int Userids = 0;
                //Userids = Convert.ToInt32(HttpContext.Current.Session["UserID"]);
                UserID            = cdb.INSERT_COM_NAME(0, txtComName.Text, txtComAdd.Text, TxtComEmail.Text, txtPhone.Text, txtTelephone.Text, txtWeb.Text);
                txtComName.Text   = "";
                txtComAdd.Text    = "";
                TxtComEmail.Text  = "";
                txtPhone.Text     = "";
                txtTelephone.Text = "";
                txtWeb.Text       = "";
                lblMsg.Text       = "Company Inserted Successfully";
                lblMsg.ForeColor  = System.Drawing.Color.Green;
                CompanyGridView();

                //lblMsg.ForeColor = System.Drawing.Color.Green;
                //if (avatarUpload.PostedFile.FileName != null && avatarUpload.PostedFile.FileName != "")
                // {
                //   string filepath = avatarUpload.PostedFile.FileName;
                //  string filename = Path.GetFileName(filepath);
                //string ext = Path.GetExtension(filename);

                //   if (ext == ".jpeg" || ext == ".jpg")
                //   {
                //  UploadFiles(txtShortName.Text, ext);
                // }

                //}
            }

            catch (Exception ex)
            {
                lblMsg.Text      = "Please Enter Valid Information";
                lblMsg.ForeColor = System.Drawing.Color.Red;
            }
            finally
            {
            }
        }