Ejemplo n.º 1
0
        /// <summary>
        /// Update Database Make data as Obsoluted
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void IsObsolete_CheckedChanged(Object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                CheckBox               chk = (CheckBox)sender;
                GridViewRow            gr  = (GridViewRow)chk.Parent.Parent;
                string                 APPROVALTEMPAUTHORISERID = ((Literal)gr.FindControl("litLineTypeID")).Text;
                SharedAuthorizationBLL objtempBLL = new SharedAuthorizationBLL();
                SharedAuthorizationBO  objtemp    = objtempBLL.GetSharedAuthorizationsByID(Convert.ToInt32(APPROVALTEMPAUTHORISERID));

                objtempBLL.ObsoleteTempAuthorizationsByID(Convert.ToInt32(APPROVALTEMPAUTHORISERID), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data Updated successfully";
                }
                string status = "";
                if (!chk.Checked)
                {
                    status = "INS";
                }
                SendMailForUser(status, Convert.ToInt32(objtemp.AssignedTo), objtemp);
                ClearDetails();
                Bindgrid();
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdTempAuth_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            try
            {
                if (e.CommandName == "EditRow")
                {
                    ViewState["SharedUser"] = e.CommandArgument;
                    SharedAuthorizationBLL objtempBLL = new SharedAuthorizationBLL();
                    SharedAuthorizationBO  objtemp    = objtempBLL.GetSharedAuthorizationsByID(Convert.ToInt32(ViewState["SharedUser"].ToString()));

                    ddlAssignTo.ClearSelection();
                    ddlAssignTo.SelectedValue = objtemp.AssignedToId.ToString();
                    ddlModuleDropDownList.ClearSelection();
                    ddlModuleDropDownList.SelectedValue = objtemp.ModuleId.ToString();
                    getWorkfolwitemByModuleID();
                    ddlWorkflowItemDropDownList.ClearSelection();
                    ddlWorkflowItemDropDownList.SelectedValue = objtemp.WorkFlowId.ToString();

                    txtRemarks.Text = objtemp.Remarks.ToString();
                    btnSave.Text    = "Update";
                    btnClear.Text   = "Cancel";
                }
                else if (e.CommandName == "DeleteRow")
                {
                    SharedAuthorizationBLL objtempBLL = new SharedAuthorizationBLL();

                    objtempBLL.DeleteSharedAuthorizationsByID(Convert.ToInt32(e.CommandArgument));
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data deleted successfully";
                    }
                    ClearDetails();
                    Bindgrid();
                }
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }