예제 #1
0
 protected void cgvActivity_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     try
     {
         Label   id          = cgvActivity.Rows[e.RowIndex].FindControl("lblId") as Label;
         int     activityId  = Convert.ToInt32(id.Text);
         TextBox activity    = cgvActivity.Rows[e.RowIndex].FindControl("txtActivity") as TextBox;
         string  strActivity = activity.Text;
         ManageActivityBAL.Instance.UpdateActivity(activityId, strActivity);
         UserBAL.Instance.InsertAuditTrailDetail("Updated Activity", "Manage Activites");
         cgvActivity.EditIndex = -1;
         GetManageActivityData();
         string strSuccess = "Activity has been updated successfully.";
         vmSuccess.Message = strSuccess;
         FlashMessage.InfoMessage(vmSuccess.Message);
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
         //return;
     }
 }
예제 #2
0
        private bool IsCWLWObligationsSubmitted(int apoFileId)
        {
            bool    IsCWLWObligations = false;
            DataSet dsCheckObligation = CheckListBAL.Instance.CheckCWLWObligations(apoFileId);

            if (dsCheckObligation != null && dsCheckObligation.Tables[0].Rows.Count == 1)
            {
                DataRow dr = dsCheckObligation.Tables[0].Rows[0];
                if (!string.IsNullOrEmpty(dr["IsCWWObligationSubmitted"].ToString()))
                {
                    IsCWLWObligations = Convert.ToBoolean(dr["IsCWWObligationSubmitted"]);
                }
                if (IsCWLWObligations != true)
                {
                    string strInfo = ConfigurationManager.AppSettings["CheckCWLWObligations"];
                    vmError.Message = strInfo;
                    FlashMessage.InfoMessage(vmError.Message);
                }
                else
                {
                    IsCWLWObligations = true;
                }
            }
            return(IsCWLWObligations);
        }
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         int tigerReserveId           = Convert.ToInt32(ddlTigerReserve.SelectedValue);
         int centralNonRecurringRatio = Convert.ToInt32(txtCentralNonRecurringRatio.Text);
         int centralRecurringRatio    = Convert.ToInt32(txtCentralRecurringRatio.Text);
         int stateNonRecurringRatio   = Convert.ToInt32(txtStateNonRecurringRatio.Text);
         int stateRecurringRatio      = Convert.ToInt32(txtStateRecurringRatio.Text);
         if (centralNonRecurringRatio <= 100 && centralRecurringRatio <= 100)
         {
             ManageNonRecurringRecurringRatioBAL.Instance.UpdateRecuringAndNonReecurringRatio(tigerReserveId, centralNonRecurringRatio, centralRecurringRatio, stateNonRecurringRatio, stateRecurringRatio);
             string strSuccess = "Non-Recurring and Recurring ratio updated successfully.";
             vmSuccess.Message = strSuccess;
             FlashMessage.InfoMessage(vmSuccess.Message);
         }
         else
         {
             string strError = "Non-Recurring ratio should be less than or equal to 100 !";
             vmError.Message = strError;
             FlashMessage.ErrorMessage(vmError.Message);
             return;
         }
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
         //return;
     }
 }
예제 #4
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(txtSetFirstInstallment.Text) && !string.IsNullOrEmpty(txtSetSecondInstallment.Text))
         {
             double firstInstallment  = Convert.ToDouble(txtSetFirstInstallment.Text);
             double secondInstallment = Convert.ToDouble(txtSetSecondInstallment.Text);
             if (firstInstallment <= 100.00 && secondInstallment <= 100.00)
             {
                 ManageInstallmentBAL.Instance.UpdateInstallments(Convert.ToInt32(ddlTigerReserve.SelectedValue), firstInstallment, secondInstallment);
                 string strSuccess = "Installments has been updated successfully.";
                 vmSuccess.Message = strSuccess;
                 FlashMessage.InfoMessage(vmSuccess.Message);
                 UserBAL.Instance.InsertAuditTrailDetail("Updated Installment Ratio", "Manage Installment");
             }
             else
             {
                 string strError = "First installment should be greater than or equal to 000.00 and less than or equal to 100.00 !";
                 vmError.Message = strError;
                 FlashMessage.ErrorMessage(vmError.Message);
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
         //return;
     }
 }
예제 #5
0
 protected void cgvDocuments_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "download")
     {
         LinkButton  lnkdownload = (LinkButton)e.CommandSource;
         GridViewRow gvrow       = lnkdownload.NamingContainer as GridViewRow;
         string      fileName    = cgvDocuments.DataKeys[gvrow.RowIndex].Value.ToString();
         string      filePath    = "~/Downloads/" + fileName;
         Response.ContentType = "doc/pdf";
         Response.AddHeader("Content-Disposition", "attachment;filename=\"" + filePath + "\"");
         if (System.IO.File.Exists(Server.MapPath(filePath)))
         {
             Response.TransmitFile(Server.MapPath(filePath));
         }
         else
         {
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "File Error", "alert('File does not exists');", true);
         }
         Response.End();
     }
     if (e.CommandName == "print")
     {
         try
         {
             LinkButton  lnkPrint = (LinkButton)e.CommandSource;
             GridViewRow gvrow    = lnkPrint.NamingContainer as GridViewRow;
             string      fileName = cgvDocuments.DataKeys[gvrow.RowIndex].Value.ToString();
             string      filePath = "~/Downloads/" + fileName;
             if (System.IO.File.Exists(Server.MapPath(filePath)))
             {
                 string  pdfPath  = Server.MapPath(filePath);
                 Process printjob = new Process();
                 printjob.StartInfo.FileName       = Server.MapPath(filePath);
                 printjob.StartInfo.Verb           = "Print";
                 printjob.StartInfo.CreateNoWindow = true;
                 printjob.StartInfo.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                 PrinterSettings setting = new PrinterSettings();
                 setting.DefaultPageSettings.Landscape = true;
                 printjob.Start();
                 string strSuccess = "Pdf has printed successfully.";
                 vmSuccess.Message = strSuccess;
                 FlashMessage.InfoMessage(vmSuccess.Message);
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "File Error", "alert('File does not exists');", true);
             }
         }
         catch (Exception ex)
         {
             LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
             Response.RedirectPermanent("~/ErrorPage.aspx", false);
             //string strError = ex.Message;
             //vmError.Message = strError;
             //FlashMessage.ErrorMessage(vmError.Message);
             //return;
         }
     }
 }
예제 #6
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            try
            {
                string reginalOfficerDiaryNo = string.Empty;
                if (ApoTitle.InnerText != "" && txtComments.Text != "")
                {
                    DataSet dsRODiaryNum = APOBAL.Instance.GetRegionalOfficerDiaryNumber(Convert.ToInt32(Session["APOFileId"]));
                    if (dsRODiaryNum.Tables[0].Rows.Count > 0)
                    {
                        DataRow dr = dsRODiaryNum.Tables[0].Rows[0];
                        if (dr[0] != DBNull.Value)
                        {
                            if (!string.IsNullOrEmpty(dr[0].ToString()))
                            {
                                reginalOfficerDiaryNo = dr["RegionalOfficerDiaryNumner"].ToString();
                                APOBAL.Instance.UpdateStatus(Convert.ToInt32(Session["APOFileId"]), 11, true, txtComments.Text, reginalOfficerDiaryNo, null);
                                string strSuccess = "APO status has been updated successfully.";
                                vmSuccess.Message = strSuccess;
                                FlashMessage.InfoMessage(vmSuccess.Message);
                                Session["apoFileId"] = null;
                            }
                            else
                            {
                                string strError = "Regional Officer has not taken any action against this APO, please alert him / her.";
                                vmError.Message = strError;
                                FlashMessage.ErrorMessage(vmError.Message);
                                return;
                            }
                        }
                        else
                        {
                            string strError = "Regional Officer has not taken any action against this APO, please alert him / her.";
                            vmError.Message = strError;
                            FlashMessage.ErrorMessage(vmError.Message);
                            return;
                        }
                    }
                }

                else
                {
                    string strError = "Please provide remarks / comments before taking action.";
                    vmError.Message = strError;
                    FlashMessage.ErrorMessage(vmError.Message);
                    return;
                }
            }
            catch (Exception ex)
            {
                LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
                Response.RedirectPermanent("~/ErrorPage.aspx", false);
                //string strError = ex.Message;
                //vmError.Message = strError;
                //FlashMessage.ErrorMessage(vmError.Message);
                //return;
            }
        }
예제 #7
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         State state = new State();
         if (Session["StateId"] != null)
         {
             StateId = Convert.ToInt32(Session["StateId"]);
         }
         if (StateId != 0)
         {
             state.StateName = txtState.Text;
             if (chkIsNorthEastState.Checked)
             {
                 state.IsNorthEastState = true;
             }
             else
             {
                 state.IsNorthEastState = false;
             }
             StateBAL.Instance.UpdateState(state, StateId);
             UserBAL.Instance.InsertAuditTrailDetail("Updated State Information", "Manage State");
             Session["StateId"] = null;
             vmSuccess.Message  = ConfigurationManager.AppSettings["UpdateSuccessMes"].ToString();;
             FlashMessage.InfoMessage(vmSuccess.Message);
             //Response.Redirect("StateMaster.aspx", false);
         }
         else
         {
             state.StateName = txtState.Text;
             if (chkIsNorthEastState.Checked)
             {
                 state.IsNorthEastState = true;
             }
             else
             {
                 state.IsNorthEastState = false;
             }
             StateBAL.Instance.AddState(state);
             UserBAL.Instance.InsertAuditTrailDetail("Created New State", "Manage State");
             vmSuccess.Message = ConfigurationManager.AppSettings["SaveSuccessMes"].ToString();
             FlashMessage.InfoMessage(vmSuccess.Message);
             txtState.Text = string.Empty;
         }
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
     }
 }
예제 #8
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         ObligationBAL.Instance.UpdateFieldDirectorObligations(obligation.TigerReserveId);
         string strSuccess = "Obligation has been Submitted successfully.";
         vmSuccess.Message = strSuccess;
         FlashMessage.InfoMessage(vmSuccess.Message);
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
     }
 }
예제 #9
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         SubmitObligation(cgvObligationFD);
         string strSuccess = "Data has been saved successfully.";
         vmSuccess.Message = strSuccess;
         FlashMessage.InfoMessage(vmSuccess.Message);
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
     }
 }
예제 #10
0
 private void AddNewTigerReserve(TigerReserve tigerReserve)
 {
     try
     {
         Session.Remove("TigerReserveId");
         tigerReserve.State            = ddlState.SelectedValue;
         tigerReserve.District         = txtDistrict.Text;
         tigerReserve.City             = txtCity.Text;
         tigerReserve.TigerReserveName = txtTigerReserve.Text;
         if (txtCoreArea.Text != "")
         {
             tigerReserve.CoreArea = txtCoreArea.Text;
         }
         else
         {
             tigerReserve.CoreArea = "0.0";
         }
         if (txtBufferArea.Text != "")
         {
             tigerReserve.BufferArea = txtBufferArea.Text;
         }
         else
         {
             tigerReserve.BufferArea = "0.0";
         }
         txtTotalArea.Text                 = Convert.ToString(Convert.ToDouble(tigerReserve.CoreArea) + Convert.ToDouble(tigerReserve.BufferArea));
         tigerReserve.TotalArea            = txtTotalArea.Text;
         tigerReserve.DateOfRegistration   = Convert.ToDateTime(txtDOR.Text.ToString());
         tigerReserve.Address              = txtAddress.Text;
         tigerReserve.PinCode              = txtPinCode.Text;
         tigerReserve.FeildDirector        = txtFieldDirector.Text;
         tigerReserve.PhoneNumber          = txtPhoneNumber.Text;
         tigerReserve.AlternatePhoneNumber = txtAlternatePhoneNumber.Text;
         tigerReserve.MobileNumber         = txtMobileNumber.Text;
         tigerReserve.Email                = txtEmail.Text;
         TigerReserveBAL.Instance.AddTigerReserve(tigerReserve);
         vmSuccess.Message = ConfigurationManager.AppSettings["SaveSuccessMes"].ToString();
         FlashMessage.InfoMessage(vmSuccess.Message);
         Clear();
         //Response.Redirect("TigerReserve.aspx", false);
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
     }
 }
예제 #11
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (GridViewRow row in cgvFDCheckList.Rows)
         {
             RequiredFieldValidator rfv = (RequiredFieldValidator)row.FindControl("RequiredFieldValidator1");
             rfv.Enabled = true;
         }
         if (!IsFinalUcOrProvisionalUcExist(Convert.ToInt32(Session["APOFileId"])))
         {
             string strError = ConfigurationManager.AppSettings["UploadProvisionalUc"];
             vmError.Message = strError;
             return;
         }
         if (!CheckApoStatusBeforeAnyAction())
         {
             return;
         }
         if (cgvFDCheckList.Rows.Count > 0)
         {
             SubmitCheckList(cgvFDCheckList);
             string strSuccess = "Checklist saved successfully.";
             vmSuccess.Message = strSuccess;
             FlashMessage.InfoMessage(vmSuccess.Message);
             UserBAL.Instance.InsertAuditTrailDetail("Saved Checklist", "APO");
             LoadCheckListDraftData(cgvFDCheckList);
         }
         else
         {
             string strError = ConfigurationManager.AppSettings["EmptyChecklist"];
             vmError.Message = strError;
             FlashMessage.ErrorMessage(vmError.Message);
             return;
         }
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
         //return;
     }
 }
예제 #12
0
 protected void btnSend_Click(object sender, EventArgs e)
 {
     try
     {
         SendAlerts();
         string strSuccess = "Alert has been sent successfully.";
         vmSuccess.Message = strSuccess;
         FlashMessage.InfoMessage(vmSuccess.Message);
         Clear();
         UserBAL.Instance.InsertAuditTrailDetail("Sent an Alert", "Alerts");
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
     }
 }
예제 #13
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         UpdateTigerReserveDetails();
         UserBAL.Instance.InsertAuditTrailDetail("Updated Tiger Reserve Details", "Tiger Reserve Detail");
         string strSuccess = "Data has been updated successfully.";
         vmSuccess.Message = strSuccess;
         FlashMessage.InfoMessage(vmSuccess.Message);
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
         //return;
     }
 }
예제 #14
0
 protected void btnAddActivityItem_Click(object sender, EventArgs e)
 {
     try
     {
         int      val;
         Activity oActivity = new Activity();
         oActivity.AreaId                = Convert.ToInt32(ddlAreaForActivityItem.SelectedValue);
         oActivity.ActivityTypeId        = Convert.ToInt32(ddlActivityTypeForActivityItem.SelectedValue);
         oActivity.ActivityId            = Convert.ToInt32(ddlActivityForActivityItem.SelectedValue);
         oActivity.ActivityItemName      = txtActivityItem.Text;
         oActivity.ParaNoCSSPTGuidelines = txtCSSPTParaNo.Text;
         if (chkGPS.Checked == true)
         {
             val = 1;
         }
         else
         {
             val = 0;
         }
         oActivity.GpsStatus = Convert.ToString(val);
         ManageActivityBAL.Instance.AddActivityItem(oActivity);
         string strSuccess = "Data saved successfully.";
         vmSuccess.Message = strSuccess;
         FlashMessage.InfoMessage(vmSuccess.Message);
         GetManageActivityData();
         GetSearchData();
         ClearActivityItem();
         UserBAL.Instance.InsertAuditTrailDetail("Created Activity Item", "Manage Activites");
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         //Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
         //return;
     }
 }
예제 #15
0
 protected void cgvActivityItems_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     try
     {
         DropDownList ddlArea         = cgvActivityItems.Rows[e.RowIndex].FindControl("ddlArea") as DropDownList;
         int          _areaId         = Convert.ToInt32(ddlArea.SelectedValue);
         DropDownList ddlActivityType = cgvActivityItems.Rows[e.RowIndex].FindControl("ddlActivityType") as DropDownList;
         int          _activityTypeId = Convert.ToInt32(ddlActivityType.SelectedValue);
         DropDownList ddlActivity     = cgvActivityItems.Rows[e.RowIndex].FindControl("ddlActivity") as DropDownList;
         int          _activityId     = Convert.ToInt32(ddlActivity.SelectedValue);
         Label        activityItemid  = cgvActivityItems.Rows[e.RowIndex].FindControl("lblActivityItemId") as Label;
         TextBox      lblCSSPTParaNo  = cgvActivityItems.Rows[e.RowIndex].FindControl("txtCSSPTParaNo") as TextBox;
         string       strCSSPTParaNo  = lblCSSPTParaNo.Text;
         int          activityItemId  = Convert.ToInt32(activityItemid.Text);
         TextBox      activityItem    = cgvActivityItems.Rows[e.RowIndex].FindControl("txtActivityItem") as TextBox;
         string       strActivityItem = activityItem.Text;
         CheckBox     Gps             = cgvActivityItems.Rows[e.RowIndex].FindControl("chkGPSActive") as CheckBox;
         string       gpsRequired     = Convert.ToString(Gps.Checked);
         ManageActivityBAL.Instance.UpdateActivityItem(_areaId, _activityTypeId, _activityId, strCSSPTParaNo, activityItemId, strActivityItem, gpsRequired);
         UserBAL.Instance.InsertAuditTrailDetail("Updated Activity Item", "Manage Activites");
         cgvActivityItems.EditIndex = -1;
         GetManageActivityData();
         GetSearchData();
         //AddMoreDiv.Visible = true;
         string strSuccess = "Activity item has been updated successfully.";
         vmSuccess.Message = strSuccess;
         FlashMessage.InfoMessage(vmSuccess.Message);
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
         //return;
     }
 }
예제 #16
0
 protected void btnApprove_Click(object sender, EventArgs e)
 {
     try
     {
         string reginalOfficerDiaryNo = string.Empty;
         if (Session["APOFileId"] != null && ApoTitle.InnerText != "" && txtComments.Text != "")
         {
             DataSet dsRODiaryNum = APOBAL.Instance.GetRegionalOfficerDiaryNumber(Convert.ToInt32(Session["APOFileId"]));
             if (dsRODiaryNum.Tables[0].Rows.Count > 0)
             {
                 DataRow dr = dsRODiaryNum.Tables[0].Rows[0];
                 reginalOfficerDiaryNo = Convert.ToString(dr["RegionalOfficerDiaryNumner"]);
                 if (string.IsNullOrEmpty(reginalOfficerDiaryNo) || dr[0] == DBNull.Value)
                 {
                     int apoFileId = Convert.ToInt32(Session["APOFileId"]);
                     APOBAL.Instance.UpdateStatus(apoFileId, 13, false, txtComments.Text, null, null);
                     string strSuccess = "APO status has been approved successfully.";
                     UserBAL.Instance.InsertAuditTrailDetail("Apo Forwarded to Reginal Officer", "Approve - Reject");
                     vmSuccess.Message = strSuccess;
                     FlashMessage.InfoMessage(vmSuccess.Message);
                     Session["apoFileId"] = null;
                 }
                 else
                 {
                     string strError = "You can not approve this APO, since it has been approved by higher authority.";
                     vmError.Message = strError;
                     FlashMessage.ErrorMessage(vmError.Message);
                     return;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
     }
 }
예제 #17
0
 protected void btnAddActivity_Click(object sender, EventArgs e)
 {
     try
     {
         string activityName = txtActivity1.Text;
         ManageActivityBAL.Instance.AddActivity(activityName);
         string strSuccess = "Data saved successfully.";
         vmSuccess.Message = strSuccess;
         FlashMessage.InfoMessage(vmSuccess.Message);
         txtActivity1.Text = string.Empty;
         GetManageActivityData();
         UserBAL.Instance.InsertAuditTrailDetail("Created Activity", "Manage Activites");
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
         //return;
     }
 }
예제 #18
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                string reginalOfficerDiaryNo = string.Empty;
                if (Session["apoFileId"] != null && ddlName.SelectedValue != "0" && txtComments.Text != "")
                {
                    if (ddlName.SelectedValue == "13")
                    {
                        if (!IsCWLWObligationsSubmitted(Convert.ToInt32(Session["apoFileId"])))
                        {
                            return;
                        }
                    }
                    APOBAL.Instance.UpdateDiaryNumber(Convert.ToInt32(Session["APOFileId"]));
                    DataSet dsRODiaryNum = APOBAL.Instance.GetRegionalOfficerDiaryNumber(Convert.ToInt32(Session["APOFileId"]));
                    if (dsRODiaryNum.Tables[0].Rows.Count > 0)
                    {
                        DataRow dr = dsRODiaryNum.Tables[0].Rows[0];
                        reginalOfficerDiaryNo = Convert.ToString(dr["RegionalOfficerDiaryNumner"]);
                        if (!string.IsNullOrEmpty(reginalOfficerDiaryNo))
                        {
                            APOBAL.Instance.UpdateStatus(Convert.ToInt32(Session["apoFileId"]), Convert.ToInt32(ddlName.SelectedValue), false, txtComments.Text, reginalOfficerDiaryNo, null);

                            UserBAL.Instance.InsertAuditTrailDetail("Updated APO Status", "Update APO Status");
                            if (ddlName.SelectedValue == "13")
                            {
                                string strSuccess = ConfigurationManager.AppSettings["ForwardToRegionalOfficer"];
                                vmSuccess.Message = strSuccess;
                                FlashMessage.InfoMessage(vmSuccess.Message);
                                Session["apoFileId"] = null;
                                Clear();
                            }
                            else if (ddlName.SelectedValue == "8")
                            {
                                string strSuccess = ConfigurationManager.AppSettings["ApoRejected"];
                                vmSuccess.Message = strSuccess;
                                FlashMessage.InfoMessage(vmSuccess.Message);
                                Session["apoFileId"] = null;
                                Clear();
                            }
                            else if (ddlName.SelectedValue == "3")
                            {
                                string strSuccess = ConfigurationManager.AppSettings["ModifyResubmit"];
                                vmSuccess.Message = strSuccess;
                                FlashMessage.InfoMessage(vmSuccess.Message);
                                Session["apoFileId"] = null;
                                Clear();
                            }
                        }
                        else
                        {
                            string strError = ConfigurationManager.AppSettings["ActionTakenByHigherAuthortity"];
                            vmError.Message = strError;
                            FlashMessage.ErrorMessage(vmError.Message);
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
                Response.RedirectPermanent("~/ErrorPage.aspx", false);
            }
        }
예제 #19
0
 //protected void rblSpilloverAdjustment_SelectedIndexChanged(object sender, EventArgs e)
 //{
 //    RadioButtonList rblName = sender as RadioButtonList;
 //    GridViewRow parentRow = rblName.NamingContainer as GridViewRow;
 //    string strName = rblName.Text;
 //    //Mutually exclusive RadioButtons
 //    foreach (GridViewRow row in cgvUnspent.Rows)
 //    {
 //        RadioButtonList rblRevalidateAdjustment = row.FindControl("rblRevalidateAdjustment") as RadioButtonList;
 //        RadioButtonList rblSpilloverAdjustment = row.FindControl("rblSpilloverAdjustment") as RadioButtonList;
 //        TextBox txtJustification = (TextBox)row.FindControl("txtJustification");
 //        if (rblSpilloverAdjustment.SelectedValue == "1" || rblSpilloverAdjustment.SelectedValue == "2")
 //        {
 //            txtJustification.Enabled = false;
 //            txtJustification.Text = string.Empty;
 //            rblRevalidateAdjustment.Visible = false;
 //        }
 //    }
 //}
 private void InsertGridviewToDatabase(GridView gv)
 {
     try
     {
         foreach (GridViewRow row in gv.Rows)
         {
             Label      lblAreaId         = (Label)row.FindControl("lblAreaId");
             Label      lblActivityTypeId = (Label)row.FindControl("lblActivityTypeId");
             Label      lblActivityId     = (Label)row.FindControl("lblActivityId");
             Label      lblActivityItemId = (Label)row.FindControl("lblActivityItemId");
             LinkButton lbCssPT           = (LinkButton)row.FindControl("ParaNoCSSPTGuidelines");
             TextBox    txtParaNo         = (TextBox)row.FindControl("txtParaNo");
             TextBox    txtNumberOfItem   = (TextBox)row.FindControl("txtNumberOfItem");
             TextBox    txtSpcification   = (TextBox)row.FindControl("txtSpcification");
             TextBox    txtUnitPrice      = (TextBox)row.FindControl("txtUnitPrice");
             TextBox    txtTotal          = (TextBox)row.FindControl("txtTotal");
             Label      lblReleasedAmount = (Label)row.FindControl("lblReleasedAmount");
             //if (!string.IsNullOrEmpty(txtNumberOfItem.Text) && !string.IsNullOrEmpty(txtUnitPrice.Text))
             //{
             //    double total = Convert.ToDouble(txtNumberOfItem.Text) * Convert.ToDouble(txtUnitPrice.Text);
             //    txtTotal.Text = Convert.ToString(total);
             //    txtTotal.Enabled = false;
             //}
             TextBox txtGPS           = (TextBox)row.FindControl("txtGPS");
             TextBox txtJustification = (TextBox)row.FindControl("txtJustification");
             //FileUpload fuUploadDocument = (FileUpload)row.FindControl("fuUploadDocument");
             //Label lblFileName = (Label)row.FindControl("lblFileName");
             Label           lblUnspentAmount        = (Label)row.FindControl("lblUnspentAmount");
             RadioButtonList rblRevalidateAdjustment = row.FindControl("rblRevalidateAdjustment") as RadioButtonList;
             RadioButtonList rblSpilloverAdjustment  = row.FindControl("rblSpilloverAdjustment") as RadioButtonList;
             if (!string.IsNullOrEmpty(lblAreaId.Text))
             {
                 oApo.AreaId = Convert.ToInt32(lblAreaId.Text);
             }
             if (!string.IsNullOrEmpty(lblActivityTypeId.Text))
             {
                 oApo.ActivityTypeId = Convert.ToInt32(lblActivityTypeId.Text);
             }
             if (!string.IsNullOrEmpty(lblActivityId.Text))
             {
                 oApo.ActivityId = Convert.ToInt32(lblActivityId.Text);
             }
             if (!string.IsNullOrEmpty(lblActivityItemId.Text))
             {
                 oApo.ActivityItemId = Convert.ToInt32(lblActivityItemId.Text);
             }
             if (!string.IsNullOrEmpty(lblUnspentAmount.Text))
             {
                 oApo.Unspent = Convert.ToDouble(lblUnspentAmount.Text);
             }
             else
             {
                 if (!string.IsNullOrEmpty(lblReleasedAmount.Text))
                 {
                     oApo.Unspent = Convert.ToDouble(lblReleasedAmount.Text);
                 }
             }
             if (oApo.Unspent > 0)
             {
                 oApo.IsSettledUnspent = true;
                 if (rblRevalidateAdjustment.SelectedValue == "1")
                 {
                     oApo.IsReValidate  = true;
                     oApo.Justification = txtJustification.Text;
                 }
                 else
                 {
                     oApo.IsReValidate = false;
                 }
                 //if (rblSpilloverAdjustment.SelectedValue == "1")
                 //{
                 //    oApo.IsSpillOverAdjustment = true;
                 //    oApo.Justification = txtJustification.Text;
                 //}
                 //else
                 //{
                 //    oApo.IsSpillOverAdjustment = false;
                 //}
                 SettledUcBAL.Instance.SettledPFYUnspentAmount(oApo);
                 string strSuccess = "Unspent amount has been settled successfully.";
                 vmSuccess.Message = strSuccess;
                 FlashMessage.InfoMessage(vmSuccess.Message);
                 //}
             }
         }
     }
     catch (Exception ex)
     {
         LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
         Response.RedirectPermanent("~/ErrorPage.aspx", false);
         //string strError = ex.Message;
         //vmError.Message = strError;
         //FlashMessage.ErrorMessage(vmError.Message);
         //return;
     }
 }
예제 #20
0
        protected void btnUploadProvisionalUc_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (GridViewRow row in cgvFDCheckList.Rows)
                {
                    RequiredFieldValidator rfv = (RequiredFieldValidator)row.FindControl("RequiredFieldValidator1");
                    rfv.Enabled = false;
                }
                if (fuUploadProvisionalUC.HasFile)
                {
                    string fileName       = Path.GetFileName(fuUploadProvisionalUC.PostedFile.FileName);
                    int    extensionCount = 0;

                    string[] splitFile = fileName.Split('.');
                    foreach (string ext in splitFile)
                    {
                        if (ext.ToLower() == "jpg" || ext.ToLower() == "png" || ext.ToLower() == "gif" || ext.ToLower() == "sql" || ext.ToLower() == "psd" ||
                            ext.ToLower() == "pdf" || ext.ToLower() == "txt" || ext.ToLower() == "rtf" || ext.ToLower() == "doc" || ext.ToLower() == "docx" ||
                            ext.ToLower() == "xls" || ext.ToLower() == "xlsx" || ext.ToLower() == "html" || ext.ToLower() == "htm" || ext.ToLower() == ".jpeg" ||
                            ext.ToLower() == "exe")
                        {
                            extensionCount++;
                        }
                    }
                    if (extensionCount <= 1)
                    {
                        fuUploadProvisionalUC.PostedFile.SaveAs(Server.MapPath("~/Upload/UC/Provisional/") + fileName);
                        uCertificate.ProvisionalUC = fuUploadProvisionalUC.FileName;

                        Stream       fs    = fuUploadProvisionalUC.PostedFile.InputStream;
                        BinaryReader br    = new BinaryReader(fs);
                        Byte[]       bytes = br.ReadBytes((Int32)fs.Length);

                        if (bytes[0] == 37 && bytes[1] == 80)
                        {
                            fs.Close();
                            br.Close();
                            fs.Dispose();
                            br.Dispose();
                            fuUploadProvisionalUC.PostedFile.InputStream.Close();
                            bytes = null;

                            if (Session["APOFileId"] != null && !string.IsNullOrEmpty(uCertificate.ProvisionalUC))
                            {
                                int apoFileId = Convert.ToInt32(Session["APOFileId"]);
                                CheckListBAL.Instance.UploadProvisionalUC(apoFileId, uCertificate.ProvisionalUC);
                                string strSuccess = ConfigurationManager.AppSettings["ProvisionalUc"];
                                vmSuccess.Message = strSuccess;
                                FlashMessage.InfoMessage(vmSuccess.Message);
                                lbtnFileName.Text = uCertificate.ProvisionalUC;
                            }
                        }
                        else
                        {
                            string strError = "Only PDF Files are allowed";
                            uCertificate.ProvisionalUC = string.Empty;
                            vmError.Message            = strError;
                            FlashMessage.ErrorMessage(vmError.Message);
                            File.Delete(Server.MapPath("~/Upload/UC/Provisional/") + fileName);
                            return;
                        }
                    }
                    else
                    {
                        string strSuccess = "Invalid File";
                        vmSuccess.Message = strSuccess;
                        FlashMessage.InfoMessage(vmSuccess.Message);
                        lbtnFileName.Text = uCertificate.ProvisionalUC;
                    }
                }
                else if (!string.IsNullOrEmpty(lblFileName.Text))
                {
                    uCertificate.ProvisionalUC = lblFileName.Text;
                }
            }
            catch (Exception ex)
            {
                LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
                Response.RedirectPermanent("~/ErrorPage.aspx", false);
            }
        }
예제 #21
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (GridViewRow row in cgvFDCheckList.Rows)
                {
                    RequiredFieldValidator rfv = (RequiredFieldValidator)row.FindControl("RequiredFieldValidator1");
                    rfv.Enabled = false;
                }
                if (!IsFinalUcOrProvisionalUcExist(Convert.ToInt32(Session["APOFileId"])))
                {
                    string strError = ConfigurationManager.AppSettings["UploadProvisionalUc"];
                    vmError.Message = strError;
                    return;
                }

                if (!CheckApoStatusBeforeAnyAction())
                {
                    return;
                }

                if (Convert.ToBoolean(Session["ChecklistSaved"]) != true)
                {
                    string strError = ConfigurationManager.AppSettings["ChecklistNotSaved"];
                    vmError.Message = strError;
                    return;
                }
                //bool IsHasPermission = false;
                //if (Session["APOFileId"] != null)
                //{
                //    DataSet dsIsAllow = CheckListBAL.Instance.IsAllowedAfterDueDate(Convert.ToInt32(Session["APOFileId"]));
                //    if (dsIsAllow != null)
                //    {
                //        Session["dsGetAPOFileId"] = null;
                //        DataRow dr = dsIsAllow.Tables[0].Rows[0];
                //        if (dr[0] != DBNull.Value)
                //        {
                //            IsHasPermission = Convert.ToBoolean(dr["IsAllowAfterDueDate"]);
                //        }
                //    }
                //}
                //bool IsAllow = CheckListBAL.Instance.IsAllowApoSubmission();
                //if (!IsHasPermission == true)
                //{

                //    if (!IsAllow == true)
                //    {
                //        string strError = ConfigurationManager.AppSettings["ApoDueDateOver"];
                //        string allertMes = ConfigurationManager.AppSettings["ApoDueDateOverAlert"];
                //        SendAlerts(allertMes);
                //        vmError.Message = strError;
                //        return;
                //    }
                //}

                //int id = Convert.ToInt32(Session["TigerReserverId"]);
                //if (!IsUnspentAmountSettled(id))
                //{
                //    string strError = "Please first settled your previous year unspent amount.";
                //    vmError.Message = strError;
                //    FlashMessage.ErrorMessage(vmError.Message);
                //    return;
                //}
                if (Session["TigerReserverId"] != null)
                {
                    TigerReserverId = Convert.ToInt32(Session["TigerReserverId"]);
                }
                int     apoFileId = 0;
                DataSet dsApoId   = APOBAL.Instance.GetCurrentYearAPOFileId(TigerReserverId);
                if (dsApoId.Tables[0].Rows.Count == 1)
                {
                    apoFileId = Convert.ToInt32(dsApoId.Tables[0].Rows[0]["APOFileId"]);
                    DataSet dsCheckObligation = CheckListBAL.Instance.IsObligationUnSpentAmountSettled(apoFileId);
                    if (dsCheckObligation != null)
                    {
                        bool    IsFDObligations = false;
                        bool    IsUnspentAmount = false;
                        DataRow dr = dsCheckObligation.Tables[0].Rows[0];
                        if (dr[0] != DBNull.Value)
                        {
                            if (!string.IsNullOrEmpty(dr["IsFDObligationSubmitted"].ToString()))
                            {
                                IsFDObligations = Convert.ToBoolean(dr["IsFDObligationSubmitted"]);
                            }
                        }
                        if (!string.IsNullOrEmpty(dr["IsUnspentAmountSettled"].ToString()))
                        {
                            IsUnspentAmount = Convert.ToBoolean(dr["IsUnspentAmountSettled"]);
                        }
                        if (IsFDObligations != true)
                        {
                            string strInfo = ConfigurationManager.AppSettings["CheckFDObligations"];
                            vmError.Message = strInfo;
                            FlashMessage.InfoMessage(vmError.Message);
                            return;
                        }
                        //if (IsUnspentAmount != true)
                        //{
                        //    if (_apoCount == 1)
                        //    {
                        //        CheckListBAL.Instance.ForwardAPOToCWW(apoFileId, 10);
                        //        string strSuccess = "APO  forwarded to cheief wildlife warden / secretary forest successfully.";
                        //        vmSuccess.Message = strSuccess;
                        //        FlashMessage.InfoMessage(vmSuccess.Message);
                        //        IsUnspentAmount = true;
                        //        return;
                        //    }
                        //    else
                        //    {
                        //        string strInfo = "Please settled unspent amount, before submiting APO to CWLW / SF.";
                        //        vmError.Message = strInfo;
                        //        FlashMessage.InfoMessage(vmError.Message);
                        //    }
                        //}
                        else
                        {
                            CheckListBAL.Instance.ForwardAPOToCWW(apoFileId, 10);
                            string strSuccess = ConfigurationManager.AppSettings["ForwardToCWLW"];
                            vmSuccess.Message = strSuccess;
                            FlashMessage.InfoMessage(vmSuccess.Message);
                            return;
                        }
                    }
                }
                bool IsHasPermission = false;
                if (Session["APOFileId"] != null)
                {
                    DataSet dsIsAllow = CheckListBAL.Instance.IsAllowedAfterDueDate(Convert.ToInt32(Session["APOFileId"]));
                    if (dsIsAllow != null)
                    {
                        Session["dsGetAPOFileId"] = null;
                        DataRow dr = dsIsAllow.Tables[0].Rows[0];
                        if (dr[0] != DBNull.Value)
                        {
                            IsHasPermission = Convert.ToBoolean(dr["IsAllowAfterDueDate"]);
                        }
                    }
                }
                bool IsAllow = CheckListBAL.Instance.IsAllowApoSubmission();
                if (!IsHasPermission == true)
                {
                    if (!IsAllow == true)
                    {
                        string strError  = ConfigurationManager.AppSettings["ApoDueDateOver"];
                        string allertMes = ConfigurationManager.AppSettings["ApoDueDateOverAlert"];
                        SendAlerts(allertMes);
                        vmError.Message = strError;
                        return;
                    }
                    else
                    {
                        string message = ConfigurationManager.AppSettings["ApoSubmittedByFD"];
                        SendAlertsOnSuccess(message);
                    }
                }
                else
                {
                    string strError = "There is not any data to submit.";
                    vmError.Message = strError;
                    FlashMessage.ErrorMessage(vmError.Message);
                    return;
                }
            }
            catch (Exception ex)
            {
                LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
                Response.RedirectPermanent("~/ErrorPage.aspx", false);
                //string strError = ex.Message;
                //vmError.Message = strError;
                //FlashMessage.ErrorMessage(vmError.Message);
                //return;
            }
        }
        protected void btnUploadFinalUc_Click(object sender, EventArgs e)
        {
            try
            {
                if (fuUploadFinalUC.HasFile)
                {
                    DataSet ds = UtilizationCertificateBAL.Instance.GetUploadedFileName(Convert.ToInt32(Session["APOFileId"]));
                    if (ds != null)
                    {
                        DataRow dr = ds.Tables[0].Rows[0];

                        //string ExistFile = ds.ToString();
                        //int apoFileId = Convert.ToInt32(Session["APOFileId"]);
                        string fileName       = Path.GetFileName(fuUploadFinalUC.PostedFile.FileName);
                        int    extensionCount = 0;

                        string[] splitFile = fileName.Split('.');
                        //foreach (string ext in splitFile)
                        //{
                        //    if (ext.ToLower() == "jpg" || ext.ToLower() == "png" || ext.ToLower() == "gif" || ext.ToLower() == "sql" || ext.ToLower() == "psd" ||
                        //    ext.ToLower() == "pdf" || ext.ToLower() == "txt" || ext.ToLower() == "rtf" || ext.ToLower() == "doc" || ext.ToLower() == "docx" ||
                        //    ext.ToLower() == "xls" || ext.ToLower() == "xlsx" || ext.ToLower() == "html" || ext.ToLower() == "htm" || ext.ToLower() == ".jpeg" ||
                        //    ext.ToLower() == "exe")
                        //    {
                        //        extensionCount++;
                        //    }
                        //}
                        foreach (string ext in splitFile)
                        {
                            if (FileExtensionList.Contains(ext.ToLower()))
                            {
                                extensionCount++;
                            }
                        }
                        if (extensionCount <= 1)
                        {
                            if (dr[0].ToString() == fileName)
                            {
                                fuUploadFinalUC.PostedFile.SaveAs(Server.MapPath("~/Upload/UC/Final/") + fileName);
                                uCertificate.FinalnalUC = fuUploadFinalUC.FileName;

                                Stream       fs    = fuUploadFinalUC.PostedFile.InputStream;
                                BinaryReader br    = new BinaryReader(fs);
                                Byte[]       bytes = br.ReadBytes((Int32)fs.Length);

                                if (bytes[0] == 37 && bytes[1] == 80)
                                {
                                    fs.Close();
                                    br.Close();
                                    fs.Dispose();
                                    br.Dispose();
                                    fuUploadFinalUC.PostedFile.InputStream.Close();
                                    bytes = null;

                                    if (Session["APOFileId"] != null && !string.IsNullOrEmpty(uCertificate.FinalnalUC))
                                    {
                                        int apoFileId = Convert.ToInt32(Session["APOFileId"]);
                                        UtilizationCertificateBAL.Instance.UploadFinalUC(apoFileId, uCertificate.FinalnalUC);
                                        string strSuccess = ConfigurationManager.AppSettings["FinalUc"];
                                        vmSuccess.Message = strSuccess;
                                        FlashMessage.InfoMessage(vmSuccess.Message);
                                        lbtnFileName.Text = uCertificate.FinalnalUC;
                                    }
                                }
                                else
                                {
                                    string strError = "Only PDF Files are allowed";
                                    uCertificate.FinalnalUC = string.Empty;
                                    vmError.Message         = strError;
                                    FlashMessage.ErrorMessage(vmError.Message);
                                    File.Delete(Server.MapPath("~/Upload/UC/Final/") + fileName);
                                    return;
                                }
                            }
                            else
                            {
                                if (dr[0].ToString().Length > 0)
                                {
                                    var path = Path.Combine(Server.MapPath("~/Upload/UC/Final/") + dr[0]);
                                    System.IO.File.Delete(path);
                                }
                                fuUploadFinalUC.PostedFile.SaveAs(Server.MapPath("~/Upload/UC/Final/") + fileName);
                                uCertificate.FinalnalUC = fuUploadFinalUC.FileName;

                                Stream       fs    = fuUploadFinalUC.PostedFile.InputStream;
                                BinaryReader br    = new BinaryReader(fs);
                                Byte[]       bytes = br.ReadBytes((Int32)fs.Length);

                                if (bytes[0] == 37 && bytes[1] == 80)
                                {
                                    fs.Close();
                                    br.Close();
                                    fs.Dispose();
                                    br.Dispose();
                                    fuUploadFinalUC.PostedFile.InputStream.Close();
                                    bytes = null;

                                    if (Session["APOFileId"] != null && !string.IsNullOrEmpty(uCertificate.FinalnalUC))
                                    {
                                        int apoFileId = Convert.ToInt32(Session["APOFileId"]);
                                        UtilizationCertificateBAL.Instance.UploadFinalUC(apoFileId, uCertificate.FinalnalUC);
                                        string strSuccess = ConfigurationManager.AppSettings["FinalUc"];
                                        vmSuccess.Message = strSuccess;
                                        FlashMessage.InfoMessage(vmSuccess.Message);
                                        lbtnFileName.Text = uCertificate.FinalnalUC;
                                    }
                                }
                                else
                                {
                                    string strError = "Only PDF Files are allowed";
                                    uCertificate.FinalnalUC = string.Empty;
                                    vmError.Message         = strError;
                                    FlashMessage.ErrorMessage(vmError.Message);
                                    File.Delete(Server.MapPath("~/Upload/UC/Final/") + fileName);
                                    return;
                                }
                            }
                        }
                        else
                        {
                            string strerror = "Invalid File";
                            vmError.Message = strerror;
                            FlashMessage.InfoMessage(vmError.Message);
                        }
                    }
                }
                else if (!string.IsNullOrEmpty(lblFileName.Text))
                {
                    uCertificate.FinalnalUC = lblFileName.Text;
                }
            }
            catch (Exception ex)
            {
                LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
                Response.RedirectPermanent("~/ErrorPage.aspx", false);
            }
        }
예제 #23
0
        private void InsertGridviewToDatabase(GridView gv)
        {
            try
            {
                foreach (GridViewRow row in gv.Rows)
                {
                    Label      lblActivityId     = (Label)row.FindControl("lblActivityId");
                    Label      lblActivityItemId = (Label)row.FindControl("lblActivityItemId");
                    LinkButton lbCssPT           = (LinkButton)row.FindControl("ParaNoCSSPTGuidelines");
                    TextBox    txtParaNo         = (TextBox)row.FindControl("txtParaNo");
                    TextBox    txtNumberOfItem   = (TextBox)row.FindControl("txtNumberOfItem");
                    TextBox    txtSpcification   = (TextBox)row.FindControl("txtSpcification");
                    TextBox    txtUnitPrice      = (TextBox)row.FindControl("txtUnitPrice");
                    TextBox    txtTotal          = (TextBox)row.FindControl("txtTotal");
                    if (!string.IsNullOrEmpty(txtNumberOfItem.Text) && !string.IsNullOrEmpty(txtUnitPrice.Text))
                    {
                        double total = Convert.ToDouble(txtNumberOfItem.Text) * Convert.ToDouble(txtUnitPrice.Text);
                        txtTotal.Text    = Convert.ToString(total);
                        txtTotal.Enabled = false;
                    }
                    TextBox    txtGPS           = (TextBox)row.FindControl("txtGPS");
                    TextBox    txtJustification = (TextBox)row.FindControl("txtJustification");
                    FileUpload fuUploadDocument = (FileUpload)row.FindControl("fuUploadDocument");

                    oApo.ActivityId     = Convert.ToInt32(lblActivityId.Text);
                    oApo.ActivityItemId = Convert.ToInt32(lblActivityItemId.Text);
                    oApo.ParaNoTCP      = txtParaNo.Text;
                    if (!string.IsNullOrEmpty(txtNumberOfItem.Text) && !string.IsNullOrEmpty(txtUnitPrice.Text))
                    {
                        oApo.NumberOfItems = Convert.ToDouble(txtNumberOfItem.Text);
                        oApo.UnitPrice     = Convert.ToDouble(txtUnitPrice.Text);
                        oApo.Total         = Convert.ToDouble(txtTotal.Text);
                        oApo.IsFilled      = true;
                        oApo.Specification = txtSpcification.Text;
                        if (!string.IsNullOrEmpty(txtNumberOfItem.Text))
                        {
                            oApo.GPS = txtGPS.Text;
                        }
                        else
                        {
                            oApo.GPS = string.Empty;
                        }
                        oApo.Justification = txtJustification.Text;
                        if (fuUploadDocument.HasFile)
                        {
                            string fileName = Path.GetFileName(fuUploadDocument.PostedFile.FileName);
                            fuUploadDocument.PostedFile.SaveAs(Server.MapPath("~/Upload/ApoDocuments/") + fileName);
                            oApo.Document = fuUploadDocument.FileName;
                        }
                        if (Session["IsEdit"] == null)
                        {
                            APOBAL.Instance.SubmitAPO(oApo);
                            string strSuccess = "Data has been saved successfully.";
                            vmSuccess.Message = strSuccess;
                            FlashMessage.InfoMessage(vmSuccess.Message);
                        }
                        else
                        {
                            //Label Id = (Label)row.FindControl("lblId");
                            HiddenField hdnId = (HiddenField)row.FindControl("hdnId");
                            //oApo.APOId = Convert.ToInt32(Id.Text);
                            oApo.APOId        = Convert.ToInt32(hdnId.Value);
                            oApo.LoggedInUser = AuthoProvider.User;
                            APOBAL.Instance.ModifyAPO(oApo);
                            string strSuccess = "Data has been updated successfully.";
                            vmSuccess.Message = strSuccess;
                            FlashMessage.InfoMessage(vmSuccess.Message);
                            //Session["IsEdit"] = null;
                        }
                    }
                    //else
                    //{
                    //    oApo.NumberOfItems = 0.0;
                    //    oApo.UnitPrice = 0.0;
                    //    oApo.Total = 0.0;
                    //    oApo.IsFilled = false;
                    //}
                }
            }
            catch (Exception ex)
            {
                LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
                Response.RedirectPermanent("~/ErrorPage.aspx", false);
                //string strError = ex.Message;
                //vmError.Message = strError;
                //FlashMessage.ErrorMessage(vmError.Message);
                //return;
            }
        }
예제 #24
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                bool   IsByPass = true;
                string reginalOfficerDiaryNo = string.Empty;
                if (Session["apoFileId"] != null && ddlName.SelectedValue != "0" && txtComments.Text != "")
                {
                    userRole = AuthoProvider.LoggedInRoles.ToList();
                    if (userRole.Contains(Role.NTCA) && IsByPass == false)
                    {
                        DataSet dsRODiaryNum = APOBAL.Instance.GetRegionalOfficerDiaryNumber(Convert.ToInt32(Session["APOFileId"]));
                        if (dsRODiaryNum.Tables[0].Rows.Count > 0)
                        {
                            DataRow dr = dsRODiaryNum.Tables[0].Rows[0];
                            reginalOfficerDiaryNo = Convert.ToString(dr["RegionalOfficerDiaryNumner"]);
                            if (!string.IsNullOrEmpty(reginalOfficerDiaryNo) || dr[0] != DBNull.Value)
                            {
                                APOBAL.Instance.UpdateStatus(Convert.ToInt32(Session["apoFileId"]), Convert.ToInt32(ddlName.SelectedValue), true, txtComments.Text, reginalOfficerDiaryNo, txtBypass.Text);
                                string strSuccess = "APO status has been updated successfully.";
                                vmSuccess.Message = strSuccess;
                                FlashMessage.InfoMessage(vmSuccess.Message);
                                Session["apoFileId"] = null;
                                Clear();
                            }
                            else
                            {
                                string strError = "Regional Officer has not taken any action against this APO, please alert him / her.";
                                vmError.Message = strError;
                                FlashMessage.ErrorMessage(vmError.Message);
                                return;
                            }
                        }
                    }

                    if (userRole.Contains(Role.NTCA) && IsByPass == true)
                    {
                        APOBAL.Instance.UpdateStatus(Convert.ToInt32(Session["apoFileId"]), Convert.ToInt32(ddlName.SelectedValue), true, txtComments.Text, reginalOfficerDiaryNo, txtBypass.Text);
                        string strSuccess = "APO has been byPaas successfully.";
                        vmSuccess.Message = strSuccess;
                        FlashMessage.InfoMessage(vmSuccess.Message);
                        Session["apoFileId"] = null;
                        Clear();
                    }
                    else if (userRole.Contains(Role.REGIONALOFFICER))
                    {
                        if (!string.IsNullOrEmpty(txtRODiaryNum.Text))
                        {
                            APOBAL.Instance.UpdateStatus(Convert.ToInt32(Session["apoFileId"]), Convert.ToInt32(ddlName.SelectedValue), false, txtComments.Text, txtRODiaryNum.Text, null);
                            string strSuccess = "APO status has been updated successfully.";
                            UserBAL.Instance.InsertAuditTrailDetail("Updated APO Status", "Update APO Status");
                            vmSuccess.Message = strSuccess;
                            FlashMessage.InfoMessage(vmSuccess.Message);
                            Session["apoFileId"] = null;
                            Clear();
                        }
                        else
                        {
                            string strError = "Please enter your dairy number.";
                            vmError.Message = strError;
                            FlashMessage.ErrorMessage(vmError.Message);
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
                Response.RedirectPermanent("~/ErrorPage.aspx", false);
                //string strError = ex.Message;
                //vmError.Message = strError;
                //FlashMessage.ErrorMessage(vmError.Message);
                //return;
            }
        }