예제 #1
0
        public List <SP_GetDocumentList_Result> DeleteDocumentFormTemp(long DeletedSeq, string paraSessionID, string paraUserID, string paraTargetObjectName, string[] conn)
        {
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
            /*Begin : Get Existing Records from TempData*/
            List <SP_GetDocumentList_Result> existingDocumentList = new List <SP_GetDocumentList_Result>();

            existingDocumentList = GetTempDataByObjectNameSessionID(paraSessionID, paraUserID, paraTargetObjectName, conn).Where(d => d.Sequence != DeletedSeq).ToList();
            /*End*/

            SP_GetDocumentList_Result DocumentRec = new SP_GetDocumentList_Result();

            DocumentRec = GetTempDataByObjectNameSessionID(paraSessionID, paraUserID, paraTargetObjectName, conn).Where(d => d.Sequence == DeletedSeq).FirstOrDefault();
            if (DocumentRec != null)
            {
                DocumentRec.Active = "N";
                existingDocumentList.Add(DocumentRec);

                if (DocumentRec.ID == null)
                {
                    if (File.Exists(DocumentRec.DocumentSavePath))
                    {
                        File.Delete(DocumentRec.DocumentSavePath);
                    }
                }
            }
            /*Begin : Serialize & Save MergedAddToCartList*/
            SaveTempDataToDB(existingDocumentList, paraSessionID, paraUserID, paraTargetObjectName, conn);
            /*End*/
            return(existingDocumentList.Where(d => d.Active == "Y").OrderByDescending(d => d.Sequence).ToList());
        }
예제 #2
0
        public string CheckDuplicateDocumentTitle(string paraSessionID, string DocumentTitle, string paraUserID, string currentFormID, string[] conn)
        {
            string Result          = "";
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));

            List <SP_GetDocumentList_Result> existingAddressList = new List <SP_GetDocumentList_Result>();

            existingAddressList = GetTempDataByObjectNameSessionID(paraSessionID, paraUserID, currentFormID, conn);

            /*Get Filter List [Filter By paraSequence]*/
            SP_GetDocumentList_Result filterList = new SP_GetDocumentList_Result();

            filterList = (from exist in existingAddressList
                          where exist.DocumentName == DocumentTitle
                          select exist).FirstOrDefault();
            if (filterList == null)
            {
                Result = "";
            }
            else
            {
                Result = "Same Document Name Already Exist";
            }
            return(Result);
        }
예제 #3
0
        /// <summary>
        /// This Is Method ToInsert Record In to TempData table
        /// </summary>
        /// <param name="ContactPerson"></param>
        /// <param name="SessionID"></param>
        /// <param name="UserID"></param>
        /// <param name="paraObjectName"></param>
        /// <returns></returns>

        public List <SP_GetDocumentList_Result> InsertIntoTemp(SP_GetDocumentList_Result newDocument, string SessionID, string UserID, string TargetObjectName, string[] conn)
        {
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
            /*Begin : Get Existing Records from TempData*/
            List <SP_GetDocumentList_Result> existingDocumentList = new List <SP_GetDocumentList_Result>();

            existingDocumentList = GetTempDataByObjectNameSessionID(SessionID, UserID, TargetObjectName, conn);
            newDocument.Sequence = existingDocumentList.Count + 1;
            newDocument.Active   = "Y";
            /*End*/

            /*Begin : Merge (Existing + Newly Added) Products to Create TempData of AddToCart*/
            existingDocumentList.Add(newDocument);
            /*End*/

            /*Begin : Serialize & Save MergedAddToCartList*/
            SaveTempDataToDB(existingDocumentList, SessionID, UserID, TargetObjectName, conn);
            /*End*/
            return(existingDocumentList.Where(d => d.Active == "Y").OrderByDescending(d => d.Sequence).ToList());
        }
예제 #4
0
        protected void upload_LinkBtn_Click(object sender, EventArgs e)
        {
            string DocumentSaveAsPath               = "";
            string DocumentDownLoadPath             = "";
            string HttpAppPath                      = HttpRuntime.AppDomainAppPath;
            iUC_AttachDocumentClient documentClient = new iUC_AttachDocumentClient();

            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                if (FileUploadDocument.PostedFile != null)
                {
                    if (profile.Personal.CompanyID.ToString() != "")
                    {
                        if (!(Directory.Exists(HttpAppPath + "Document\\TempAttach_Document\\" + profile.Personal.CompanyID.ToString())))
                        {
                            Directory.CreateDirectory(HttpAppPath + "Document\\TempAttach_Document\\" + profile.Personal.CompanyID.ToString());
                        }
                    }
                    //string FileType = FileUploadDocument.PostedFile.ContentType.Split('/').LastOrDefault();
                    string[] strArr   = FileUploadDocument.PostedFile.FileName.Split('.');
                    string   FileType = strArr[strArr.Length - 1];
                    string   FileName = Session.SessionID.ToString() + "_" + DateTime.Now.Ticks.ToString() + "." + FileType;
                    DocumentDownLoadPath = "../Document/TempAttach_Document/" + profile.Personal.CompanyID.ToString() + "/" + FileName;
                    DocumentSaveAsPath   = HttpAppPath + "Document\\TempAttach_Document\\" + profile.Personal.CompanyID.ToString() + "\\" + FileName;
                    FileUploadDocument.SaveAs(DocumentSaveAsPath);

                    /*Insert into TempData*/
                    SP_GetDocumentList_Result newDocument = new SP_GetDocumentList_Result();

                    newDocument.ObjectName   = TargetObjectName;;
                    newDocument.ReferenceID  = Convert.ToInt64(Sequence);
                    newDocument.DocumentName = null;
                    if (txtDocTitle.Text.ToString().Trim() != "")
                    {
                        newDocument.DocumentName = txtDocTitle.Text.ToString().Trim();
                    }
                    newDocument.Sequence    = Convert.ToInt32(Sequence);
                    newDocument.Description = null;
                    if (txtDocDesc.Text.ToString().Trim() != "")
                    {
                        newDocument.Description = txtDocDesc.Text.ToString().Trim();
                    }

                    newDocument.DocumentDownloadPath = DocumentDownLoadPath;
                    newDocument.DocumentSavePath     = DocumentSaveAsPath;
                    newDocument.FileType             = FileType;

                    newDocument.Keywords = null;
                    if (txtKeyword.Text.ToString().Trim() != "")
                    {
                        newDocument.Keywords = txtKeyword.Text.ToString().Trim();
                    }

                    if (rbtnPrivate.Checked == true)
                    {
                        newDocument.ViewAccess_Value    = "";
                        newDocument.DeleteAccess_Value  = hdnDeleteAccessIDs.Value;
                        newDocument.DowloadAccess_Value = hdDownLoadAccessIDs.Value;
                    }
                    else if (rbtnPublic.Checked == true)
                    {
                        newDocument.ViewAccess_Value    = "Public";
                        newDocument.DeleteAccess_Value  = "Public";
                        newDocument.DowloadAccess_Value = "Public";
                    }
                    else if (rbtnSelf.Checked == true)
                    {
                        newDocument.ViewAccess_Value = newDocument.DeleteAccess_Value = newDocument.DowloadAccess_Value = profile.Personal.UserID.ToString();
                    }

                    newDocument.Active         = "Y";
                    newDocument.CreatedBy      = profile.Personal.UserID.ToString();
                    newDocument.CreationDate   = DateTime.Now;
                    newDocument.CustomerHeadID = 0;
                    newDocument.CompanyID      = profile.Personal.CompanyID;
                    newDocument.ViewAccess     = "true";
                    newDocument.DeleteAccess   = "true";
                    newDocument.DowloadAccess  = "true";

                    newDocument.DocumentType = ddlDocumentType.SelectedValue.ToString();

                    documentClient.InsertIntoTemp(newDocument, Session.SessionID.ToString(), profile.Personal.UserID.ToString(), TargetObjectName, profile.DBConnection._constr);
                    if (Session["PORRequestID"].ToString() != "0" && Session["PORRequestID"].ToString() != "Company")
                    {
                        long RequestID = Convert.ToInt64(Session["PORRequestID"].ToString());
                        documentClient.FinalSaveToDBtDocument(Session.SessionID.ToString(), RequestID, profile.Personal.UserID.ToString(), "RequestPartDetailDocument", HttpRuntime.AppDomainAppPath.ToString(), profile.DBConnection._constr);
                    }
                    else
                    {
                        // documentClient.FinalSaveToDBtDocument(Session.SessionID.ToString(), 0, profile.Personal.UserID.ToString(), "Setup", HttpRuntime.AppDomainAppPath.ToString(), profile.DBConnection._constr);
                    }
                    ClientScript.RegisterStartupScript(GetType(), "hwa", "onSuccessTempSaveDocument('true');", true);
                }
            }
            catch (System.Exception ex)
            {
                if (DocumentSaveAsPath != "")
                {
                    if (File.Exists(DocumentSaveAsPath))
                    {
                        File.Delete(DocumentSaveAsPath);
                    }
                }
                Login.Profile.ErrorHandling(ex, this, "UC Document", "upload_LinkBtn_Click");
            }
            finally { documentClient.Close(); }
        }