Beispiel #1
0
        // update event
        protected void gvFile_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                BusinessServices.Event objProfile  = new BusinessServices.Event();
                FileUpload             FileUpload1 = (FileUpload)gvFile.Rows[e.RowIndex].FindControl("FileUpload1");
                string path = Server.MapPath(@"\General") + @"\CPDEvent\" + UserContext.UserData.OrgID.ToString() + @"\";

                int       OrganisationID = UserContext.UserData.OrgID;
                DataTable dt             = objProfile.CheckFileName(OrganisationID, FileUpload1.FileName);
                int       CheckRowCount  = dt.Rows.Count;

                if (CheckRowCount != 0)
                {
                    lblMessage.Text     = ResourceManager.GetString("FileExists");
                    lblMessage.CssClass = "WarningMessage";
                    return;
                }
                string FileID = gvFile.DataKeys[e.RowIndex].Value.ToString();

                if (FileUpload1.HasFile)
                {
                    FileUpload1.SaveAs(path + FileUpload1.FileName);
                }

                objProfile.FileID   = int.Parse(FileID);
                objProfile.FileName = FileUpload1.FileName;
                objProfile.UpdateEventFile(objProfile);

                gvFile.EditIndex = -1;
                EventFileList();
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLog el = new ErrorHandler.ErrorLog(ex, ErrorLevel.High, "Usercpdevent.aspx.cs", "gvFile_RowUpdating", ex.Message);
            }
        }