コード例 #1
0
        public override void UserControlLoad()
        {
            if (this.ownerPage == null)
            {
                throw new UMSException("Current Page is null or is not inheritor of BasicPage.");
            }

            if (string.IsNullOrEmpty(AttachmentDocumentType))
            {
                this.ownerPage.ShowMSG("Атрибура AttachmentDocumentType е NULL. Да се въведе стойност преди да се използва контролата.");
                return;
            }

            if (string.IsNullOrEmpty(ModuleSysName))
            {
                this.ownerPage.ShowMSG("Атрибура ModuleSysName е NULL. Да се въведе стойност преди да се използва контролата.");
                return;
            }

            this.ddlAttachmentType.KeyTypeIntCode = this.DocKeyTypeIntCode;

            this.ddlAttachmentType.UserControlLoad();

            this.pnlFormData.Visible = true;
            this.currentEntity = this.ownerPage.CommonClientRef.GetAttachmentID(this.CurrentEntityMasterID);

            if (currentEntity != null)
            {
                this.tbxDescription.Text = currentEntity.Description;
                this.tbxAttachmentDate.Text = currentEntity.AttachmentDate.ToString("dd.MM.yyyy");
                this.ddlAttachmentType.SelectedValue = currentEntity.idAttachmentType.ToString();

                string tmpFolderName = BaseHelper.CheckAndReplaceStringName(this.tbxDescription.Text, "_").Replace("\n", "").Replace("\r", "");

                tmpFolderName = (tmpFolderName.Length > 50) ? tmpFolderName.Substring(0, 50) : tmpFolderName;

                this.fuAttachment.UserControlName = AttachmentDocumentType;
                this.fuAttachment.CustomFolder = currentEntity.EntityID + "_" + tmpFolderName;
                this.fuAttachment.UserControlLoad();
                this.fuAttachment.BtnUploadFileEnabled = true;

                this.hdnRowMasterKey.Value = currentEntity.EntityID.ToString();
            }
            else
            {
                this.fuAttachment.UserControlName = AttachmentDocumentType;
                this.fuAttachment.ClearGrid();
                this.fuAttachment.BtnUploadFileEnabled = false;

                this.lbResultContext.Text = "";

                this.tbxDescription.Text = string.Empty;
                this.tbxAttachmentDate.Text = DateTime.Now.ToString("dd.MM.yyyy");

                this.ddlAttachmentType.SelectedValue = Constants.INVALID_ID_STRING;

                this.hdnRowMasterKey.Value = string.Empty;
            }
        }
コード例 #2
0
 /// <summary>
 /// Create a new Attachment object.
 /// </summary>
 /// <param name="idAttachment">Initial value of the idAttachment property.</param>
 /// <param name="idModule">Initial value of the idModule property.</param>
 /// <param name="idAttachmentType">Initial value of the idAttachmentType property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="attachmentDate">Initial value of the AttachmentDate property.</param>
 /// <param name="idUser">Initial value of the idUser property.</param>
 public static Attachment CreateAttachment(global::System.Int32 idAttachment, global::System.Int32 idModule, global::System.Int32 idAttachmentType, global::System.String description, global::System.DateTime attachmentDate, global::System.Int32 idUser)
 {
     Attachment attachment = new Attachment();
     attachment.idAttachment = idAttachment;
     attachment.idModule = idModule;
     attachment.idAttachmentType = idAttachmentType;
     attachment.Description = description;
     attachment.AttachmentDate = attachmentDate;
     attachment.idUser = idUser;
     return attachment;
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Attachments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAttachments(Attachment attachment)
 {
     base.AddObject("Attachments", attachment);
 }
コード例 #4
0
ファイル: Common.svc.cs プロジェクト: borisov90/Projects
        public CallContext AttachmentSave(Attachment entity, CallContext resultContext)
        {
            resultContext.securitySettings = ETEMEnums.SecuritySettings.AttachmentSave;
            CallContext resContext = new AttachmentBL().EntitySave<Attachment>(entity, resultContext);

            return resContext;
        }
コード例 #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string moduleSysName = this.ownerPage.FormContext.QueryString["ModuleSysName"].ToString();
            string attachmentDocumentType = this.ownerPage.FormContext.QueryString["AttachmentDocumentType"].ToString();

            if (moduleSysName == Constants.MODULE_FINANCE &&
                attachmentDocumentType == ETEMEnums.FinanceReportTypeEnum.FinanceReport.ToString())
            {
                if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.AttachmentSave, false))
                {
                    return;
                }
            }





            if (string.IsNullOrEmpty(this.tbxDescription.Text))
            {
                this.ownerPage.ShowJavaScriptMSG("Моля, описание на документа.");
                return;
            }

            if (this.tbxAttachmentDate.TextAsDateParseExact == null)
            {
                this.ownerPage.ShowJavaScriptMSG("Моля, въведете дата.");
                return;
            }

            if (this.ddlAttachmentType.SelectedValueINT == Constants.INVALID_ID)
            {
                this.ownerPage.ShowJavaScriptMSG("Моля, въведете вид документ.");
                return;
            }

            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value))
            {
                this.currentEntity = new Attachment();
                this.currentEntity.idUser = Int32.Parse(this.ownerPage.UserProps.IdUser);

                Module module = this.ownerPage.AdminClientRef.GetModuleBySysName(ModuleSysName);
                this.currentEntity.idModule = module.idModule;
            }
            else
            {
                this.currentEntity = this.ownerPage.CommonClientRef.GetAttachmentID(this.hdnRowMasterKey.Value);

                if (this.currentEntity == null)
                {
                    this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_Setting_Not_Found_By_ID"), this.hdnRowMasterKey.Value);
                    this.ownerPage.FormLoad();
                    return;
                }
            }

            currentEntity.Description = this.tbxDescription.Text;
            currentEntity.AttachmentDate = this.tbxAttachmentDate.TextAsDateParseExact.Value;
            currentEntity.idAttachmentType = this.ddlAttachmentType.SelectedValueINT;

            this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;

            this.ownerPage.CallContext = this.ownerPage.CommonClientRef.AttachmentSave(currentEntity, this.ownerPage.CallContext);

            this.lbResultContext.Text = this.ownerPage.CallContext.Message;
            this.hdnRowMasterKey.Value = this.ownerPage.CallContext.EntityID;
            this.CurrentEntityMasterID = this.ownerPage.CallContext.EntityID;

            CheckIfResultIsSuccess(this.lbResultContext);

            UserControlLoad();

            this.ownerPage.FormLoad();
        }