//upload uncomplete
    protected void btnSaveAndApprove_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        dt = objUploadFilesize.Get_Module_FileUpload("CWF_");
        try
        {
            if (txtRemarks.Text != "")
            {
                string FileName = "";
                string DocName  = "";
                string FileExt  = "";
                int    CardID   = objBLLCrew.INS_CrewYellow_RedCard(GetCrewID(), UDFLib.ConvertToInteger(ddlCrewCardType.SelectedValue), txtRemarks.Text, GetSessionUserID());


                if (FileUpload_LW.HasFile)
                {
                    FileName = Path.GetFileName(FileUpload_LW.FileName);

                    Guid GUID = Guid.NewGuid();
                    FileExt  = Path.GetExtension(FileName).ToLower();
                    DocName  = FileName.Replace(FileExt, "");
                    FileName = GUID.ToString() + FileExt;

                    string strPath = MapPath("~/Uploads/CrewDocuments/") + FileName;
                    FileUpload_LW.SaveAs(strPath);
                    int Ret1 = objBLLCrew.INS_CrewCard_Attachment(CardID, 1, DocName, FileName, GetSessionUserID());
                }
                if (FileUpload_LB.HasFile)
                {
                    FileName = Path.GetFileName(FileUpload_LB.FileName);
                    Guid GUID = Guid.NewGuid();
                    FileExt  = Path.GetExtension(FileName).ToLower();
                    DocName  = FileName.Replace(FileExt, "");
                    FileName = GUID.ToString() + FileExt;

                    string strPath = MapPath("~/Uploads/CrewDocuments/") + FileName;
                    FileUpload_LB.SaveAs(strPath);
                    int Ret2 = objBLLCrew.INS_CrewCard_Attachment(CardID, 2, DocName, FileName, GetSessionUserID());
                }
                if (FileUpload_P.HasFile)
                {
                    FileName = Path.GetFileName(FileUpload_P.FileName);
                    Guid GUID = Guid.NewGuid();
                    FileExt  = Path.GetExtension(FileName).ToLower();
                    DocName  = FileName.Replace(FileExt, "");
                    FileName = GUID.ToString() + FileExt;

                    string strPath = MapPath("~/Uploads/CrewDocuments/") + FileName;
                    FileUpload_P.SaveAs(strPath);
                    int Ret3 = objBLLCrew.INS_CrewCard_Attachment(CardID, 3, DocName, FileName, GetSessionUserID());
                }


                txtRemarks.Text = "";
                string js = "";


                if (CardID == -1)
                {
                    js = "alert('Unable to save the card proposal.');";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);
                }
                else if (CardID > 0)
                {
                    int Ret = objBLLCrew.Approve_CrewYellow_RedCard(1, CardID, txtRemarks.Text, GetSessionUserID());

                    if (Ret == 1)
                    {
                        js = "alert('Crew card approved'); window.parent.document.getElementById('ctl00_MainContent_btnRefreshCrewCardStatus').click();";
                    }
                    if (Ret == -1)
                    {
                        js = "alert('Unable to approve/reject the crew card.');";
                    }
                    if (Ret == -2)
                    {
                        js = "alert('Crew card PROPOSED, but NOT APPROVED. Please upload Letter of Warning and approve again.');window.reload();";
                    }

                    ScriptManager.RegisterStartupScript(this, this.GetType(), "msg2", js, true);
                }
            }
            else
            {
                lblMessage.Text = "Please enter your remark and Save";
            }
        }
        catch (Exception ex)
        {
            lblMessage.Text = ex.Message;
        }
    }
    protected void btnProposeCard_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        dt = objUploadFilesize.Get_Module_FileUpload("CWF_");

        try
        {
            if (txtRemarks.Text != "")
            {
                if (dt.Rows.Count > 0)
                {
                    string datasize = dt.Rows[0]["Size_KB"].ToString();
                    string FileName = "";
                    string DocName  = "";
                    string FileExt  = "";
                    int    CardID   = objBLLCrew.INS_CrewYellow_RedCard(GetCrewID(), UDFLib.ConvertToInteger(ddlCrewCardType.SelectedValue), txtRemarks.Text, GetSessionUserID());

                    if (FileUpload_LW.HasFile)
                    {
                        if (FileUpload_LW.PostedFile.ContentLength < Int32.Parse(dt.Rows[0]["Size_KB"].ToString()) * 1024)
                        {
                            FileName = Path.GetFileName(FileUpload_LW.FileName);

                            Guid GUID = Guid.NewGuid();
                            FileExt  = Path.GetExtension(FileName).ToLower();
                            DocName  = FileName.Replace(FileExt, "");
                            FileName = GUID.ToString() + FileExt;

                            string strPath = MapPath("~/Uploads/CrewDocuments/") + FileName;
                            FileUpload_LW.SaveAs(strPath);

                            objBLLCrew.INS_CrewCard_Attachment(CardID, 1, DocName, FileName, GetSessionUserID());
                            //int Ret1 = objBLLCrew.INS_CrewCard_Attachment(CardID, 1, FileName.Replace(Path.GetExtension(FileName), ""), FileName, GetSessionUserID());
                        }
                        else
                        {
                            lblMessage.Text = datasize + " KB File size exceeds maximum limit";
                            return;
                        }
                    }
                    if (FileUpload_LB.HasFile)
                    {
                        if (FileUpload_LB.PostedFile.ContentLength < Int32.Parse(dt.Rows[0]["Size_KB"].ToString()) * 1024)
                        {
                            FileName = Path.GetFileName(FileUpload_LB.FileName);

                            Guid GUID = Guid.NewGuid();
                            FileExt  = Path.GetExtension(FileName).ToLower();
                            DocName  = FileName.Replace(FileExt, "");
                            FileName = GUID.ToString() + FileExt;

                            string strPath = MapPath("~/Uploads/CrewDocuments/") + FileName;
                            FileUpload_LB.SaveAs(strPath);
                            objBLLCrew.INS_CrewCard_Attachment(CardID, 2, DocName, FileName, GetSessionUserID());
                            //int Ret2 = objBLLCrew.INS_CrewCard_Attachment(CardID, 2, FileName.Replace(Path.GetExtension(FileName), ""), FileName, GetSessionUserID());
                        }
                        else
                        {
                            lblMessage.Text = datasize + " KB File size exceeds maximum limit";
                            return;
                        }
                    }
                    if (FileUpload_P.HasFile)
                    {
                        if (FileUpload_P.PostedFile.ContentLength < Int32.Parse(dt.Rows[0]["Size_KB"].ToString()) * 1024)
                        {
                            FileName = Path.GetFileName(FileUpload_P.FileName);

                            Guid GUID = Guid.NewGuid();
                            FileExt  = Path.GetExtension(FileName).ToLower();
                            DocName  = FileName.Replace(FileExt, "");
                            FileName = GUID.ToString() + FileExt;

                            string strPath = MapPath("~/Uploads/CrewDocuments/") + FileName;
                            FileUpload_P.SaveAs(strPath);
                            objBLLCrew.INS_CrewCard_Attachment(CardID, 3, DocName, FileName, GetSessionUserID());
                            //int Ret3 = objBLLCrew.INS_CrewCard_Attachment(CardID, 3, FileName.Replace(Path.GetExtension(FileName), ""), FileName, GetSessionUserID());
                        }
                        else
                        {
                            lblMessage.Text = datasize + " KB File size exceeds maximum limit";
                            return;
                        }
                    }
                    txtRemarks.Text = "";
                    string js = "";


                    if (CardID == -1)
                    {
                        js = "alert('A " + ddlCrewCardType.SelectedItem.Text + " is already proposed for the crew.');";
                    }
                    else if (CardID > 0)
                    {
                        js = String.Format("alert('" + ddlCrewCardType.SelectedItem.Text + " proposed for the crew.');parent.document.getElementById('ctl00_MainContent_btnRefreshCrewCardStatus').click();");
                    }
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);
                }
                else
                {
                    string js2 = "alert('Upload size not set!');";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert9", js2, true);
                }
            }
            else
            {
                lblMessage.Text = "Please enter your Feedback and Save";
            }
        }
        catch (Exception ex)
        {
            lblMessage.Text = ex.Message;
        }
    }