//List public List <eSunSpeedDomain.AuthorModel> GetAllAuthors() { List <eSunSpeedDomain.AuthorModel> lstAuthors = new List <eSunSpeedDomain.AuthorModel>(); eSunSpeedDomain.AuthorModel objModel; string Query = "SELECT DISTINCT Author_Id,Author_Name,Author_Alias,Author_PName FROM AuthorMaster"; System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject()); while (dr.Read()) { objModel = new eSunSpeedDomain.AuthorModel(); objModel.Author_Id = DataFormat.GetInteger(dr["Author_Id"]); objModel.Name = dr["Author_Name"].ToString(); objModel.Alias = dr["Author_Alias"].ToString(); objModel.PrintName = dr["Author_PName"].ToString(); //objModel.ConnectAcc = Convert.ToBoolean(dr["Author_Connect"]); //objModel.MobileNo = dr["Author_Mobile"].ToString(); //objModel.Address = dr["Author_Address"].ToString(); //objModel.Street = dr["Author_Street"].ToString(); //objModel.City = dr["Author_City"].ToString(); //objModel.Country = dr["Author_Country"].ToString(); //objModel.State = dr["Author_State"].ToString(); //objModel.PinCode = dr["Author_PinCode"].ToString(); lstAuthors.Add(objModel); } return(lstAuthors); }
//Update public bool UpdateAuthorMaster(eSunSpeedDomain.AuthorModel objAuthor) { string Query = string.Empty; bool isUpdated = true; try { DBParameterCollection paramCollection = new DBParameterCollection(); paramCollection.Add(new DBParameter("@Author_Name", objAuthor.Name)); paramCollection.Add(new DBParameter("@Author_Alias", objAuthor.Alias)); paramCollection.Add(new DBParameter("@Author_PrintName", objAuthor.PrintName)); paramCollection.Add(new DBParameter("@Author_ConnectAcc", objAuthor.ConnectAcc, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@Author_Address", objAuthor.Address)); paramCollection.Add(new DBParameter("@Author_Address1", objAuthor.Address1)); paramCollection.Add(new DBParameter("@Author_Address2", objAuthor.Address2)); paramCollection.Add(new DBParameter("@Author_Address3", objAuthor.Address3)); paramCollection.Add(new DBParameter("@Author_State", objAuthor.State)); paramCollection.Add(new DBParameter("@Author_Telnumber", objAuthor.Telephone)); paramCollection.Add(new DBParameter("@Author_MobileNo", objAuthor.MobileNo)); paramCollection.Add(new DBParameter("@Author_email", objAuthor.Email)); paramCollection.Add(new DBParameter("@ModifiedBy", "Admin")); paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now)); paramCollection.Add(new DBParameter("@Author_Id", objAuthor.Author_Id)); Query = "UPDATE AuthorMaster SET Author_Name=@Author_Name,Author_Alias=@Author_Alias,Author_PName=@Author_PrintName,`Author_Connect`=@Author_ConnectAcc," + "Author_Address=@Author_Address,`Author_Address1`=@Author_Address1,`Author_Address2`=Author_Address2,`Author_Address3`=@Author_Address3,Author_State=@Author_State," + "Author_TeleNumber=@Author_Telnumber,Author_Mobile=@Author_MobileNo,Author_Email=@Author_Email,ModifiedBy=@ModifiedBy" + " WHERE Author_Id=@Author_Id;"; if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0) { isUpdated = true; } } catch (Exception ex) { isUpdated = false; throw ex; } return(isUpdated); }