protected void fluDocument_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
    {
        if (this.fluDocument.HasFile)
        {
            if (this.fluDocument.PostedFile.ContentType.Equals("image/pjpeg") || this.fluDocument.PostedFile.ContentType.Equals("image/x-png"))
            {
                byte[] fileByte = this.fluDocument.FileBytes;
                Binary binaryObj = new Binary(fileByte);
                Ajancy.Kimia_Ajancy db = new Ajancy.Kimia_Ajancy(Public.ConnectionString);
                Ajancy.Doument doc = db.Douments.FirstOrDefault<Ajancy.Doument>(d => d.PersonID == Public.ActiveUserRole.User.PersonID && d.DocumentType == 1);

                if (doc == null)
                {
                    doc = new Ajancy.Doument
                                {
                                    DocumentType = Public.ToByte(this.drpType.SelectedValue),
                                    PersonID = Public.ActiveUserRole.User.PersonID,
                                    Picture = binaryObj,
                                    SubmitDate = DateTime.Now
                                };
                    db.Douments.InsertOnSubmit(doc);
                }
                else
                {
                    doc.Picture = binaryObj;
                }
                db.SubmitChanges();
                db.Dispose();
            }
        }
    }
Exemple #2
0
		private void detach_Douments(Doument entity)
		{
			this.SendPropertyChanging();
			entity.Person = null;
		}
Exemple #3
0
		private void attach_Douments(Doument entity)
		{
			this.SendPropertyChanging();
			entity.Person = this;
		}
Exemple #4
0
 partial void DeleteDoument(Doument instance);
Exemple #5
0
 partial void UpdateDoument(Doument instance);
Exemple #6
0
 partial void InsertDoument(Doument instance);