示例#1
0
    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();
            }
        }
    }
示例#2
0
		private void detach_Douments(Doument entity)
		{
			this.SendPropertyChanging();
			entity.Person = null;
		}
示例#3
0
		private void attach_Douments(Doument entity)
		{
			this.SendPropertyChanging();
			entity.Person = this;
		}
示例#4
0
 partial void DeleteDoument(Doument instance);
示例#5
0
 partial void UpdateDoument(Doument instance);
示例#6
0
 partial void InsertDoument(Doument instance);