public string userAndDocumentTableSelectAndReturnDocName(string tempuser)
        {
            try
            {
                udtemp = context2.UserAndDocumentTables.FirstOrDefault(x => x.user_id == tempuser && x.user_doc_id > userdocidforsharelist);
                userdocidforsharelist = udtemp.user_doc_id;
                dtemp = context.DocumentTables.SingleOrDefault(x => x.doc_id == udtemp.doc_id);
                return(dtemp.doc_name);
            }

            catch (Exception)
            {
                string message = "Not Found";
                return(message);
            }
        }
        //Insert into DocumentTable

        public void documentTableInsert(string docName, string docId, string docType, string scanId, string filingPath, string fileId, string checkInTime, string docSize)
        {
            DocumentTable ob = new DocumentTable();

            ob.doc_name               = docName;
            ob.doc_id                 = docId;
            ob.doc_type               = docType;
            ob.file_id                = fileId;
            ob.filing_path            = filingPath;
            ob.scan_id                = scanId;
            ob.checkin_time           = checkInTime;
            ob.size                   = docSize;
            ob.total_share_in_group   = 0;
            ob.total_share_individual = 1;

            context.DocumentTables.InsertOnSubmit(ob);
            context.SubmitChanges();
        }
        public string documentTableSelectByDocName(string docName, string user)
        {
            utemp = context.UserTables.SingleOrDefault(x => x.user_id == user);
            int noofdoc = utemp.no_of_document;

            userdocid = 0;
            for (int i = 0; i < noofdoc; i++)
            {
                udtemp    = context2.UserAndDocumentTables.First(x => x.user_id == user && x.user_doc_id > userdocid);
                userdocid = udtemp.user_doc_id;
                string docId = udtemp.doc_id;
                dtemp = context.DocumentTables.SingleOrDefault(x => x.doc_id == docId);
                string name = dtemp.doc_name;
                if (name.Equals(docName))
                {
                    break;
                }
                else
                {
                    continue;
                }
            }
            return(dtemp.doc_id);
        }
 partial void DeleteDocumentTable(DocumentTable instance);
 partial void UpdateDocumentTable(DocumentTable instance);
 partial void InsertDocumentTable(DocumentTable instance);
 public string lastRowDocumentTable()
 {
     dtemp = context.DocumentTables.AsEnumerable().Last();
     return(dtemp.doc_id);
 }
 public string firstRowDocumentTable()
 {
     dtemp = context.DocumentTables.First();
     return(dtemp.doc_id);
 }
 public void totalShareInGroupUpdate(string docId)
 {
     dtemp = context.DocumentTables.SingleOrDefault(x => x.doc_id == docId);
     dtemp.total_share_in_group = dtemp.total_share_in_group + 1;
     context.SubmitChanges();
 }
 public string getDocSize(string docId)
 {
     dtemp = context.DocumentTables.SingleOrDefault(x => x.doc_id == docId);
     return(dtemp.size);
 }
 public string getDocCheckOutTime(string docId)
 {
     dtemp = context.DocumentTables.SingleOrDefault(x => x.doc_id == docId);
     return(dtemp.checkout_time);
 }
 public int getTotalShareIndividual(string docId)
 {
     dtemp = context.DocumentTables.SingleOrDefault(x => x.doc_id == docId);
     return(dtemp.total_share_individual);
 }
 public string getFilingPathByDocId(string docId)
 {
     dtemp = context.DocumentTables.SingleOrDefault(x => x.doc_id == docId);
     return(dtemp.filing_path);
 }
 public void setDocument(string docId)
 {
     dtemp = context.DocumentTables.SingleOrDefault(x => x.doc_id == docId);
 }
        //Enter into DocumentTable

        public string documentTableSelect(string docId)
        {
            dtemp = context.DocumentTables.SingleOrDefault(x => x.doc_id == docId);
            return(dtemp.doc_id);
        }