예제 #1
0
        /// <summary>
        /// Edit author object to database
        /// </summary>
        /// <param name="obj">ATTAuthor object</param>
        /// <returns>return bool</returns>
        public static bool EditAuthor(ATTAuthor obj, Previlege pobj)
        {
            string EditSP;

            EditSP = "SP_EDIT_AUTHOR";

            //Preparing oracle parameter with value
            OracleParameter[] paramArray = new OracleParameter[2];
            paramArray[0] = Utilities.GetOraParam(":p_AUTHOR_ID", obj.AuthorID, OracleDbType.Int64, ParameterDirection.InputOutput);
            paramArray[1] = Utilities.GetOraParam(":p_AUTHOR_NAME", obj.AuthorName, OracleDbType.Varchar2, ParameterDirection.Input);

            GetConnection getConn = new GetConnection();

            try
            {
                OracleConnection DBConn = getConn.GetDbConn(Module.LIS);

                if (Previlege.HasPrevilege(pobj, DBConn) == false)
                {
                    throw new ArgumentException(Utilities.PreviledgeMsg + " update Author.");
                }

                SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, EditSP, paramArray);

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                getConn.CloseDbConn();
            }
        }
예제 #2
0
 /// <summary>
 /// Passes author object to data layer to update in database
 /// </summary>
 /// <param name="obj">ATTAuthor object</param>
 /// <param name="username">username for checking previlege at database level</param>
 /// <param name="menuname">menuname for checking previlege at database level</param>
 /// <returns>return bool</returns>
 public static bool EditAuthor(ATTAuthor obj, Previlege pobj)
 {
     try
     {
         return(DLLAuthor.EditAuthor(obj, pobj));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
        /// <summary>
        /// Validates Author object
        /// </summary>
        /// <param name="obj">object of ATTAuthor</param>
        /// <returns>object of ObjectValidation</returns>
        public static ObjectValidation Validate(ATTAuthor obj)
        {
            ObjectValidation OV = new ObjectValidation();

            if (obj.AuthorName == "")
            {
                OV.IsValid      = false;
                OV.ErrorMessage = "Author name cannot be empty.";
                return(OV);
            }

            return(OV);
        }
예제 #4
0
    protected void lstCurrency_SelectedIndexChanged(object sender, EventArgs e)
    {
        List <ATTAuthor> lst = (List <ATTAuthor>)Session["Author_AuthorList"];

        ATTAuthor author = lst.Find
                           (
            delegate(ATTAuthor au)
        {
            return(au.AuthorID == int.Parse(this.lstAuthor.SelectedValue));
        }
                           );

        this.txtAuthorName_Rqd.Text = author.AuthorName;
    }
예제 #5
0
        /// <summary>
        /// Get list of author
        /// </summary>
        /// <param name="authorID">Author ID for filter criteria</param>
        /// <returns> List<> of ATTAuthor</returns>
        public static List <ATTAuthor> GetAuthorList(int?authorID)
        {
            List <ATTAuthor> lstAuthor = new List <ATTAuthor>();

            try
            {
                foreach (DataRow row in DLLAuthor.GetAuthorTable(authorID).Rows)
                {
                    ATTAuthor obj = new ATTAuthor
                                    (
                        int.Parse(row["Author_ID"].ToString()),
                        row["Author_Name"].ToString()
                                    );

                    lstAuthor.Add(obj);
                }
                return(lstAuthor);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #6
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ATTAuthor authorObj = new ATTAuthor
                              (
            0,
            this.txtAuthorName_Rqd.Text,
            ((ATTUserLogin)Session["Login_User_Detail"]).UserName,
            DateTime.Now
                              );

        ObjectValidation OV = BLLAuthor.Validate(authorObj);

        if (OV.IsValid == false)
        {
            this.lblStatus.Text = OV.ErrorMessage;
            return;
        }

        List <ATTAuthor> lstAuth = (List <ATTAuthor>)Session["Author_AuthorList"];

        ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]);

        try
        {
            if (this.lstAuthor.SelectedIndex < 0)
            {
                if (user.MenuList["4,4,1"] == null || user.MenuList["4,4,1"].PAdd == "N")
                {
                    this.lblStatus.Text = Utilities.PreviledgeMsg + " add Author.";
                    return;
                }
                Previlege pobj = new Previlege(user.UserName, "4,4,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD);

                BLLAuthor.AddAuthor(authorObj, pobj);
                lstAuth.Add(authorObj);
            }
            else
            {
                if (user.MenuList["4,4,1"] == null || user.MenuList["4,4,1"].PEdit == "N")
                {
                    this.lblStatus.Text = Utilities.PreviledgeMsg + " update Author.";
                    return;
                }
                Previlege pobj = new Previlege(user.UserName, "4,4,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT);

                authorObj.AuthorID = int.Parse(this.lstAuthor.SelectedValue);

                BLLAuthor.EditAuthor(authorObj, pobj);
                lstAuth[this.lstAuthor.SelectedIndex] = authorObj;
            }


            this.lstAuthor.DataSource     = lstAuth;
            this.lstAuthor.DataTextField  = "AuthorName";
            this.lstAuthor.DataValueField = "AuthorID";

            this.lstAuthor.DataBind();

            this.ClearAuthorControl();
        }
        catch (Exception ex)
        {
            this.lblStatus.Text = ex.Message;
        }
    }
    protected void btnAddAuthor_Click(object sender, EventArgs e)
    {
        if (this.ddlAuthor.SelectedIndex <= 0)
        {
            return;
        }

        ATTLibraryMaterial LM = (ATTLibraryMaterial)Session["LM_LibraryMaterial"];

        GridViewRow row;
        int         rowCount = 0;

        foreach (ATTLibraryMaterialAuthor ath in LM.LstLMAuthor)
        {
            row            = this.grdAuthor.Rows[rowCount];
            ath.HasChecked = ((CheckBox)row.FindControl("chkAuthor")).Checked;

            rowCount = rowCount + 1;
        }

        ATTAuthor author = new ATTAuthor
                           (
            int.Parse(this.ddlAuthor.SelectedValue),
            this.ddlAuthor.SelectedItem.Text
                           );

        ATTLibraryMaterialAuthor LMAuthor = new ATTLibraryMaterialAuthor();

        LMAuthor.OrgID     = int.Parse(this.ddlOrg.SelectedValue);
        LMAuthor.LibraryID = int.Parse(this.ddlLibrary.SelectedValue);
        if (this.hdnAction.Value != "M")
        {
            LMAuthor.LMaterialID = 0;
        }
        LMAuthor.EntryBy = ((ATTUserLogin)Session["Login_User_Detail"]).UserName;
        LMAuthor.EntryOn = DateTime.Now;
        LMAuthor.Action  = "A";

        LMAuthor.Author = author;

        ATTLibraryMaterialAuthor existAuthor = LM.LstLMAuthor.Find
                                               (
            delegate(ATTLibraryMaterialAuthor lma)
        {
            return
            (lma.OrgID == LMAuthor.OrgID &&
             lma.LibraryID == LMAuthor.LibraryID &&
             lma.AuthorID == LMAuthor.AuthorID);
        }
                                               );

        if (existAuthor != null)
        {
            return;
        }

        LM.LstLMAuthor.Add(LMAuthor);

        this.grdAuthor.DataSource = LM.LstLMAuthor;
        this.grdAuthor.DataBind();
    }