Ejemplo n.º 1
0
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            if (ValidateAddFields())
            {
                string caseTitle = tbNewCaseTitle.Text;
                string smallDesc = NewSmallDesc.InnerText;
                int    caseID    = 0;
                caseID = AdminCases.AddNewCase(caseTitle, "", smallDesc, false);

                if (caseID > 0)
                {
                    string newFileName;
                    bool   uploaded = AdminCases.UploadFile(caseID, ref fuNewCaseFileName, out newFileName);

                    if (uploaded)
                    {
                        AdminCases.UpdateCaseFileName(caseID, newFileName);
                        lblMessage.Text = "Case was successfully added. ";
                    }
                    else
                    {
                        lblMessage.Text = "File was not uploaded.";
                    }
                }
                else
                {
                    lblMessage.Text = "Case was not added.";
                }
                tbNewCaseTitle.Text    = "";
                NewSmallDesc.InnerText = "";

                BindData();
            }
        }
Ejemplo n.º 2
0
        protected void UpdateDetails_Click(object sender, EventArgs e)
        {
            if (ValidateUpdateFields())
            {
                string caseTitle     = tbEditCaseTitle.Text;
                string caseSmallDesc = EditSmallDesc.InnerText;
                string caseFileName  = lblEditCaseFileName.Text;

                bool caseHidden = cbHidden.Checked;
                int  caseID     = int.Parse(hdnEditCaseID.Value);

                logger.Debug("caseID: " + caseID);
                if (caseTitle.Length >= 3 && caseID > 0)
                {
                    if (string.IsNullOrEmpty(fuEditCaseFileName.FileName) == false)
                    {
                        AdminCases.DeleteFile(caseID, caseFileName);
                        string newFileName;
                        AdminCases.UploadFile(caseID, ref fuEditCaseFileName, out newFileName);
                        AdminCases.UpdateCase(caseID, caseTitle, newFileName, caseSmallDesc, caseHidden, DateTime.Now);
                    }
                    else
                    {
                        AdminCases.UpdateCase(caseID, caseTitle, caseFileName, caseSmallDesc, caseHidden, DateTime.Now);
                    }

                    CaseEdit.Visible      = false;
                    AddNewCaseDiv.Visible = true;
                    BindData();
                    lblMessage.Text = "Case was successfully updated. ";
                }
                else
                {
                    lblMessage.Text = "Case Update Error: ";
                }
            }
        }