コード例 #1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            objDAEntities.FileFriendlyName    = txtFriendlyName.Text;
            objDAEntities.IsActiveJaslokTimes = chkFileActive.Checked;
            objDAEntities.JaslokTimesId       = Convert.ToInt32(hdnid.Value);

            if (fileUploadJaslokTimes.PostedFile.FileName != "")
            {
                //lblfileName.Text = fileUploadJaslokTimes.PostedFile.FileName;
                objDAEntities.FilePath = savefile(fileUploadJaslokTimes, CommonFn.JaslokTimesImages, CommonFn.DbJaslokTimesImages);
            }
            else
            {
                objDAEntities.FileName = hdnFileName.Value;
                objDAEntities.FilePath = hdnFilePath.Value;
            }
            if (fileUploadpdf.PostedFile.FileName != "")
            {
                // lblfdfName.Text = fileUploadpdf.PostedFile.FileName;
                objDAEntities.PdfPath = savefile(fileUploadpdf, CommonFn.JaslokTimesPdf, CommonFn.DbJaslokTimesPDF);
            }
            else
            {
                objDAEntities.PdfPath = hdnPdfPath.Value;
                //objDAEntities.FilePath = hdnFilePath.Value;
            }
            if (hdnid.Value == "0")
            {
                objDAEntities.CreatedByUserID = CommonFn.UserID;
                objBusinessLogic.AddJaslokTimes(objDAEntities);
                Clear();
                lblMessage.CssClass = "successlbl";
                lblMessage.Text     = "Jaslok time added successfully!!!";
                GetJaslokTimesDetails();
            }
            else
            {
                objDAEntities.UpdatedByUserID = CommonFn.UserID;
                objBusinessLogic.AddJaslokTimes(objDAEntities);
                Clear();
                lblMessage.CssClass = "successlbl";
                lblMessage.Text     = "Jaslok time updated successfully!!!";
                GetJaslokTimesDetails();
            }
            ShowView();
        }
        catch (Exception ex)
        {
            Response.Write(ex.StackTrace);
        }
    }