Esempio n. 1
0
        public static List <ATTLibraryMaterialAuthor> GetLibraryMaterialAuthorList(int orgID, int libraryID, decimal lMaterialID)
        {
            try
            {
                List <ATTLibraryMaterialAuthor> lst = new List <ATTLibraryMaterialAuthor>();
                foreach (DataRow row in DLLLibraryMaterialAuthor.GetLibraryMaterialAuthorTable(orgID, libraryID, lMaterialID).Rows)
                {
                    ATTLibraryMaterialAuthor author = new ATTLibraryMaterialAuthor();

                    author.OrgID       = int.Parse(row["Org_ID"].ToString());
                    author.LibraryID   = int.Parse(row["Library_ID"].ToString());
                    author.LMaterialID = long.Parse(row["L_Material_ID"].ToString());
                    author.Action      = "M";

                    author.Author.AuthorID   = int.Parse(row["Author_ID"].ToString());
                    author.Author.AuthorName = row["Author_Name"].ToString();

                    lst.Add(author);
                }

                return(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public static List <ATTLibraryMaterialAuthor> SearchMaterial(int langID, int[] checkedAuthors, int[] checkedKeywords)
        {
            List <ATTLibraryMaterialAuthor> LibraryMaterialLst = new List <ATTLibraryMaterialAuthor>();

            foreach (DataRow row in DLLLibraryMaterialAuthor.SearchMaterialTable(langID, checkedAuthors, checkedKeywords).Rows)
            {
                ATTLibraryMaterialAuthor LMA = new ATTLibraryMaterialAuthor(int.Parse(row["org_id"].ToString()),
                                                                            int.Parse(row["library_id"].ToString()),
                                                                            int.Parse(row["l_material_id"].ToString()),
                                                                            row["category_name"].ToString(),
                                                                            row["m_cat_desc"].ToString(),
                                                                            row["lang_name"].ToString(),
                                                                            row["call_no"].ToString(),
                                                                            row["corporate_body"].ToString(),
                                                                            row["publisher_name"].ToString()
                                                                            );

                LibraryMaterialLst.Add(LMA);
            }
            return(LibraryMaterialLst);
        }
    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();
    }