Example #1
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        string filename = Path.GetFileName(fileUpload1.PostedFile.FileName);

        string GetExts = Path.GetExtension(filename);

        Stream str = fileUpload1.PostedFile.InputStream;
        BinaryReader br = new BinaryReader(str);
        Byte[] size = br.ReadBytes((int)str.Length);

        using (ROPAEntities obj = new ROPAEntities())
        {
            UploadFile upld = new UploadFile();

            upld.GUID = Guid.NewGuid().ToString();
            //upld.FIleFor=100;
            upld.FIleFor = filename;
            upld.SurApp_Id = 47;
            upld.fileext = GetExts;

            obj.AddToUploadFiles(upld);
            obj.SaveChanges();
        }
        BindGridviewData();
    }
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        string filename = Path.GetFileName(fileUpload1.PostedFile.FileName);

        Stream stream = fileUpload1.PostedFile.InputStream;

        string extension = Path.GetExtension(filename);
        //Write Save Logic  to file/
        BinaryReader br = new BinaryReader(stream);
        Byte[] size = br.ReadBytes((int)stream.Length);
        //SaveToFolder(stream, filename);

        //Database already here
        List<UploadFile> L = ResolveList();
        using (ROPAEntities obj = new ROPAEntities())
        {
            Guid G = Guid.NewGuid();
            UploadFile upld = new UploadFile();
            upld.GUID = G.ToString();
            upld.FIleFor = filename;
            upld.SurApp_Id = null;
            obj.AddToUploadFiles(upld);
            obj.SaveChanges();

            L.Add(upld);
        }
        UpdateSession(L);
        BindGridviewData();
    }
Example #3
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        try
        {
            var filename = Path.GetFileName(fileUpload1.PostedFile.FileName);

            var getExts = Path.GetExtension(filename);

            var str = fileUpload1.PostedFile.InputStream;
            var br = new BinaryReader(str);
            var size = br.ReadBytes((int) str.Length);

            using (var obj = new ROPAEntities())
            {
                var upld = new UploadFile();
                upld.GUID = Guid.NewGuid().ToString();
                upld.AppVersion = (decimal) 2.30;

                upld.FIleFor = filename;
                upld.SurApp_Id = 47;
                upld.fileext = getExts;

                obj.AddToUploadFiles(upld);
                obj.SaveChanges();
            }
            BindGridviewData();
        }
        catch (Exception)
        {

        }
    }
Example #4
0
 public List<FeedbackDeatils> FeedbackDetailsToGrid()
 {
     using (ROPAEntities obj = new ROPAEntities())
     {
         var Query = (from a in obj.FeedBackForms select new FeedbackDeatils { Feedbackid = a.FeedBackId, Comments = a.Commments }).ToList().Take(5);
         return Query.ToList();
     }
 }
Example #5
0
 public void BindDeatails()
 {
     using (ROPAEntities obj = new ROPAEntities())
     {
         var userdetails = (from a in obj.UpcmomingSurveyors select a).ToList().Count;
        // userdetails;
      }
 }
Example #6
0
 private void GenrateDropDownlist()
 {
     var context = new ROPAEntities();
     var query = from m in context.Countries select m;
     ddlCountry.DataValueField = "countrycode";
     ddlCountry.DataTextField = "CountryName";
     ddlCountry.DataSource = query;
     ddlCountry.DataBind();
 }
Example #7
0
    public bool CheckAvliablity(string EmailId)
    {
        using (ROPAEntities context = new ROPAEntities())
        {

            bool exists = context.UpcmomingSurveyors.Any(u => u.EMAILID == EmailId);
            return exists;
        }
    }
 public UploadFile GetDocument(int id)
 {
     using (ROPAEntities entity = new ROPAEntities())
     {
         var doc = (from a in entity.UploadFiles
                    where a.UPloadId == id
                    select a).FirstOrDefault();
         return doc;
     }
 }
Example #9
0
    void GenrateDropdownlist()
    {
        //Model
        ROPAEntities context = new ROPAEntities();
        //LinQ to sql  Query
        var query = from m in context.UpcomingRoles select m;

        ddlRoleId.DataValueField = "RoleId";
        ddlRoleId.DataTextField = "RoleName";
        ddlRoleId.DataSource = query;
        ddlRoleId.DataBind();
    }
Example #10
0
 public int Deleteuser(string FirstName)
 {
     int result = 0;
     using (ROPAEntities context = new ROPAEntities())
     {
         var UserName = (from u in context.UpcmomingSurveyors where u.FirstName == FirstName select new { u.LastName }).FirstOrDefault();
         var deleteQuery = (from u in context.UpcmomingSurveyors where u.FirstName == FirstName select u).FirstOrDefault();
         context.DeleteObject(deleteQuery);
         result=context.SaveChanges();
        return result;
     }
 }
Example #11
0
    protected void bttnseach_Click(object sender, EventArgs e)
    {
        //GenrateDropdownlist();
        int value;
        value = Convert.ToInt32(txtSrch.Text);
        if (value != null)
        {

            ROPAEntities cont = new ROPAEntities();
            var kk = (from a in cont.UpcmomingSurveyors where a.SurApp_Id == value select a).FirstOrDefault();
            txtFrstName.Text = kk.FirstName;
            txtLastName.Text = kk.LastName;
            ddlRoleId.SelectedIndex = Convert.ToInt32(kk.ApplyAsRole);
            txtpsswrd.Text = kk.Password;
            tblreg.Visible = true;
        }
    }
Example #12
0
 public int insertRecord(string FName, string EmailId, string PhoneNumb, string Address, string CuntryCode, string commnts)
 {
     using (var cont = new ROPAEntities())
     {
         var obj = new FeedBackForm{
             FirstName = FName,
             EmailId = EmailId,
             PhoneNumber = PhoneNumb,
             Addres = Address,
             countrycode = CuntryCode,
             Commments = commnts,
             insertDate = DateTime.Now
         };
         cont.AddToFeedBackForms(obj);
         int result = cont.SaveChanges();
         return result;
     }
 }
Example #13
0
 public int insertRecord(string FName, string EmailId, string PhoneNumb, string Address, string CuntryCode, string commnts)
 {
     int result = 0;
     using (ROPAEntities cont = new ROPAEntities())
     {
         FeedBackForm obj = new FeedBackForm();
         obj.FirstName = FName;
         obj.EmailId = EmailId;
         obj.PhoneNumber = PhoneNumb;
         obj.Addres = Address;
         obj.countrycode = CuntryCode;
         obj.Commments = commnts;
         obj.insertDate = DateTime.Now;
         cont.AddToFeedBackForms(obj);
         result = cont.SaveChanges();
         return result;
     }
 }
Example #14
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string emailid;
        emailid = txtInt.Text.Trim();
        ROPAEntities context = new ROPAEntities();

        var Query = (from a in context.UpcmomingSurveyors where a.EMAILID == emailid select a).FirstOrDefault();
        if (Query != null)
        {
            ROPAUtil obj = new ROPAUtil();
           Query.FirstName = txtFrstName.Text.Trim();
           Query.LastName = txtLastName.Text.Trim();
           Query.ApplyAsRole = Convert.ToInt32(ddlRoleId.SelectedValue);
           Query.Password = txtpsswrd.Text.Trim();
           Query.EMAILID = txtEmailId.Text.Trim();
           Query.ModifedDate = DateTime.Now;
           Query.AppId = 2;
           context.SaveChanges();
         }
    }
Example #15
0
    protected void bttnsubmt_Click(object sender, EventArgs e)
    {
        //Get Record by id

        //int value;
           // value = Convert.ToInt32(txtInt.Text);

        string emailid;
        emailid = txtInt.Text.Trim();

        if (emailid != null)
        {
            ROPAEntities cont = new ROPAEntities();
            var Query = (from a in cont.UpcmomingSurveyors where a.EMAILID==emailid select a).FirstOrDefault();
            txtFrstName.Text = Query.FirstName;
            txtLastName.Text = Query.LastName;
            ddlRoleId.SelectedIndex = Convert.ToInt32(Query.ApplyAsRole);
            txtpsswrd.Text = Query.Password;
            txtEmailId.Text = Query.EMAILID;
        }
    }
    protected void DropDownlist()
    {
        ROPAEntities context = new ROPAEntities();
        var query = from m in context.UpcomingRoles select m;
        Label lblddlrole = new Label();
        lblddlrole.Text = "Apply As Role";
        plcHldrRegsform.Controls.Add(lblddlrole);

        DropDownList ddldropdwnlist = new DropDownList();
        ddldropdwnlist.ID = "Ddlroleid";

        ddldropdwnlist.Items.Add(new ListItem("Select","0"));

        ddldropdwnlist.Items.Add(new ListItem(Convert.ToString(ddldropdwnlist.DataValueField="RoleId").ToString(),Convert.ToString(ddldropdwnlist.DataTextField="RoleName").ToString()));
        ddldropdwnlist.DataSource = query;
        ddldropdwnlist.DataBind();
        plcHldrRegsform.Controls.Add(ddldropdwnlist);

          //  for (int i = 65; i <= 70; i++)
        //    {
        //ddldropdwnlist.Items.Add(new ListItem(Convert.ToChar(i).ToString(),Convert.ToChar(i).ToString()));
           // plcHldrRegsform.Controls.Add(ddldropdwnlist);
           // }
    }
Example #17
0
 public void UpdateRecord(string FirstName, string Lastname, int applyAsrole, string password, string emailId)
 {
     // int result = 0;
     using (ROPAEntities context = new ROPAEntities())
     {
         UpcmomingSurveyor obj = new UpcmomingSurveyor();
         obj.FirstName = FirstName;
         obj.LastName = Lastname;
         obj.ApplyAsRole = applyAsrole;
         obj.Password = password;
         obj.EMAILID = emailId;
         obj.ModifedDate = DateTime.Now;
         obj.AppId = 2;
        // context.AddToUpcmomingSurveyors(obj);
        // result=
             context.SaveChanges();
        // return result;
     }
 }
Example #18
0
 public int InsertRecord(string FirstName, string Lastname, int applyAsrole, string password, string emailId, List<UploadFile> L)
 {
     int result = 0;
      using (ROPAEntities context = new ROPAEntities())
     {
         UpcmomingSurveyor obj = new UpcmomingSurveyor();
         obj.FirstName = FirstName;
         obj.LastName = Lastname;
         obj.ApplyAsRole = applyAsrole;
         obj.Password = password;
         obj.AppId = 1;
         obj.ModifedDate = DateTime.Now;
         obj.EMAILID = emailId;
         context.AddToUpcmomingSurveyors(obj);
         foreach (UploadFile G in L)
         {
             UploadFiles  Upld = new UploadFiles();
             string s = G.GUID;
             var Q = (from u in context.UploadFiles where u.GUID ==s  select u).FirstOrDefault();
             Q.SurApp_Id = obj.SurApp_Id;
         }
        context.SaveChanges();
        return result;
     }
 }
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        string filename = Path.GetFileName(fileUpload1.PostedFile.FileName);

        Stream stream = fileUpload1.PostedFile.InputStream;

        int fileSize = fileUpload1.PostedFile.ContentLength;

        string extension = Path.GetExtension(filename);
        //Write Save Logic  to file/
        BinaryReader br = new BinaryReader(stream);
        Byte[] size = br.ReadBytes((int)stream.Length);
        //SaveToFolder(stream, filename);

        //Database already here
        List<UploadFile> L = ResolveList();

        if (L.Count > 0)
        {
            //If file is Already Exist or not if exist skip this step
            bool flag;
            flag = IsFileExistOrNot(L, filename);
            if (IsFileExistOrNot(L, filename) == false)
            {
                using (ROPAEntities obj = new ROPAEntities())
                {
                    Guid G = Guid.NewGuid();
                    UploadFile upld = new UploadFile();
                    upld.GUID = G.ToString();
                    upld.FIleFor = filename;
                    upld.SurApp_Id = null;
                    upld.filecc = size;
                    obj.AddToUploadFiles(upld);
                    obj.SaveChanges();

                    L.Add(upld);
                }
                UpdateSession(L);
                BindGridviewData();
            }
        }
        else
        {
            //Not there here  first time
            using (ROPAEntities obj = new ROPAEntities())
            {
                Guid G = Guid.NewGuid();
                UploadFile upld = new UploadFile();
                upld.GUID = G.ToString();
                upld.FIleFor = filename;
                upld.filecc = size;
                obj.AddToUploadFiles(upld);
                obj.SaveChanges();
                L.Add(upld);
            }
            UpdateSession(L);
            BindGridviewData();
        }
    }
Example #20
0
    public List<UploadFiles> FilesToGrid()
    {
        using (ROPAEntities obj = new ROPAEntities())
        {

            var query = (from a in obj.UploadFiles select new UploadFiles { UploadId = a.UPloadId, Filepath = a.FIleFor }).ToList();
            return query.ToList();

        }
    }
    void GenrateDropdownlist()
    {
        try
        {
            ROPAEntities context = new ROPAEntities();
            var query = from m in context.UpcomingRoles select m;
            ddlRoleId.DataValueField = "RoleId";
            ddlRoleId.DataTextField = "RoleName";
            ddlRoleId.DataSource = query;
            ddlRoleId.DataBind();
        }
        catch (Exception)
        {

        }
    }
    void Clear()
    {
        txtEmailId.Text = "";
        txtFrstName.Text = "";
        txtLastName.Text = "";
        txtpsswrd.Text = "";
        ddlRoleId.ClearSelection();

        using (ROPAEntities context = new ROPAEntities())
        {
            var deleteQuery = (from u in context.UploadFiles where u.SurApp_Id == null select u).ToList();
            context.DeleteObject(deleteQuery);
            context.SaveChanges();
        }

        ClearSession();
    }
    protected void gvDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            e.Cancel = true;
            int UploadId = Convert.ToInt32(gvDetails.DataKeys[e.RowIndex].Value);
            List<UploadFile> L = ResolveList();
            using (ROPAEntities contxt = new ROPAEntities())
            {
                var entity = (from surapp in contxt.UploadFiles where surapp.UPloadId == UploadId select surapp).FirstOrDefault();
                contxt.UploadFiles.DeleteObject(entity);
                contxt.SaveChanges();
                foreach (UploadFile item in L)
                {
                    if (item.UPloadId == UploadId)
                    {
                        L.Remove(item);
                        break;
                    }
                }
            }

            UpdateSession(L);
            BindGridviewData();
        }
        catch (Exception ex)
        {
        //		ACR.Framework.Common.Utilities.WriteToLogFile(new StackFrame(true), "LinkButtonDelete_Click", LoginUser.UserID.ToString(), TraceEventType.Error);
        }
    }
Example #24
0
 public string GetUserDetailsByEmailId(string EmailId)
 {
     using (ROPAEntities context = new ROPAEntities())
     {
         var UserPassword = (from u in context.UpcmomingSurveyors where u.EMAILID == EmailId select u.Password).FirstOrDefault();
         return UserPassword;
     }
 }
Example #25
0
 public byte GetDoc(int UploadId)
 {
     using (ROPAEntities obj = new ROPAEntities())
     {
         var doc = (from a in obj.UploadFiles where a.UPloadId == UploadId select a.filecc);
         return Convert.ToByte(doc);
     }
 }
Example #26
0
 public void UPdateFeedbackdetails(int number, string Comments)
 {
     using (ROPAEntities obj = new ROPAEntities())
     {
         var query = (from a in obj.FeedBackForms where a.FeedBackId == number select a).FirstOrDefault();
         if (query != null)
         {
             query.Commments = Comments.Trim();
             query.insertDate = DateTime.Now;
             obj.SaveChanges();
         }
     }
 }